25
25
function similar_output (
26
26
:: typeof (svd_compact!), A, S_axes, alg:: MatrixAlgebraKit.AbstractAlgorithm
27
27
)
28
- U = similar (A, axes (A, 1 ), S_axes[1 ])
29
- S = similar (A, BlockType (diagonaltype (realtype (blocktype (A)))), S_axes)
30
- Vt = similar (A, S_axes[2 ], axes (A, 2 ))
31
- return U, S, Vt
28
+ BU, BS, BVᴴ = fieldtypes (Base. promote_op (svd_compact!, blocktype (A), typeof (alg. alg)))
29
+ U = similar (A, BlockType (BU), (axes (A, 1 ), S_axes[1 ]))
30
+ S = similar (A, BlockType (BS), S_axes)
31
+ Vᴴ = similar (A, BlockType (BVᴴ), (S_axes[2 ], axes (A, 2 )))
32
+ return U, S, Vᴴ
32
33
end
33
34
34
35
function MatrixAlgebraKit. initialize_output (
@@ -48,19 +49,17 @@ function MatrixAlgebraKit.initialize_output(
48
49
bcolIs = Int .(last .(Tuple .(bIs)))
49
50
for bI in eachblockstoredindex (A)
50
51
row, col = Int .(Tuple (bI))
51
- len = minimum (length, (brows[row], bcols[col]))
52
- u_axes[col] = brows[row][Base. OneTo (len)]
53
- v_axes[col] = bcols[col][Base. OneTo (len)]
52
+ u_axes[col] = infimum (brows[row], bcols[col])
53
+ v_axes[col] = infimum (bcols[col], brows[row])
54
54
end
55
55
56
56
# fill in values for blocks that aren't present, pairing them in order of occurence
57
57
# this is a convention, which at least gives the expected results for blockdiagonal
58
58
emptyrows = setdiff (1 : bm, browIs)
59
59
emptycols = setdiff (1 : bn, bcolIs)
60
60
for (row, col) in zip (emptyrows, emptycols)
61
- len = minimum (length, (brows[row], bcols[col]))
62
- u_axes[col] = brows[row][Base. OneTo (len)]
63
- v_axes[col] = bcols[col][Base. OneTo (len)]
61
+ u_axes[col] = infimum (brows[row], bcols[col])
62
+ v_axes[col] = infimum (bcols[col], brows[row])
64
63
end
65
64
66
65
u_axis = mortar_axis (u_axes)
0 commit comments