@@ -18,19 +18,19 @@ optionally with a function of type `F` to instantiate non-stored elements.
18
18
struct SparseArrayDOK{T,N,F} <: AbstractSparseArray{T,N}
19
19
storage:: DOKStorage{T,N}
20
20
size:: NTuple{N,Int}
21
- getunstoredfun :: F
21
+ getunstored :: F
22
22
global @inline function _SparseArrayDOK (
23
- storage:: DOKStorage{T,N} , size:: Dims{N} , getunstoredfun :: F
23
+ storage:: DOKStorage{T,N} , size:: Dims{N} , getunstored :: F
24
24
) where {T,N,F}
25
- return new {T,N,F} (storage, size, getunstoredfun )
25
+ return new {T,N,F} (storage, size, getunstored )
26
26
end
27
27
end
28
28
29
29
# Constructors
30
30
# ------------
31
31
"""
32
- SparseArrayDOK{T}(undef, dims...[; getunstoredfun ])
33
- SparseArrayDOK{T,N}(undef, dims...[; getunstoredfun ])
32
+ SparseArrayDOK{T}(undef, dims...[; getunstored ])
33
+ SparseArrayDOK{T,N}(undef, dims...[; getunstored ])
34
34
35
35
Construct an uninitialized `N`-dimensional [`SparseArrayDOK`](@ref) containing
36
36
elements of type `T`. `N` can either be supplied explicitly, or be determined by
@@ -39,12 +39,12 @@ the length or number of `dims`.
39
39
SparseArrayDOK {T,N} (:: UndefInitializer , dims; kwargs... )
40
40
41
41
function SparseArrayDOK {T,N} (
42
- :: UndefInitializer , dims:: Dims ; getunstoredfun = getzero
42
+ :: UndefInitializer , dims:: Dims ; getunstored = getzero
43
43
) where {T,N}
44
44
(length (dims) == N && all (≥ (0 ), dims)) ||
45
45
throw (ArgumentError (" Invalid dimensions: $dims " ))
46
46
storage = DOKStorage {T,N} ()
47
- return _SparseArrayDOK (storage, dims, getunstoredfun )
47
+ return _SparseArrayDOK (storage, dims, getunstored )
48
48
end
49
49
function SparseArrayDOK {T,N} (:: UndefInitializer , dims:: Vararg{Int,N} ; kwargs... ) where {T,N}
50
50
return SparseArrayDOK {T,N} (undef, dims; kwargs... )
@@ -56,8 +56,8 @@ function SparseArrayDOK{T}(::UndefInitializer, dims::Vararg{Int,N}; kwargs...) w
56
56
return SparseArrayDOK {T,N} (undef, dims; kwargs... )
57
57
end
58
58
59
- function set_getunstoredfun (a:: SparseArrayDOK , f)
60
- @set a. getunstoredfun = f
59
+ function set_getunstored (a:: SparseArrayDOK , f)
60
+ @set a. getunstored = f
61
61
return a
62
62
end
63
63
@@ -83,7 +83,7 @@ function getstoredindex(a::SparseArrayDOK, I::Int...)
83
83
return storage (a)[CartesianIndex (I)]
84
84
end
85
85
function getunstoredindex (a:: SparseArrayDOK , I:: Int... )
86
- return a. getunstoredfun (a, I... )
86
+ return a. getunstored (a, I... )
87
87
end
88
88
function setstoredindex! (a:: SparseArrayDOK , value, I:: Int... )
89
89
# TODO : Have a way to disable this check, analogous to `checkbounds`,
0 commit comments