-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
methods for left-division ops involving triangular matrices and sparse vectors #14447
Conversation
More tests are always good. On 1, I think each of the methods could be useful, the challenge is how to implement them in a way that doesn't add up to so much code to maintain. The names of the methods will likely change once we have a transpose type, but the need for implementations of the operation won't suddenly disappear. |
eeebda6
to
d4844b5
Compare
Tests expanded to multiple (three) sparse vectors. Thanks! |
LGTM. @Sacha0, I assume this one is ready. |
d4844b5
to
a77a5c9
Compare
Rebased and touched up. Should be ready now. Thanks! |
a77a5c9
to
9fe35de
Compare
@test isapprox((func)(mat, spvec), (func)(mat, fspvec)) | ||
end | ||
# test in-place left-division methods not involving quotients | ||
eltypevec == typeof(zero(eltypemat)*zero(eltypevec) + zero(eltypemat)*zero(eltypevec)) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer just if
personally, likely better for coverage that way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if
it is, thanks!
…s and SparseVectors. Also add tests for those methods.
9fe35de
to
49c970f
Compare
methods for left-division ops involving triangular matrices and sparse vectors
Thanks for the review and merge! |
This pull request addresses part of JuliaLang/LinearAlgebra.jl#283 by providing methods for left-division operations involving triangular matrices and
SparseVector
s. I believe these methods cover all valid operations; please correct me if I missed cases. The implementations are in keeping with the discussion in JuliaLang/LinearAlgebra.jl#283. A few points:(1) I began implementing the corresponding right-division operations via the same approach. But I rapidly found that many relevant underlying methods (among A(t|c)_rdiv_B[t|c][!]) appear to be missing. So I nixed the effort. IIUC (#5332), supporting all such valid methods is not an objective. But should some of those be implemented? If so, which, and does that deserve an issue?
(2) In some cases the in-place operations introduce structural nonzeros that end up numerically zero. As those zeros should only appear in edge cases and stripping them can be expensive, the present implementation does not bother to strip them. Should it? (Edit: Given the discussion in #12605, #9906, and #9928, I guess the answer is no.)
(3) Testing with more than one
SparseVector
might be wise given theSparseVector
's nonzero pattern impacts the execution path. Should I add that, or leave the tests as they are?Thanks, and best!