Skip to content

Commit 0c9f42d

Browse files
committed
Create nicer objects for diagview
1 parent dfa1c46 commit 0c9f42d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/factorizations/truncation.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
using MatrixAlgebraKit: TruncationStrategy, diagview, svd_trunc!
22

3+
function MatrixAlgebraKit.diagview(A::BlockSparseMatrix{T,Diagonal{T,Vector{T}}}) where {T}
4+
D = BlockSparseVector{T}(undef, axes(A, 1))
5+
for I in eachblockstoredindex(A)
6+
if ==(Int.(Tuple(I))...)
7+
D[Tuple(I)[1]] = diagview(A[I])
8+
end
9+
end
10+
return D
11+
end
12+
313
"""
414
BlockPermutedDiagonalTruncationStrategy(strategy::TruncationStrategy)
515

0 commit comments

Comments
 (0)