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

SparseArrays.nzrange could benefit from a Base.@propagate_inbounds #42553

Closed
tomhaber opened this issue Oct 8, 2021 · 1 comment
Closed

SparseArrays.nzrange could benefit from a Base.@propagate_inbounds #42553

tomhaber opened this issue Oct 8, 2021 · 1 comment
Labels
sparse Sparse arrays

Comments

@tomhaber
Copy link

tomhaber commented Oct 8, 2021

When doing the following type of iteration over SparseArrays, I was expecting that no bound checks would be added.
However nzrange does add some because it doesn't have Base.@propagate_inbounds

@inbounds for j = 1:n
  @inbounds for idx in nzrange(X,j)
  end
end

The exact semantics of @inbounds here is somewhat unclear: my intuitive feeling is that the @inbounds of the inner loop doesn't include the nzrange(X,j) and only the loop body. This is not how @inbounds is implemented however.

@ViralBShah ViralBShah added the sparse Sparse arrays label Jul 19, 2023
@ViralBShah
Copy link
Member

Should be moved to SparseArrays.jl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sparse Sparse arrays
Projects
None yet
Development

No branches or pull requests

3 participants