Open lucaferranti opened 3 years ago
At the moment tril and triu do not work for static arrays
tril
triu
julia> B = @SMatrix [1 2 3 4;5 6 7 8;9 10 11 12; 13 14 15 16] 4×4 SMatrix{4, 4, Int64, 16} with indices SOneTo(4)×SOneTo(4): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 julia> tril(B) ERROR: setindex!(::SMatrix{4, 4, Int64, 16}, value, ::Int) is not defined. Stacktrace: [1] error(s::String) @ Base .\error.jl:33 [2] setindex!(a::SMatrix{4, 4, Int64, 16}, value::Int64, i::Int64) @ StaticArrays ~\.julia\packages\StaticArrays\rdb0l\src\indexing.jl:3 [3] macro expansion @ ~\.julia\packages\StaticArrays\rdb0l\src\indexing.jl:66 [inlined] [4] _setindex!_scalar @ ~\.julia\packages\StaticArrays\rdb0l\src\indexing.jl:46 [inlined] [5] setindex! @ ~\.julia\packages\StaticArrays\rdb0l\src\indexing.jl:42 [inlined] [6] tril! @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\dense.jl:176 [inlined] [7] tril! @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\generic.jl:443 [inlined] [8] tril(M::SMatrix{4, 4, Int64, 16}) @ LinearAlgebra C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\generic.jl:365 [9] top-level scope @ REPL[126]:1
I think it might be useful in some situations to have those working for static arrays.
Could (should?) be fixed in Julia by using copymutable instead of copy in tril and triu, I guess.
copymutable
copy
At the moment
tril
andtriu
do not work for static arraysI think it might be useful in some situations to have those working for static arrays.