Skip to content

Commit 7f40992

Browse files
committed
Merge branch 'factorizations' of https://github.com/lkdvos/BlockSparseArrays.jl into factorizations
2 parents 84fe2aa + f19cd8a commit 7f40992

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/abstractblocksparsearray/abstractblocksparsematrix.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ function _allocate_svd_output(A::AbstractBlockSparseMatrix, full::Bool, ::Algori
4949
slengths[col] = min(brows[row], bcols[col])
5050
end
5151

52-
U = similar(A, axes(A, 1), blockedrange(slengths))
53-
S = similar(A, real(eltype(A)), blockedrange(slengths))
54-
Vt = similar(A, blockedrange(slengths), axes(A, 2))
52+
s_axis = blockedrange(slengths)
53+
U = similar(A, axes(A, 1), s_axis)
54+
S = similar(A, real(eltype(A)), s_axis)
55+
Vt = similar(A, s_axis, axes(A, 2))
5556

5657
return U, S, Vt
5758
end
@@ -67,10 +68,10 @@ function svd!(
6768
U, S, Vt = _allocate_svd_output(A, full, alg)
6869
for bI in eachblockstoredindex(A)
6970
bUSV = svd!(A[bI]; full, alg)
70-
brow, bcol = Int.(Tuple(bI))
71-
U[Block(brow, bcol)] = bUSV.U
72-
S[Block(bcol)] = bUSV.S
73-
Vt[Block(bcol, bcol)] = bUSV.Vt
71+
brow, bcol = Tuple(bI)
72+
U[brow, bcol] = bUSV.U
73+
S[bcol] = bUSV.S
74+
Vt[bcol, bcol] = bUSV.Vt
7475
end
7576
return SVD(U, S, Vt)
7677
end

0 commit comments

Comments
 (0)