Reference
SparseArraysBase.SparseArrayDOK — TypeSparseArrayDOK{T,N,F} <: AbstractSparseArray{T,N}N-dimensional sparse dictionary-of-keys (DOK) array with elements of type T, with a specified background of unstored values unstored of the size of the array.
SparseArraysBase.SparseArrayDOK — MethodSparseArrayDOK{T}(undef, dims...)
SparseArrayDOK{T,N}(undef, dims...)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.
SparseArraysBase.ZeroPreserving — Typeabstract type ZeroPreserving <: Function endHoly Trait to indicate how a function interacts with abstract zero values:
StrongPreserving: output is guaranteed to be zero if any input is.WeakPreserving: output is guaranteed to be zero if all inputs are.NonPreserving: no guarantees on output.
To attempt to automatically determine this, either ZeroPreserving(f, A::AbstractArray...) or ZeroPreserving(f, T::Type...) can be used/overloaded.
SparseArraysBase.eachstoredindex — Functioneachstoredindex(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.
SparseArraysBase.getstoredindex — Methodgetstoredindex(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).
SparseArraysBase.getunstoredindex — Methodgetunstoredindex(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).
SparseArraysBase.isstored — Methodisstored(A::AbstractArray, I...) -> BoolCheck 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).
SparseArraysBase.setstoredindex! — Methodsetstoredindex!(A::AbstractArray, v, I...) -> Asetindex!(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).
SparseArraysBase.setunstoredindex! — Methodsetunstoredindex!(A::AbstractArray, v, I...) -> Asetindex!(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).
SparseArraysBase.sparse — Methodsparse(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.
SparseArraysBase.sparserand — Functionsparserand([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!.
SparseArraysBase.sparserand! — Functionsparserand!([rng], A::AbstractArray; density::Real=0.5, randfun::Function=rand) -> AOverwrite 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.
SparseArraysBase.sparsezeros — Functionsparsezeros([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.
SparseArraysBase.storedlength — Functionstoredlength(A::AbstractArray) -> IntThe number of values that are currently being stored.
SparseArraysBase.storedpairs — Functionstoredpairs(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.
SparseArraysBase.storedvalues — Functionstoredvalues(A::AbstractArray) -> v...An iterable over all stored values.
The order of the iterable is not guaranteed to be fixed or sorted, and should not be assumed to be the same as eachstoredindex.