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

Avoid reading inactive rowvals when computing the rank of a QRSparse #29925

Merged
merged 1 commit into from
Nov 5, 2018

Conversation

andreasnoack
Copy link
Member

Fixes #29787

@andreasnoack andreasnoack added linear algebra Linear algebra sparse Sparse arrays bugfix This change fixes an existing bug stdlib Julia's standard library backport pending 1.0 labels Nov 4, 2018
@@ -342,7 +342,7 @@ end
_ret_size(F::QRSparse, b::AbstractVector) = (size(F, 2),)
_ret_size(F::QRSparse, B::AbstractMatrix) = (size(F, 2), size(B, 2))

LinearAlgebra.rank(F::QRSparse) = maximum(F.R.rowval)
LinearAlgebra.rank(F::QRSparse) = reduce(max, view(F.R.rowval, 1:nnz(F.R)), init = eltype(F.R.rowval)(0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use SparseArrays.nzvalview instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using the rowvals here, not the nzvals. We could add rowvalview but I think we should wait until there are more use cases.

@andreasnoack andreasnoack merged commit 911a58c into master Nov 5, 2018
@andreasnoack andreasnoack deleted the an/rank branch November 5, 2018 21:25
KristofferC pushed a commit that referenced this pull request Nov 12, 2018
@KristofferC KristofferC mentioned this pull request Nov 12, 2018
61 tasks
KristofferC pushed a commit that referenced this pull request Dec 12, 2018
KristofferC pushed a commit that referenced this pull request Feb 11, 2019
KristofferC pushed a commit that referenced this pull request Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug linear algebra Linear algebra sparse Sparse arrays stdlib Julia's standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants