-
-
Notifications
You must be signed in to change notification settings - Fork 39
Description
UniformScaling is very useful in LinearAlgebra operations, because it optimizes the performances due to the fact that the compiler knows that it behaves like an identity matrix (possibly multiplied by some factor).
I'm aware that I(N) creates a Diagonal matrix of type Bool with all true in the diagonal. This constructor basically stores a vector inside, which stores all the values of the Diagonal.
In my opinion, it would be very useful to have another construction (let's say SizedUniformScaling), which behaves like a UniformScaling but additionally stores also the dimension. This is very useful in contexts like Kronecker's product. For example, one can define a method like
kron(A::Matrix, I::SizedUniformScaling)
which would be impossible with UniformScaling.
I'm currently using the method kron(A::Matrix, I::UniformScaling), but I basically only need to multiply it by an identity, and converting it into a Diagonal matrix seems an overkill.
Moreover, this would also be useful for defining methods for other AbstractMatrixs, for example for CUDA, Metal, DistributedArrays, and many others.