Skip to content

Commit 8c9653a

Browse files
committed
method renaming, add explicit returns
1 parent e22ed98 commit 8c9653a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/SparseArrays/src/sparsematrix.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ function SparseMatrixCSC{Tv,Ti}(M::AbstractMatrix) where {Tv,Ti}
383383
push!(V, v)
384384
end
385385
end
386-
sparse_increasing!(I, V, size(M)...)
386+
return sparse_sortedlinearindices!(I, V, size(M)...)
387387
end
388388

389389
function SparseMatrixCSC{Tv,Ti}(M::StridedMatrix) where {Tv,Ti}
@@ -1340,7 +1340,7 @@ function _sparse_findprevnz(m::SparseMatrixCSC, i::Integer)
13401340
end
13411341

13421342

1343-
function sparse_increasing!(I::Vector{Ti}, V::Vector, m::Int, n::Int) where Ti
1343+
function sparse_sortedlinearindices!(I::Vector{Ti}, V::Vector, m::Int, n::Int) where Ti
13441344
length(I) == length(V) || throw(ArgumentError("I and V should have the same length"))
13451345
nnz = length(V)
13461346
colptr = Vector{Ti}(undef, n + 1)
@@ -1353,7 +1353,7 @@ function sparse_increasing!(I::Vector{Ti}, V::Vector, m::Int, n::Int) where Ti
13531353
j <= nnz && (I[j] += colm)
13541354
colm += m
13551355
end
1356-
SparseMatrixCSC(m, n, colptr, I, V)
1356+
return SparseMatrixCSC(m, n, colptr, I, V)
13571357
end
13581358

13591359
"""
@@ -1382,7 +1382,7 @@ function sprand(r::AbstractRNG, m::Integer, n::Integer, density::AbstractFloat,
13821382
(m < 0 || n < 0) && throw(ArgumentError("invalid Array dimensions"))
13831383
0 <= density <= 1 || throw(ArgumentError("$density not in [0,1]"))
13841384
I = randsubseq(r, 1:(m*n), density)
1385-
sparse_increasing!(I, convert(Vector{T}, rfn(r,length(I))), m, n)
1385+
return sparse_sortedlinearindices!(I, convert(Vector{T}, rfn(r,length(I))), m, n)
13861386
end
13871387

13881388
sprand(m::Integer, n::Integer, density::AbstractFloat, rfn::Function, ::Type{T} = eltype(rfn(1))) where T = sprand(GLOBAL_RNG,m,n,density,(r, i) -> rfn(i))

0 commit comments

Comments
 (0)