Closed
Description
It might be nice if we made I
callable so that you can write I(10)
and get a 10x10 Diagonal matrix object. Of course it's a bit weird to call one kind of object and get another, but we do that with functions all the time so maybe that's no problem. Possible definition:
(σ::UniformScaling)(n::Integer) = Diagonal(collect(Iterators.repeated(σ.λ, n)))
With this definition, we could potentially deprecate eye(n)
(which is usually quite inefficient) in favor of I(n)
when one doesn't need to mutate any off-diagonals or full(I(n))
in the cases where one does need to mutate an off-diagonal.
Activity