@@ -259,9 +259,9 @@ nonzeros(S::UpperTriangular{<:Any,<:SparseMatrixCSCUnion}) = nonzeros(S.data)
259259nonzeros (S:: LowerTriangular{<:Any,<:SparseMatrixCSCUnion} ) = nonzeros (S. data)
260260
261261"""
262- rowvals(A::AbstractSparseMatrixCSC )
262+ rowvals(A)
263263
264- Return a vector of the row indices of `A`. Any modifications to the returned
264+ Return a vector of the row indices of sparse array `A`. Any modifications to the returned
265265vector will mutate `A` as well. Providing access to how the row indices are
266266stored internally can be useful in conjunction with iterating over structural
267267nonzero values. See also [`nonzeros`](@ref) and [`nzrange`](@ref).
@@ -287,10 +287,10 @@ rowvals(S::UpperTriangular{<:Any,<:SparseMatrixCSCUnion}) = rowvals(S.data)
287287rowvals (S:: LowerTriangular{<:Any,<:SparseMatrixCSCUnion} ) = rowvals (S. data)
288288
289289"""
290- nzrange(A::AbstractSparseMatrixCSC , col::Integer)
290+ nzrange(A, col::Integer)
291291
292- Return the range of indices to the structural nonzero values of a sparse matrix
293- column . In conjunction with [`nonzeros`](@ref) and
292+ Return the range of indices to the structural nonzero values of column `col`
293+ of sparse array `A` . In conjunction with [`nonzeros`](@ref) and
294294[`rowvals`](@ref), this allows for convenient iterating over a sparse matrix :
295295
296296 A = sparse(I,J,V)
@@ -994,9 +994,10 @@ float(S::SparseMatrixCSC) = SparseMatrixCSC(size(S, 1), size(S, 2), getcolptr(S)
994994complex (S:: SparseMatrixCSC ) = SparseMatrixCSC (size (S, 1 ), size (S, 2 ), getcolptr (S), rowvals (S), complex (nonzeros (S)))
995995
996996"""
997- sparse(A)
997+ sparse(A::Union{AbstractVector, AbstractMatrix} )
998998
999- Convert an AbstractMatrix `A` into a sparse matrix.
999+ Convert a vector or matrix `A` into a sparse array.
1000+ Numerical zeros in `A` are turned into structural zeros.
10001001
10011002# Examples
10021003```jldoctest
@@ -1011,6 +1012,17 @@ julia> sparse(A)
10111012 1.0 ⋅ ⋅
10121013 ⋅ 1.0 ⋅
10131014 ⋅ ⋅ 1.0
1015+
1016+ julia> [1.0, 0.0, 1.0]
1017+ 3-element Vector{Float64}:
1018+ 1.0
1019+ 0.0
1020+ 1.0
1021+
1022+ julia> sparse([1.0, 0.0, 1.0])
1023+ 3-element SparseVector{Float64, Int64} with 2 stored entries:
1024+ [1] = 1.0
1025+ [3] = 1.0
10141026```
10151027"""
10161028sparse (A:: AbstractMatrix{Tv} ) where {Tv} = convert (SparseMatrixCSC{Tv}, A)
0 commit comments