Skip to content
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

Merged
merged 1 commit into from
Jan 27, 2016

Conversation

Sacha0
Copy link
Member

@Sacha0 Sacha0 commented Dec 19, 2015

This pull request addresses part of JuliaLang/LinearAlgebra.jl#283 by providing methods for left-division operations involving triangular matrices and SparseVectors. 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 the SparseVector's nonzero pattern impacts the execution path. Should I add that, or leave the tests as they are?

Thanks, and best!

@tkelman
Copy link
Contributor

tkelman commented Dec 19, 2015

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.

@kshyatt kshyatt added the linear algebra Linear algebra label Dec 20, 2015
@Sacha0
Copy link
Member Author

Sacha0 commented Dec 22, 2015

Tests expanded to multiple (three) sparse vectors. Thanks!

@Sacha0 Sacha0 changed the title [WIP] methods for left-division ops involving triangular matrices and sparse vectors [RFC] methods for left-division ops involving triangular matrices and sparse vectors Dec 22, 2015
@andreasnoack
Copy link
Member

LGTM. @Sacha0, I assume this one is ready.

@Sacha0
Copy link
Member Author

Sacha0 commented Jan 27, 2016

Rebased and touched up. Should be ready now. Thanks!

@Sacha0 Sacha0 changed the title [RFC] methods for left-division ops involving triangular matrices and sparse vectors methods for left-division ops involving triangular matrices and sparse vectors Jan 27, 2016
@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)) &&
Copy link
Contributor

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

Copy link
Member Author

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.
andreasnoack added a commit that referenced this pull request Jan 27, 2016
methods for left-division ops involving triangular matrices and sparse vectors
@andreasnoack andreasnoack merged commit 82f3ad4 into JuliaLang:master Jan 27, 2016
@Sacha0
Copy link
Member Author

Sacha0 commented Jan 27, 2016

Thanks for the review and merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants