Add a sparse ev_view
for SymTridiagonal
backed by sparse arrays
#225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for JuliaLang/LinearAlgebra.jl#942, where
SymTridiagonal
matrices backed by sparse arrays couldn't be summed/subtracted/etc. The root cause is that adding@view
s of SparseArrays produces a dense array.https://github.com/JuliaLang/julia/blob/ec98087cbf19bac26f6be05df9282746b0cffe78/stdlib/LinearAlgebra/src/tridiag.jl#L207
https://github.com/JuliaLang/julia/blob/ec98087cbf19bac26f6be05df9282746b0cffe78/stdlib/LinearAlgebra/src/LinearAlgebra.jl#L449-L453
This
view
usage was added in JuliaLang/julia#42472 to deal with an implementation detail ofSymTridiagonal
s where the off-diagonal has an additional element that should usually be ignored. A view was used to access only the actual elements of the off-diagonal without copying. This PR makes it so that sparse arrays just use a regular (copying) slice, until a better fix is found (I am not sure if there has been any discussion about the sparse@view
sum thing).