@@ -24,13 +24,23 @@ ismutable(::Type{<:Number}) = false
24
24
Query whether a type can use `setindex!`
25
25
"""
26
26
can_setindex (x) = true
27
+ can_setindex (x:: AbstractArray ) = can_setindex (typeof (x))
28
+
29
+ """
30
+ fast_scalar_indexing(x)
31
+
32
+ Query whether an array type has fast scalar indexing
33
+ """
34
+ fast_scalar_indexing (x) = true
35
+ fast_scalar_indexing (x:: AbstractArray ) = fast_scalar_indexing (typeof (x))
27
36
28
37
"""
29
38
isstructured(x::DataType)
30
39
31
40
Query whether a type is a representation of a structured matrix
32
41
"""
33
42
isstructured (x) = false
43
+ isstructured (x:: AbstractArray ) = isstructured (typeof (x))
34
44
isstructured (:: Symmetric ) = true
35
45
isstructured (:: Hermitian ) = true
36
46
isstructured (:: UpperTriangular ) = true
@@ -45,13 +55,14 @@ isstructured(::Diagonal) = true
45
55
46
56
determine whether `findstructralnz` accepts the parameter `x`
47
57
"""
48
- has_sparsestruct (x)= false
49
- has_sparsestruct (x:: AbstractArray )= false
50
- has_sparsestruct (x:: SparseMatrixCSC )= true
51
- has_sparsestruct (x:: Diagonal )= true
52
- has_sparsestruct (x:: Bidiagonal )= true
53
- has_sparsestruct (x:: Tridiagonal )= true
54
- has_sparsestruct (x:: SymTridiagonal )= true
58
+ has_sparsestruct (x) = false
59
+ has_sparsestruct (x:: AbstractArray ) = has_sparsestruct (typeof (x))
60
+ has_sparsestruct (x:: Type{<:AbstractArray} ) = false
61
+ has_sparsestruct (x:: Type{<:SparseMatrixCSC} ) = true
62
+ has_sparsestruct (x:: Type{<:Diagonal} ) = true
63
+ has_sparsestruct (x:: Type{<:Bidiagonal} ) = true
64
+ has_sparsestruct (x:: Type{<:Tridiagonal} ) = true
65
+ has_sparsestruct (x:: Type{<:SymTridiagonal} ) = true
55
66
56
67
"""
57
68
findstructralnz(x::AbstractArray)
@@ -132,7 +143,8 @@ abstract type ColoringAlgorithm end
132
143
colors of the matrix.
133
144
"""
134
145
fast_matrix_colors (A) = false
135
- fast_matrix_colors (A:: Union{Diagonal,Bidiagonal,Tridiagonal,SymTridiagonal} ) = true
146
+ fast_matrix_colors (A:: AbstractArray ) = fast_matrix_colors (typeof (A))
147
+ fast_matrix_colors (A:: Type{<:Union{Diagonal,Bidiagonal,Tridiagonal,SymTridiagonal}} ) = true
136
148
137
149
"""
138
150
matrix_colors(A::Union{Array,UpperTriangular,LowerTriangular})
@@ -170,16 +182,23 @@ function __init__()
170
182
171
183
@require LabelledArrays= " 2ee39098-c373-598a-b85f-a56591580800" begin
172
184
ismutable (:: Type{<:LabelledArrays.LArray{T,N,Syms}} ) where {T,N,Syms} = ismutable (T)
185
+ can_setindex (:: Type{<:LabelledArrays.SLArray} ) = false
186
+ end
187
+
188
+ @require Tracker= " 9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" begin
189
+ ismutable (:: Type{<:Tracker.TrackedArray} ) = false
190
+ can_setindex (:: Type{<:Tracker.TrackedArray} ) = false
191
+ fast_scalar_indexing (:: Type{<:Tracker.TrackedArray} ) = false
173
192
end
174
193
175
- @require Flux= " 587475ba-b771-5e3f-ad9e-33799f191a9c" begin
176
- ismutable (:: Type{<:Flux.Tracker.TrackedArray} ) = false
177
- can_setindex (:: Type{<:Flux.Tracker.TrackedArray} ) = false
194
+ @require CuArrays= " 3a865a2d-5b23-5a0f-bc46-62713ec82fae" begin
195
+ fast_scalar_indexing (:: Type{<:CuArrays.CuArray} ) = false
178
196
end
179
197
180
198
@require BandedMatrices= " aae01518-5342-5314-be14-df237901396f" begin
181
- is_structured (:: BandedMatrices.BandedMatrix ) = true
182
- fast_matrix_colors (:: BandedMatrices.BandedMatrix ) = true
199
+ is_structured (:: Type{<:BandedMatrices.BandedMatrix} ) = true
200
+ fast_matrix_colors (:: Type{<:BandedMatrices.BandedMatrix} ) = true
201
+
183
202
function matrix_colors (A:: BandedMatrices.BandedMatrix )
184
203
u,l= bandwidths (A)
185
204
width= u+ l+ 1
@@ -189,10 +208,10 @@ function __init__()
189
208
end
190
209
191
210
@require BlockBandedMatrices= " aae01518-5342-5314-be14-df237901396f" begin
192
- is_structured (:: BandedMatrices.BlockBandedMatrix ) = true
193
- is_structured (:: BandedMatrices.BandedBlockBandedMatrix ) = true
194
- fast_matrix_colors (:: BlockBandedMatrices.BlockBandedMatrix ) = true
195
- fast_matrix_colors (:: BlockBandedMatrices.BandedBlockBandedMatrix ) = true
211
+ is_structured (:: Type{<: BandedMatrices.BlockBandedMatrix} ) = true
212
+ is_structured (:: Type{<: BandedMatrices.BandedBlockBandedMatrix} ) = true
213
+ fast_matrix_colors (:: Type{<: BlockBandedMatrices.BlockBandedMatrix} ) = true
214
+ fast_matrix_colors (:: Type{<: BlockBandedMatrices.BandedBlockBandedMatrix} ) = true
196
215
197
216
function matrix_colors (A:: BlockBandedMatrices.BlockBandedMatrix )
198
217
l,u= blockbandwidths (A)
0 commit comments