@@ -119,15 +119,15 @@ end
119
119
120
120
function test_svd (a, (U, S, Vᴴ); full= false )
121
121
# Check that the SVD is correct
122
- (U * S * Vᴴ ≈ a) || return false
123
- (U' * U ≈ LinearAlgebra. I) || return false
124
- (Vᴴ * Vᴴ' ≈ LinearAlgebra. I) || return false
125
- full || return true
122
+ @test (U * S * Vᴴ ≈ a)
123
+ @test (U' * U ≈ LinearAlgebra. I)
124
+ @test (Vᴴ * Vᴴ' ≈ LinearAlgebra. I)
125
+ full || return nothing
126
126
127
127
# Check factors are unitary
128
- (U * U' ≈ LinearAlgebra. I) || return false
129
- (Vᴴ' * Vᴴ ≈ LinearAlgebra. I) || return false
130
- return true
128
+ @test (U * U' ≈ LinearAlgebra. I)
129
+ @test (Vᴴ' * Vᴴ ≈ LinearAlgebra. I)
130
+ return nothing
131
131
end
132
132
133
133
blockszs = (
@@ -143,7 +143,7 @@ test_params = Iterators.product(blockszs, eltypes)
143
143
144
144
# test empty matrix
145
145
usv_empty = svd_compact (a)
146
- @test test_svd (a, usv_empty)
146
+ test_svd (a, usv_empty)
147
147
148
148
# test blockdiagonal
149
149
rng = StableRNG (123 )
@@ -152,21 +152,21 @@ test_params = Iterators.product(blockszs, eltypes)
152
152
a[Block (I. I... )] = rand (rng, T, size (blocks (a)[i]))
153
153
end
154
154
usv = svd_compact (a)
155
- @test test_svd (a, usv)
155
+ test_svd (a, usv)
156
156
157
157
rng = StableRNG (123 )
158
158
perm = Random. randperm (rng, length (m))
159
159
b = a[Block .(perm), Block .(1 : length (n))]
160
160
usv = svd_compact (b)
161
- @test test_svd (b, usv)
161
+ test_svd (b, usv)
162
162
163
163
# test permuted blockdiagonal with missing row/col
164
164
rng = StableRNG (123 )
165
165
I_removed = rand (rng, eachblockstoredindex (b))
166
166
c = copy (b)
167
167
delete! (blocks (c). storage, CartesianIndex (Int .(Tuple (I_removed))))
168
168
usv = svd_compact (c)
169
- @test test_svd (c, usv)
169
+ test_svd (c, usv)
170
170
end
171
171
172
172
# svd_full!
176
176
177
177
# test empty matrix
178
178
usv_empty = svd_full (a)
179
- @test test_svd (a, usv_empty; full= true )
179
+ test_svd (a, usv_empty; full= true )
180
180
181
181
# test blockdiagonal
182
182
rng = StableRNG (123 )
@@ -185,21 +185,21 @@ end
185
185
a[Block (I. I... )] = rand (rng, T, size (blocks (a)[i]))
186
186
end
187
187
usv = svd_full (a)
188
- @test test_svd (a, usv; full= true )
188
+ test_svd (a, usv; full= true )
189
189
190
190
rng = StableRNG (123 )
191
191
perm = Random. randperm (rng, length (m))
192
192
b = a[Block .(perm), Block .(1 : length (n))]
193
193
usv = svd_full (b)
194
- @test test_svd (b, usv; full= true )
194
+ test_svd (b, usv; full= true )
195
195
196
196
# test permuted blockdiagonal with missing row/col
197
197
rng = StableRNG (123 )
198
198
I_removed = rand (rng, eachblockstoredindex (b))
199
199
c = copy (b)
200
200
delete! (blocks (c). storage, CartesianIndex (Int .(Tuple (I_removed))))
201
201
usv = svd_full (c)
202
- @test test_svd (c, usv; full= true )
202
+ test_svd (c, usv; full= true )
203
203
end
204
204
205
205
# svd_trunc!
0 commit comments