-
-
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
add spr! to LinearAlgebra.BLAS #42830
Conversation
PackedArrays.jl btw is an as of now private package which i plan to register and make public soon hopefully which implements a new |
i don't think any of the failing tests are this PRs fault |
α::Real, x::Union{DenseArray{T}, AbstractVector{T}}, | ||
AP::Union{DenseArray{T}, AbstractVector{T}}) where {T <: BlasReal} |
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.
Is there a usecase for x::DenseArray
or would it make more sense to restrict it to just AbstractVector
?
For AP
, on the other hand, I don’t think we should allow AbstractVector
without checking that its stride is compatible, i.e., chkstride1(AP)
.
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 too wondered about x::DenseArray
. but that is what spmv!
inputs. is there a use case for it there? smpv!
also does not check the stride of AP. happy to change it here, but would be nice to keep everything in sync.
if 2*length(AP) < N*(N + 1) | ||
throw(DimensionMismatch("Packed symmetric matrix A has size smaller than length(x) = $(N).")) | ||
end | ||
return spr!(uplo, N, convert(T, α), x, stride(x, 1), AP) |
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 will use the wrong pointer for x
if stride(x,1)
is negative. However, no BLAS wrappers except for gemv!
(edit: and dot
) currently handle negative strides correctly, so it may be ok to leave this for a separate PR.
(Support for negative strides in gemv!
was added in #41513 and I plan to add it for the other BLAS functions once there is a decision on whether to merge #42012 or #42054.)
Co-authored-by: Sebastian Stock <42280794+sostock@users.noreply.github.com>
I think this PR is complete and consistent with the current state of the surrounding functions, so I'll merge once tests pass. I believe we have an issue tracking negative strides, another issue raised was to check the stride for the vector inputs and to catch non-sense |
@iolaszlo in your PR for spmv you included |
Some discussion can be found here: #34320 (comment). I think there are several places in the BLAS context where we consider any contiguous array simply as a list, no matter what its dimensionality is "officially". |
Some more thoughts. Regarding DenseArrays, that doesn't seem to hurt, and generalizes the methods to any array that is stored contiguously, which is pretty much what BLAS methods need, IIUC. We could test that behavior by calling the new BLAS functions (i) on reshaped |
The docstring seems wrong. It says
while it should be |
dang, sorry about that, my bad. please submit a PR to fix it! |
alright, I opened #44303. Hopefully still in time for v1.8 |
i used
spmv!
as a template