125125
126126abstract type ColoringAlgorithm end
127127
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+
128137"""
129138 matrix_colors(A::Union{Array,UpperTriangular,LowerTriangular})
130139
@@ -170,20 +179,22 @@ function __init__()
170179
171180 @require BandedMatrices= " aae01518-5342-5314-be14-df237901396f" begin
172181 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 )
175184 u,l= bandwidths (A)
176185 width= u+ l+ 1
177186 _cycle (1 : width,size (A,2 ))
178187 end
179-
188+
180189 end
181190
182191 @require BlockBandedMatrices= " aae01518-5342-5314-be14-df237901396f" begin
183192 is_structured (:: BandedMatrices.BlockBandedMatrix ) = true
184193 is_structured (:: BandedMatrices.BandedBlockBandedMatrix ) = true
194+ fast_matrix_colors (:: BlockBandedMatrices.BlockBandedMatrix ) = true
195+ fast_matrix_colors (:: BlockBandedMatrices.BandedBlockBandedMatrix ) = true
185196
186- function matrix_colors (A:: BlockBandedMatrix )
197+ function matrix_colors (A:: BlockBandedMatrices. BlockBandedMatrix )
187198 l,u= blockbandwidths (A)
188199 blockwidth= l+ u+ 1
189200 nblock= nblocks (A,2 )
@@ -197,7 +208,7 @@ function __init__()
197208 vcat (colors... )
198209 end
199210
200- function matrix_colors (A:: BandedBlockBandedMatrix )
211+ function matrix_colors (A:: BlockBandedMatrices. BandedBlockBandedMatrix )
201212 l,u= blockbandwidths (A)
202213 lambda,mu= subblockbandwidths (A)
203214 blockwidth= l+ u+ 1
0 commit comments