2525function similar_output (
2626 :: typeof (svd_compact!), A, S_axes, alg:: MatrixAlgebraKit.AbstractAlgorithm
2727)
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ᴴ
3233end
3334
3435function MatrixAlgebraKit. initialize_output (
@@ -48,19 +49,17 @@ function MatrixAlgebraKit.initialize_output(
4849 bcolIs = Int .(last .(Tuple .(bIs)))
4950 for bI in eachblockstoredindex (A)
5051 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])
5454 end
5555
5656 # fill in values for blocks that aren't present, pairing them in order of occurence
5757 # this is a convention, which at least gives the expected results for blockdiagonal
5858 emptyrows = setdiff (1 : bm, browIs)
5959 emptycols = setdiff (1 : bn, bcolIs)
6060 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])
6463 end
6564
6665 u_axis = mortar_axis (u_axes)
0 commit comments