LinearAlgebra.jl icon indicating copy to clipboard operation
LinearAlgebra.jl copied to clipboard

Support broadcasting `I`

Open LilithHafner opened this issue 3 years ago • 6 comments

It would be nice to create this matrix:

1 0 0 -1 0 0
0 1 0 0 -1 0
0 0 1 0 0 -1

with a single allocation by broadcasting I

x = Matrix{Int}(undef, 3, 6)
x[1:3, 1:3] .= I
x[1:3, 4:6] .= -I

LilithHafner avatar Sep 30 '22 00:09 LilithHafner