Reference

SparseArraysBase.SparseArrayDOKType
SparseArrayDOK{T,N,F} <: AbstractSparseArray{T,N}

N-dimensional sparse Dictionary-of-keys (DOK) array with elements of type T, optionally with a function of type F to instantiate non-stored elements.

source
SparseArraysBase.SparseArrayDOKMethod
SparseArrayDOK{T}(undef, dims...[; getunstored])
SparseArrayDOK{T,N}(undef, dims...[; getunstored])

Construct an uninitialized N-dimensional SparseArrayDOK containing elements of type T. N can either be supplied explicitly, or be determined by the length or number of dims.

source
SparseArraysBase.eachstoredindexFunction
eachstoredindex(A::AbstractArray...)
eachstoredindex(style::IndexStyle, A::AbstractArray...)

An iterable over all indices of the stored values. For multiple arrays, the iterable contains all indices where at least one input has a stored value. The type of indices can be controlled through style, which will default to a compatible style for all inputs.

The order of the iterable is not guaranteed to be fixed or sorted, and should not be assumed to be the same as storedvalues.

See also storedvalues, storedpairs and storedlength.

source
SparseArraysBase.getstoredindexMethod
getstoredindex(A::AbstractArray, I...) -> eltype(A)

Obtain getindex(A, I...) with the guarantee that there is a stored entry at that location.

Similar to Base.getindex, new definitions should be in line with IndexStyle(A).

source
SparseArraysBase.getunstoredindexMethod
getunstoredindex(A::AbstractArray, I...) -> eltype(A)

Obtain the value that would be returned by getindex(A, I...) when there is no stored entry at that location. By default, this takes an explicit copy of the getindex implementation to mimick a newly instantiated object.

Similar to Base.getindex, new definitions should be in line with IndexStyle(A).

source
SparseArraysBase.isstoredMethod
isstored(A::AbstractArray, I...) -> Bool

Check if the array A has a stored entry at the location specified by indices I.... For generic array types this defaults to true whenever the indices are inbounds, but sparse array types might overload this function when appropriate.

Similar to Base.getindex, new definitions should be in line with IndexStyle(A).

source
SparseArraysBase.setstoredindex!Method
setstoredindex!(A::AbstractArray, v, I...) -> A

setindex!(A, v, I...) with the guarantee that there is a stored entry at the given location.

Similar to Base.setindex!, new definitions should be in line with IndexStyle(A).

source
SparseArraysBase.setunstoredindex!Method
setunstoredindex!(A::AbstractArray, v, I...) -> A

setindex!(A, v, I...) with the guarantee that there is no stored entry at the given location.

Similar to Base.setindex!, new definitions should be in line with IndexStyle(A).

source
SparseArraysBase.sparseMethod
sparse(storage::Union{AbstractDict,AbstractDictionary}, dims...[; getunstored])

Construct an N-dimensional SparseArrayDOK containing elements of type T. Both T and N can either be supplied explicitly or be determined by the storage and the length or number of dims. If dims aren't specified, the size will be determined automatically from the input indices.

This constructor does not take ownership of the supplied storage, and will result in an independent container.

source
SparseArraysBase.sparserandFunction
sparserand([rng], [T::Type], dims; density::Real=0.5, randfun::Function=rand) -> A::SparseArrayDOK{T}

Create a random size dims sparse array in which the probability of any element being stored is independently given by density. The optional rng argument specifies a random number generator, see also Random. The optional T argument specifies the element type, which defaults to Float64. The optional randfun argument can be used to control the type of random elements, and should support the signature randfun(rng, T, N) to generate N entries of type T.

See also sparserand!.

source
SparseArraysBase.sparserand!Function
sparserand!([rng], A::AbstractArray; density::Real=0.5, randfun::Function=rand) -> A

Overwrite part of an array with random entries, where the probability of overwriting is independently given by density. The optional rng argument specifies a random number generator, see also Random. The optional randfun argument can be used to control the type of random elements, and should support the signature randfun(rng, T, N) to generate N entries of type T.

See also sparserand.

source
SparseArraysBase.sparsezerosFunction
sparsezeros([T::Type], dims[; getunstored]) -> A::SparseArrayDOK{T}

Create an empty size dims sparse array. The optional T argument specifies the element type, which defaults to Float64.

source
SparseArraysBase.storedpairsFunction
storedpairs(A::AbstractArray) -> (k, v)...

An iterable over all stored indices and their corresponding stored values. The indices are compatible with IndexStyle(A).

The order of the iterable is not guaranteed to be fixed or sorted. See also eachstoredindex and storedvalues.

source