@@ -53,22 +53,46 @@ function isblockdiagonal(A::AbstractBlockSparseMatrix)
53
53
return true
54
54
end
55
55
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
+
56
76
"""
57
77
BlockPermutedDiagonalAlgorithm([f]) <: MatrixAlgebraKit.AbstractAlgorithm
58
78
59
79
Type 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.
64
85
"""
65
86
struct BlockPermutedDiagonalAlgorithm{F} <: MatrixAlgebraKit.AbstractAlgorithm
66
87
falg:: F
67
88
end
68
-
69
89
function block_algorithm (alg:: BlockPermutedDiagonalAlgorithm , a:: AbstractMatrix )
70
90
return block_algorithm (alg, typeof (a))
71
91
end
72
92
function block_algorithm (alg:: BlockPermutedDiagonalAlgorithm , A:: Type{<:AbstractMatrix} )
73
93
return alg. falg (A)
74
94
end
95
+
96
+ function BlockDiagonalAlgorithm (alg:: BlockPermutedDiagonalAlgorithm )
97
+ return BlockDiagonalAlgorithm (alg. falg)
98
+ end
0 commit comments