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 #434

Open
vtjnash opened this issue Sep 1, 2023 · 0 comments
Open

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

vtjnash opened this issue Sep 1, 2023 · 0 comments

Comments

@vtjnash
Copy link
Contributor

vtjnash commented Sep 1, 2023

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.

originally posted at JuliaLang/julia#42553 by @tomhaber. I make no claim whether this issue is valid.

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

No branches or pull requests

1 participant