Skip to content

Commit b4ee27d

Browse files
committed
Change kwarg name
1 parent 35439c5 commit b4ee27d

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/abstractsparsearray.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ end
3737
# ----------------------------
3838

3939
"""
40-
sparse(storage::Union{AbstractDict,AbstractDictionary}, dims...[; getunstoredfun])
40+
sparse(storage::Union{AbstractDict,AbstractDictionary}, dims...[; getunstored])
4141
4242
Construct an `N`-dimensional [`SparseArrayDOK`](@ref) containing elements of type `T`. Both
4343
`T` and `N` can either be supplied explicitly or be determined by the `storage` and the
@@ -64,7 +64,7 @@ end
6464
using Random: Random, AbstractRNG, default_rng
6565

6666
@doc """
67-
sparsezeros([T::Type], dims[; getunstoredfun]) -> A::SparseArrayDOK{T}
67+
sparsezeros([T::Type], dims[; getunstored]) -> A::SparseArrayDOK{T}
6868
6969
Create an empty size `dims` sparse array.
7070
The optional `T` argument specifies the element type, which defaults to `Float64`.

src/oneelementarray.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ struct OneElementArray{T,N,I,A,F} <: AbstractSparseArray{T,N}
88
value::T
99
index::I
1010
axes::A
11-
getunstoredfun::F
11+
getunstored::F
1212
global @inline function _OneElementArray(
13-
value::T, index::I, axes::A, getunstoredfun::F
13+
value::T, index::I, axes::A, getunstored::F
1414
) where {T,I,A,F}
1515
N = length(axes)
1616
@assert N == length(index)
17-
return new{T,N,I,A,F}(value, index, axes, getunstoredfun)
17+
return new{T,N,I,A,F}(value, index, axes, getunstored)
1818
end
1919
end
2020

@@ -23,9 +23,9 @@ using DerivableInterfaces: @array_aliases
2323
@array_aliases OneElementArray
2424

2525
function OneElementArray{T,N}(
26-
value, index::NTuple{N,Int}, axes::NTuple{N,AbstractUnitRange}; getunstoredfun=getzero
26+
value, index::NTuple{N,Int}, axes::NTuple{N,AbstractUnitRange}; getunstored=getzero
2727
) where {T,N}
28-
return _OneElementArray(convert(T, value), index, axes, getunstoredfun)
28+
return _OneElementArray(convert(T, value), index, axes, getunstored)
2929
end
3030

3131
function OneElementArray{<:Any,N}(
@@ -104,9 +104,9 @@ end
104104

105105
# Fix ambiguity errors.
106106
function OneElementArray{T,0}(
107-
value, index::Tuple{}, axes::Tuple{}; getunstoredfun=getzero
107+
value, index::Tuple{}, axes::Tuple{}; getunstored=getzero
108108
) where {T}
109-
return _OneElementArray(convert(T, value), index, axes, getunstoredfun)
109+
return _OneElementArray(convert(T, value), index, axes, getunstored)
110110
end
111111
function OneElementArray{<:Any,0}(
112112
value::T, index::Tuple{}, axes::Tuple{}; kwargs...
@@ -295,7 +295,7 @@ function getstoredindex(a::OneElementArray, I::Int...)
295295
return storedvalue(a)
296296
end
297297
function getunstoredindex(a::OneElementArray, I::Int...)
298-
return a.getunstoredfun(a, I...)
298+
return a.getunstored(a, I...)
299299
end
300300
function setstoredindex!(a::OneElementArray, value, I::Int...)
301301
return error("`OneElementArray` is immutable, you can't set elements.")

src/sparsearraydok.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ optionally with a function of type `F` to instantiate non-stored elements.
1818
struct SparseArrayDOK{T,N,F} <: AbstractSparseArray{T,N}
1919
storage::DOKStorage{T,N}
2020
size::NTuple{N,Int}
21-
getunstoredfun::F
21+
getunstored::F
2222
global @inline function _SparseArrayDOK(
23-
storage::DOKStorage{T,N}, size::Dims{N}, getunstoredfun::F
23+
storage::DOKStorage{T,N}, size::Dims{N}, getunstored::F
2424
) where {T,N,F}
25-
return new{T,N,F}(storage, size, getunstoredfun)
25+
return new{T,N,F}(storage, size, getunstored)
2626
end
2727
end
2828

2929
# Constructors
3030
# ------------
3131
"""
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])
3434
3535
Construct an uninitialized `N`-dimensional [`SparseArrayDOK`](@ref) containing
3636
elements of type `T`. `N` can either be supplied explicitly, or be determined by
@@ -39,12 +39,12 @@ the length or number of `dims`.
3939
SparseArrayDOK{T,N}(::UndefInitializer, dims; kwargs...)
4040

4141
function SparseArrayDOK{T,N}(
42-
::UndefInitializer, dims::Dims; getunstoredfun=getzero
42+
::UndefInitializer, dims::Dims; getunstored=getzero
4343
) where {T,N}
4444
(length(dims) == N && all((0), dims)) ||
4545
throw(ArgumentError("Invalid dimensions: $dims"))
4646
storage = DOKStorage{T,N}()
47-
return _SparseArrayDOK(storage, dims, getunstoredfun)
47+
return _SparseArrayDOK(storage, dims, getunstored)
4848
end
4949
function SparseArrayDOK{T,N}(::UndefInitializer, dims::Vararg{Int,N}; kwargs...) where {T,N}
5050
return SparseArrayDOK{T,N}(undef, dims; kwargs...)
@@ -56,8 +56,8 @@ function SparseArrayDOK{T}(::UndefInitializer, dims::Vararg{Int,N}; kwargs...) w
5656
return SparseArrayDOK{T,N}(undef, dims; kwargs...)
5757
end
5858

59-
function set_getunstoredfun(a::SparseArrayDOK, f)
60-
@set a.getunstoredfun = f
59+
function set_getunstored(a::SparseArrayDOK, f)
60+
@set a.getunstored = f
6161
return a
6262
end
6363

@@ -83,7 +83,7 @@ function getstoredindex(a::SparseArrayDOK, I::Int...)
8383
return storage(a)[CartesianIndex(I)]
8484
end
8585
function getunstoredindex(a::SparseArrayDOK, I::Int...)
86-
return a.getunstoredfun(a, I...)
86+
return a.getunstored(a, I...)
8787
end
8888
function setstoredindex!(a::SparseArrayDOK, value, I::Int...)
8989
# TODO: Have a way to disable this check, analogous to `checkbounds`,

0 commit comments

Comments
 (0)