Skip to content

Commit

Permalink
fix nonzeroinds for empty views
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarrasch committed Sep 9, 2023
1 parent 71c7174 commit 536d9fe
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/sparsevector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function _partialview_end_indices(x::SparseVectorPartialView)
end

function nonzeroinds(x::SparseVectorPartialView)
isempty(x.indices[1]) && return indtype(parent(x))[]
(first_idx, last_idx) = _partialview_end_indices(x)
nzinds = nonzeroinds(parent(x))
return @view(nzinds[first_idx:last_idx]) .- (x.indices[1][begin] - 1)
Expand Down

0 comments on commit 536d9fe

Please sign in to comment.