You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue seems to be with summing a partially uninitialised Matrix and a Diagonal, which lacks a specialised method. I'll try to come up with a fix, which may also help with performance.
I've looked into it. The problem is that when you call UpperTriangular(id.data) the result is a UpperTriangular{Bool, Diagonal{Bool, Vector{Bool}}}, that is, it is not a strided matrix, and therefore doesn't get caught by the specialized method for summing triangular matrices, but instead goes to the default sum, which cannot handle the undefs.
Argh, this means that whenever Hermitian is wrapping an abstract matrix the same problem will appear. There must be a better solution than writing a specialized method for every single type of abstract matrix. Maybe it's better to do the sum over the upper (or lower) triangular for everything, and let the sparse arrays define their own specialized methods?
Yes, that makes sense. Perhaps we need to expose some function that falls back to summing over the triangular parts, and one that may be specialized by packages. The reason the current implementation was limited to StridedArrays was to avoid breakages by using scalar indexing for custom arrays, so we need to be a bit careful about that.
Activity
jishnub commentedon Mar 3, 2024
The issue seems to be with summing a partially uninitialised Matrix and a Diagonal, which lacks a specialised method. I'll try to come up with a fix, which may also help with performance.
araujoms commentedon Mar 3, 2024
I've looked into it. The problem is that when you call
UpperTriangular(id.data)
the result is aUpperTriangular{Bool, Diagonal{Bool, Vector{Bool}}}
, that is, it is not a strided matrix, and therefore doesn't get caught by the specialized method for summing triangular matrices, but instead goes to the default sum, which cannot handle theundef
s.Argh, this means that whenever
Hermitian
is wrapping an abstract matrix the same problem will appear. There must be a better solution than writing a specialized method for every single type of abstract matrix. Maybe it's better to do the sum over the upper (or lower) triangular for everything, and let the sparse arrays define their own specialized methods?jishnub commentedon Mar 3, 2024
Yes, that makes sense. Perhaps we need to expose some function that falls back to summing over the triangular parts, and one that may be specialized by packages. The reason the current implementation was limited to
StridedArrays
was to avoid breakages by using scalar indexing for custom arrays, so we need to be a bit careful about that.Add upper/lowertriangular functions and use in applytri (#53573)
Reland "Reroute Symmetric/Hermitian + Diagonal through triangular"
Reland "Reroute Symmetric/Hermitian + Diagonal through triangular"
Add upper/lowertriangular functions and use in applytri (#53573)
araujoms commentedon May 12, 2025
This is fixed in 1.11.5, not sure since when.
dkarrasch commentedon May 12, 2025
Probably since JuliaLang/julia#53573.