-
-
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
Added sparse*diagonal, diagonal*sparse methods and tests. Fixes #14416. #14461
Conversation
@inbounds for k=1:length(nzval) | ||
Ynzval[k] = X[rowval[k],rowval[k]] * nzval[k] | ||
end | ||
SparseMatrixCSC(A.m, A.n, A.colptr, A.rowval, Ynzval) |
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.
copy
the colptr
and rowval
otherwise these alias
0212afc
to
fa7dfaf
Compare
rowval = A.rowval | ||
nzval = A.nzval | ||
@inbounds for col = 1:A.n, k=A.colptr[col]:(A.colptr[col+1]-1) | ||
Ynzval[k] += X[col, col] * nzval[k] |
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.
This shouldn't need to be +=
since colptr
is nondecreasing. Also would be better to use Array
rather than zeros
to initialize the nonzeros since you can make sparse matrices with element types that don't have zero
defined.
fa7dfaf
to
f34a8b8
Compare
rowval = A.rowval | ||
nzval = A.nzval | ||
@inbounds for k=1:length(nzval) | ||
Ynzval[k] = X.diag[rowval[k]] * nzval[k] |
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.
the .diag
field access may be worth hoisting
@kshyatt Thanks for providing these. I think it would make sense to define them as methods for |
@andreasnoack that seems much better, actually, because we will minimize code duplication. Will update. |
f34a8b8
to
6b607e0
Compare
Good to go? |
Added sparse*diagonal, diagonal*sparse methods and tests. Fixes #14416.
No description provided.