1
1
using MatrixAlgebraKit
2
2
3
3
"""
4
- BlockDiagonalAlgorithm (A::MatrixAlgebraKit.AbstractAlgorithm)
4
+ BlockPermutedDiagonalAlgorithm (A::MatrixAlgebraKit.AbstractAlgorithm)
5
5
6
6
A wrapper for `MatrixAlgebraKit.AbstractAlgorithm` that implements the wrapped algorithm on
7
7
a block-by-block basis, which is possible if the input matrix is a block-diagonal matrix.
8
8
"""
9
- struct BlockDiagonalAlgorithm {A<: MatrixAlgebraKit.AbstractAlgorithm } < :
9
+ struct BlockPermutedDiagonalAlgorithm {A<: MatrixAlgebraKit.AbstractAlgorithm } < :
10
10
MatrixAlgebraKit. AbstractAlgorithm
11
11
alg:: A
12
12
end
@@ -15,7 +15,7 @@ function MatrixAlgebraKit.default_svd_algorithm(A::AbstractBlockSparseMatrix; kw
15
15
@assert blocktype (A) <: StridedMatrix{<:LinearAlgebra.BLAS.BlasFloat} " unsupported type:
16
16
$(blocktype (A)) "
17
17
alg = MatrixAlgebraKit. LAPACK_DivideAndConquer (; kwargs... )
18
- return BlockDiagonalAlgorithm (alg)
18
+ return BlockPermutedDiagonalAlgorithm (alg)
19
19
end
20
20
21
21
#=
@@ -29,7 +29,9 @@ We should probably discuss which way to go.
29
29
=#
30
30
31
31
function MatrixAlgebraKit. initialize_output (
32
- :: typeof (svd_compact!), A:: AbstractBlockSparseMatrix , alg:: BlockDiagonalAlgorithm
32
+ :: typeof (svd_compact!),
33
+ A:: AbstractBlockSparseMatrix ,
34
+ alg:: BlockPermutedDiagonalAlgorithm ,
33
35
)
34
36
bm, bn = blocksize (A)
35
37
bmn = min (bm, bn)
@@ -81,7 +83,9 @@ function MatrixAlgebraKit.initialize_output(
81
83
end
82
84
83
85
function MatrixAlgebraKit. initialize_output (
84
- :: typeof (svd_full!), A:: AbstractBlockSparseMatrix , alg:: BlockDiagonalAlgorithm
86
+ :: typeof (svd_full!),
87
+ A:: AbstractBlockSparseMatrix ,
88
+ alg:: BlockPermutedDiagonalAlgorithm ,
85
89
)
86
90
bm, bn = blocksize (A)
87
91
@@ -174,7 +178,9 @@ function MatrixAlgebraKit.check_input(
174
178
end
175
179
176
180
function MatrixAlgebraKit. svd_compact! (
177
- A:: AbstractBlockSparseMatrix , USVᴴ, alg:: BlockDiagonalAlgorithm
181
+ A:: AbstractBlockSparseMatrix ,
182
+ USVᴴ,
183
+ alg:: BlockPermutedDiagonalAlgorithm ,
178
184
)
179
185
MatrixAlgebraKit. check_input (svd_compact!, A, USVᴴ)
180
186
U, S, Vt = USVᴴ
@@ -202,7 +208,9 @@ function MatrixAlgebraKit.svd_compact!(
202
208
end
203
209
204
210
function MatrixAlgebraKit. svd_full! (
205
- A:: AbstractBlockSparseMatrix , USVᴴ, alg:: BlockDiagonalAlgorithm
211
+ A:: AbstractBlockSparseMatrix ,
212
+ USVᴴ,
213
+ alg:: BlockPermutedDiagonalAlgorithm ,
206
214
)
207
215
MatrixAlgebraKit. check_input (svd_full!, A, USVᴴ)
208
216
U, S, Vt = USVᴴ
0 commit comments