@@ -4,9 +4,9 @@ using LinearAlgebra, SparseArrays
4
4
import Base: size, getindex, setindex!, IndexStyle, checkbounds, convert,
5
5
+ , - , * , / , \ , diff, sum, cumsum, maximum, minimum, sort, sort!,
6
6
any, all, axes, isone, iterate, unique, allunique, permutedims, inv,
7
- copy, vec
7
+ copy, vec, setindex!
8
8
9
- import LinearAlgebra: rank, svdvals!, tril, triu, tril!, triu!, diag, transpose, adjoint
9
+ import LinearAlgebra: rank, svdvals!, tril, triu, tril!, triu!, diag, transpose, adjoint, fill!
10
10
11
11
import Base. Broadcast: broadcasted, DefaultArrayStyle, broadcast_shape
12
12
27
27
getindex_value (F)
28
28
end
29
29
30
+ @inline function setindex! (F:: AbstractFill , v, k:: Integer )
31
+ @boundscheck checkbounds (F, k)
32
+ v == getindex_value (F) || throw (ArgumentError (" Cannot setindex! to $v for an AbstractFill with value $(getindex_value (F)) ." ))
33
+ F
34
+ end
35
+
36
+ @inline function setindex! (F:: AbstractFill{T, N} , v, kj:: Vararg{<:Integer, N} ) where {T, N}
37
+ @boundscheck checkbounds (F, kj... )
38
+ v == getindex_value (F) || throw (ArgumentError (" Cannot setindex! to $v for an AbstractFill with value $(getindex_value (F)) ." ))
39
+ F
40
+ end
41
+
42
+ @inline function fill! (F:: AbstractFill , v)
43
+ v == getindex_value (F) || throw (ArgumentError (" Cannot fill! with $v an AbstractFill with value $(getindex_value (F)) ." ))
44
+ F
45
+ end
46
+
30
47
rank (F:: AbstractFill ) = iszero (getindex_value (F)) ? 0 : 1
31
48
IndexStyle (:: Type {<: AbstractFill{<:Any,N,<:NTuple{N,Base.OneTo{Int}}} }) where N = IndexLinear ()
32
49
0 commit comments