@@ -25,30 +25,30 @@ function MatrixAlgebraKit.initialize_output(
25
25
bm, bn = blocksize (A)
26
26
bmn = min (bm, bn)
27
27
28
- brows = blocklengths (axes (A, 1 ))
29
- bcols = blocklengths (axes (A, 2 ))
30
- rlengths = Vector {Int} (undef , bmn)
28
+ brows = eachblockaxis (axes (A, 1 ))
29
+ bcols = eachblockaxis (axes (A, 2 ))
30
+ r_axes = similar (brows , bmn)
31
31
32
32
# fill in values for blocks that are present
33
33
bIs = collect (eachblockstoredindex (A))
34
34
browIs = Int .(first .(Tuple .(bIs)))
35
35
bcolIs = Int .(last .(Tuple .(bIs)))
36
36
for bI in eachblockstoredindex (A)
37
37
row, col = Int .(Tuple (bI))
38
- nrows = brows[row]
39
- ncols = bcols[col]
40
- rlengths[col] = min (nrows, ncols)
38
+ len = minimum (length, (brows[row], bcols[col]))
39
+ r_axes[col] = bcols[col][Base. OneTo (len)]
41
40
end
42
41
43
42
# fill in values for blocks that aren't present, pairing them in order of occurence
44
43
# this is a convention, which at least gives the expected results for blockdiagonal
45
44
emptyrows = setdiff (1 : bm, browIs)
46
45
emptycols = setdiff (1 : bn, bcolIs)
47
46
for (row, col) in zip (emptyrows, emptycols)
48
- rlengths[col] = min (brows[row], bcols[col])
47
+ len = minimum (length, (brows[row], bcols[col]))
48
+ r_axes[col] = bcols[col][Base. OneTo (len)]
49
49
end
50
50
51
- r_axis = blockedrange (rlengths )
51
+ r_axis = mortar_axis (r_axes )
52
52
Q = similar (A, axes (A, 1 ), r_axis)
53
53
R = similar (A, r_axis, axes (A, 2 ))
54
54
@@ -73,31 +73,30 @@ function MatrixAlgebraKit.initialize_output(
73
73
)
74
74
bm, bn = blocksize (A)
75
75
76
- brows = blocklengths (axes (A, 1 ))
77
- rlengths = copy (brows)
76
+ brows = eachblockaxis (axes (A, 1 ))
77
+ r_axes = copy (brows)
78
78
79
79
# fill in values for blocks that are present
80
80
bIs = collect (eachblockstoredindex (A))
81
81
browIs = Int .(first .(Tuple .(bIs)))
82
82
bcolIs = Int .(last .(Tuple .(bIs)))
83
83
for bI in eachblockstoredindex (A)
84
84
row, col = Int .(Tuple (bI))
85
- nrows = brows[row]
86
- rlengths[col] = nrows
85
+ r_axes[col] = brows[row]
87
86
end
88
87
89
88
# fill in values for blocks that aren't present, pairing them in order of occurence
90
89
# this is a convention, which at least gives the expected results for blockdiagonal
91
90
emptyrows = setdiff (1 : bm, browIs)
92
91
emptycols = setdiff (1 : bn, bcolIs)
93
92
for (row, col) in zip (emptyrows, emptycols)
94
- rlengths [col] = brows[row]
93
+ r_axes [col] = brows[row]
95
94
end
96
95
for (i, k) in enumerate ((length (emptycols) + 1 ): length (emptyrows))
97
- rlengths [bn + i] = brows[emptyrows[k]]
96
+ r_axes [bn + i] = brows[emptyrows[k]]
98
97
end
99
98
100
- r_axis = blockedrange (rlengths )
99
+ r_axis = mortar_axis (r_axes )
101
100
Q = similar (A, axes (A, 1 ), r_axis)
102
101
R = similar (A, r_axis, axes (A, 2 ))
103
102
0 commit comments