Skip to content

Commit 8e23309

Browse files
committed
Add spzeros
1 parent a4c599d commit 8e23309

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/abstractsparsearrayinterface.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ function densearray(a::AbstractArray)
3434
end
3535

3636
@doc """
37-
sprand([rng], [T::Type], dims; density::Real) -> A::SparseArrayDOK{T}
37+
spzeros([T::Type], dims) -> A::SparseArrayDOK{T}
38+
39+
Create an empty size `dims` sparse array.
40+
The optional `T` argument specifies the element type, which defualts to `Float64`.
41+
""" spzeros
42+
43+
spzeros(dims::Dims) = spzeros(Float64, dims)
44+
spzeros(::Type{T}, dims::Dims) where {T} = SparseArrayDOK{T}(undef, dims)
3845

3946
Create a random size `dims` sparse array in which the probability of any element being stored is independently given by `density`.
4047
The optional `rng` argument specifies a random number generator, see also `Random`.

0 commit comments

Comments
 (0)