We specialize matrix coloring and iterating in ArrayInterface.jl
for structured matrices including:
Diagonal
Bidiagonal
Tridiagonal
BandedMatrix
BlockBandedMatrix
BandedBlockBandedMatrix
The coloring function matrix_colors
for structured matrices are overloaded by analytical results assuming all of the valid entries in the structured matrices are non-zero. Therefore, it is several magnitude faster than the default coloring algorithm. It is recommended to use the overloaded matrix_colors
as long as the majority of the entries are filled by nonzero values. If not, you could further exploit the sparsity by convert the structured matrix into SparseCSC
matrix and apply default coloring algorithm to it.