Skip to content

Commit

Permalink
some renaming to avoid polluting the module namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
abraunst committed Dec 12, 2018
1 parent 15103b0 commit 30cbcab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions stdlib/SparseArrays/src/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3509,8 +3509,8 @@ end

## circular shift

#swaps blocks start:split and split+1:fin in col
function swap!(col::AbstractVector, start::Integer, fin::Integer, split::Integer)
# thius helper in-place swaps blocks start:split and split+1:fin in col
function _swap!(col::AbstractVector, start::Integer, fin::Integer, split::Integer)
split == fin && return
reverse!(col, start, split)
reverse!(col, split + 1, fin)
Expand All @@ -3519,8 +3519,8 @@ function swap!(col::AbstractVector, start::Integer, fin::Integer, split::Integer
end


#this helper shifts a column by r
function shifter!(R::AbstractVector, V::AbstractVector, start::Integer, fin::Integer, m::Integer, r::Integer)
# this helper shifts a column by r. Used also by sparsevector.jl
function subvector_shifter!(R::AbstractVector, V::AbstractVector, start::Integer, fin::Integer, m::Integer, r::Integer)
split = fin
@inbounds for j = start:fin
# shift in the vertical direction...
Expand All @@ -3532,8 +3532,8 @@ function shifter!(R::AbstractVector, V::AbstractVector, start::Integer, fin::Int
end
end
# ...but rowval should be sorted within columns
swap!(R, start, fin, split)
swap!(V, start, fin, split)
_swap!(R, start, fin, split)
_swap!(V, start, fin, split)
end


Expand Down Expand Up @@ -3567,7 +3567,7 @@ function circshift!(O::SparseMatrixCSC, X::SparseMatrixCSC, (r,c)::Base.DimsInte
##### vertical shift
r = mod(r, X.m)
@inbounds for i=1:O.n
shifter!(O.rowval, O.nzval, O.colptr[i], O.colptr[i+1]-1, O.m, r)
subvector_shifter!(O.rowval, O.nzval, O.colptr[i], O.colptr[i+1]-1, O.m, r)
end
return O
end
Expand Down
2 changes: 1 addition & 1 deletion stdlib/SparseArrays/src/sparsevector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ end

function circshift!(O::SparseVector, X::SparseVector, (r,)::Base.DimsInteger{1})
O .= X
shifter!(O.nzind, O.nzval, 1, length(O.nzind), O.n, mod(r, X.n))
subvector_shifter!(O.nzind, O.nzval, 1, length(O.nzind), O.n, mod(r, X.n))
return O
end

Expand Down

0 comments on commit 30cbcab

Please sign in to comment.