Skip to content

Commit da0f65a

Browse files
committed
Make code clearer
1 parent b55f2df commit da0f65a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/factorizations/svd.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,26 @@ function MatrixAlgebraKit.initialize_output(
4444

4545
brows = eachblockaxis(axes(A, 1))
4646
bcols = eachblockaxis(axes(A, 2))
47-
s_axeses = Vector{eltype(brows)}(undef, bmn)
47+
s_axes = Vector{eltype(brows)}(undef, bmn)
4848

4949
# fill in values for blocks that are present
5050
bIs = collect(eachblockstoredindex(A))
5151
browIs = Int.(first.(Tuple.(bIs)))
5252
bcolIs = Int.(last.(Tuple.(bIs)))
5353
for bI in eachblockstoredindex(A)
5454
row, col = Int.(Tuple(bI))
55-
nrows = brows[row]
56-
ncols = bcols[col]
57-
s_axeses[col] = min(nrows, ncols)
55+
s_axes[col] = argmin(length, (brows[row], bcols[col]))
5856
end
5957

6058
# fill in values for blocks that aren't present, pairing them in order of occurence
6159
# this is a convention, which at least gives the expected results for blockdiagonal
6260
emptyrows = setdiff(1:bm, browIs)
6361
emptycols = setdiff(1:bn, bcolIs)
6462
for (row, col) in zip(emptyrows, emptycols)
65-
s_axeses[col] = min(brows[row], bcols[col])
63+
s_axes[col] = argmin(length, (brows[row], bcols[col]))
6664
end
6765

68-
s_axis = mortar_axis(s_axeses)
66+
s_axis = mortar_axis(s_axes)
6967
U, S, Vt = similar_output(svd_compact!, A, s_axis, alg)
7068

7169
# allocate output

0 commit comments

Comments
 (0)