Is it possible to raise the identity matrix to a power? I get an error if I try using the ^
operator.
x = [2 0 ; 0 2]
x^2 # this works fine
(2I)^2 #throws MethodError: no method matching ^(::UniformScaling{Int64}, ::Int64)
Note: I know that I could simply do (2^2)I
, but there are cases where this cannot be done (e.g. when a matrix is passed to a function which raises the matrix).
It's just a missing method for UniformScaling
objects. It would be great if you could open an issue about it so that it can be added in a future release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With