@@ -8,7 +8,7 @@ using MatrixAlgebraKit: default_eigh_algorithm, eigh_full!, eigh_vals!
88for f in [:default_eig_algorithm , :default_eigh_algorithm ]
99 @eval begin
1010 function MatrixAlgebraKit. $f (:: Type{<:AbstractBlockSparseMatrix} ; kwargs... )
11- return BlockPermutedDiagonalAlgorithm () do block
11+ return BlockDiagonalAlgorithm () do block
1212 return $ f (block; kwargs... )
1313 end
1414 end
@@ -28,23 +28,6 @@ function output_type(::typeof(eigh_full!), A::Type{<:AbstractMatrix{T}}) where {
2828 return isconcretetype (DV) ? DV : Tuple{AbstractMatrix{real (T)},AbstractMatrix{T}}
2929end
3030
31- function MatrixAlgebraKit. initialize_output (
32- :: Union{typeof(eig_full!),typeof(eigh_full!)} ,
33- :: AbstractBlockSparseMatrix ,
34- :: BlockPermutedDiagonalAlgorithm ,
35- )
36- return nothing
37- end
38-
39- function MatrixAlgebraKit. check_input (
40- :: Union{typeof(eig_full!),typeof(eigh_full!)} ,
41- A:: AbstractBlockSparseMatrix ,
42- DV,
43- :: BlockPermutedDiagonalAlgorithm ,
44- )
45- @assert isblockpermuteddiagonal (A)
46- return nothing
47- end
4831function MatrixAlgebraKit. check_input (
4932 :: typeof (eig_full!), A:: AbstractBlockSparseMatrix , (D, V), :: BlockDiagonalAlgorithm
5033)
6952
7053for f in [:eig_full! , :eigh_full! ]
7154 @eval begin
72- function MatrixAlgebraKit. initialize_output (
73- :: typeof ($ f), A:: AbstractBlockSparseMatrix , alg:: BlockPermutedDiagonalAlgorithm
74- )
75- return nothing
76- end
7755 function MatrixAlgebraKit. initialize_output (
7856 :: typeof ($ f), A:: AbstractBlockSparseMatrix , alg:: BlockDiagonalAlgorithm
7957 )
@@ -82,16 +60,6 @@ for f in [:eig_full!, :eigh_full!]
8260 V = similar (A, BlockType (Tv))
8361 return (D, V)
8462 end
85- function MatrixAlgebraKit. $f (
86- A:: AbstractBlockSparseMatrix , DV, alg:: BlockPermutedDiagonalAlgorithm
87- )
88- MatrixAlgebraKit. check_input ($ f, A, DV, alg)
89- Ad, (invrowperm, invcolperm) = blockdiagonalize (A)
90- Dd, Vd = $ f (Ad, BlockDiagonalAlgorithm (alg))
91- D = transform_rows (Dd, invrowperm)
92- V = transform_cols (Vd, invcolperm)
93- return D, V
94- end
9563 function MatrixAlgebraKit. $f (
9664 A:: AbstractBlockSparseMatrix , (D, V), alg:: BlockDiagonalAlgorithm
9765 )
12896
12997for f in [:eig_vals! , :eigh_vals! ]
13098 @eval begin
131- function MatrixAlgebraKit. initialize_output (
132- :: typeof ($ f), A:: AbstractBlockSparseMatrix , alg:: BlockPermutedDiagonalAlgorithm
133- )
134- return nothing
135- end
13699 function MatrixAlgebraKit. initialize_output (
137100 :: typeof ($ f), A:: AbstractBlockSparseMatrix , alg:: BlockDiagonalAlgorithm
138101 )
139102 T = output_type ($ f, blocktype (A))
140103 return similar (A, BlockType (T), axes (A, 1 ))
141104 end
142- function MatrixAlgebraKit. check_input (
143- :: typeof ($ f), A:: AbstractBlockSparseMatrix , D, :: BlockPermutedDiagonalAlgorithm
144- )
145- @assert isblockpermuteddiagonal (A)
146- return nothing
147- end
148105 function MatrixAlgebraKit. check_input (
149106 :: typeof ($ f), A:: AbstractBlockSparseMatrix , D, :: BlockDiagonalAlgorithm
150107 )
@@ -156,14 +113,6 @@ for f in [:eig_vals!, :eigh_vals!]
156113 return nothing
157114 end
158115
159- function MatrixAlgebraKit. $f (
160- A:: AbstractBlockSparseMatrix , D, alg:: BlockPermutedDiagonalAlgorithm
161- )
162- MatrixAlgebraKit. check_input ($ f, A, D, alg)
163- Ad, (invrowperm, _) = blockdiagonalize (A)
164- Dd = $ f (Ad, BlockDiagonalAlgorithm (alg))
165- return transform_rows (Dd, invrowperm)
166- end
167116 function MatrixAlgebraKit. $f (
168117 A:: AbstractBlockSparseMatrix , D, alg:: BlockDiagonalAlgorithm
169118 )
0 commit comments