@@ -53,22 +53,46 @@ function isblockdiagonal(A::AbstractBlockSparseMatrix)
5353 return true
5454end
5555
56+ """
57+ BlockDiagonalAlgorithm([f]) <: MatrixAlgebraKit.AbstractAlgorithm
58+
59+ Type for handling algorithms on a block-by-block basis, which is possible for
60+ block-diagonal input matrices.
61+ Additionally this algorithm may take a function that, given the individual blocks, returns
62+ the algorithm that will be used. This can be leveraged to allow for different algorithms for
63+ each block.
64+ """
65+ struct BlockDiagonalAlgorithm{F} <: MatrixAlgebraKit.AbstractAlgorithm
66+ falg:: F
67+ end
68+
69+ function block_algorithm (alg:: BlockDiagonalAlgorithm , a:: AbstractMatrix )
70+ return block_algorithm (alg, typeof (a))
71+ end
72+ function block_algorithm (alg:: BlockDiagonalAlgorithm , A:: Type{<:AbstractMatrix} )
73+ return alg. falg (A)
74+ end
75+
5676"""
5777 BlockPermutedDiagonalAlgorithm([f]) <: MatrixAlgebraKit.AbstractAlgorithm
5878
5979Type for handling algorithms on a block-by-block basis, which is possible for
60- block-diagonal or block-permuted-diagonal input matrices.
61- Additionally this wrapper may take a function that, given the input type of the blocks,
62- returns the actual algorithm that will be used. This can be leveraged to allow for different
63- algorithms for each block.
80+ block-diagonal or block-permuted-diagonal input matrices. The algorithms proceed by first
81+ permuting to a block-diagonal form, and then carrying out the algorithm.
82+ Additionally this algorithm may take a function that, given the individual blocks, returns
83+ the algorithm that will be used. This can be leveraged to allow for different algorithms for
84+ each block.
6485"""
6586struct BlockPermutedDiagonalAlgorithm{F} <: MatrixAlgebraKit.AbstractAlgorithm
6687 falg:: F
6788end
68-
6989function block_algorithm (alg:: BlockPermutedDiagonalAlgorithm , a:: AbstractMatrix )
7090 return block_algorithm (alg, typeof (a))
7191end
7292function block_algorithm (alg:: BlockPermutedDiagonalAlgorithm , A:: Type{<:AbstractMatrix} )
7393 return alg. falg (A)
7494end
95+
96+ function BlockDiagonalAlgorithm (alg:: BlockPermutedDiagonalAlgorithm )
97+ return BlockDiagonalAlgorithm (alg. falg)
98+ end
0 commit comments