125
125
126
126
abstract type ColoringAlgorithm end
127
127
128
+ """
129
+ fast_matrix_colors(A)
130
+
131
+ Query whether a matrix has a fast algorithm for getting the structural
132
+ colors of the matrix.
133
+ """
134
+ fast_matrix_colors (A) = false
135
+ fast_matrix_colors (A:: Union{Diagonal,Bidiagonal,Tridiagonal,SymTridiagonal} ) = true
136
+
128
137
"""
129
138
matrix_colors(A::Union{Array,UpperTriangular,LowerTriangular})
130
139
@@ -170,20 +179,22 @@ function __init__()
170
179
171
180
@require BandedMatrices= " aae01518-5342-5314-be14-df237901396f" begin
172
181
is_structured (:: BandedMatrices.BandedMatrix ) = true
173
-
174
- function matrix_colors (A:: BandedMatrix )
182
+ fast_matrix_colors ( :: BandedMatrices.BandedMatrix ) = true
183
+ function matrix_colors (A:: BandedMatrices. BandedMatrix )
175
184
u,l= bandwidths (A)
176
185
width= u+ l+ 1
177
186
_cycle (1 : width,size (A,2 ))
178
187
end
179
-
188
+
180
189
end
181
190
182
191
@require BlockBandedMatrices= " aae01518-5342-5314-be14-df237901396f" begin
183
192
is_structured (:: BandedMatrices.BlockBandedMatrix ) = true
184
193
is_structured (:: BandedMatrices.BandedBlockBandedMatrix ) = true
194
+ fast_matrix_colors (:: BlockBandedMatrices.BlockBandedMatrix ) = true
195
+ fast_matrix_colors (:: BlockBandedMatrices.BandedBlockBandedMatrix ) = true
185
196
186
- function matrix_colors (A:: BlockBandedMatrix )
197
+ function matrix_colors (A:: BlockBandedMatrices. BlockBandedMatrix )
187
198
l,u= blockbandwidths (A)
188
199
blockwidth= l+ u+ 1
189
200
nblock= nblocks (A,2 )
@@ -197,7 +208,7 @@ function __init__()
197
208
vcat (colors... )
198
209
end
199
210
200
- function matrix_colors (A:: BandedBlockBandedMatrix )
211
+ function matrix_colors (A:: BlockBandedMatrices. BandedBlockBandedMatrix )
201
212
l,u= blockbandwidths (A)
202
213
lambda,mu= subblockbandwidths (A)
203
214
blockwidth= l+ u+ 1
0 commit comments