@@ -35,7 +35,7 @@ Class {
3535 ' actualV' ,
3636 ' actualS'
3737 ],
38- #category : ' Math-Tests-Matrix'
38+ #category : # ' Math-Tests-Matrix'
3939}
4040
4141{ #category : #' as yet unclassified' }
@@ -192,10 +192,8 @@ PMSingularValueDecompositionTest >> testIsOrthonormalU [
192192 " Verifying that matrix U is orthonormal. That is, all columns of U are unit vectors and orthogonal to each other."
193193
194194 | u m identity |
195-
196- u := matrix decompose leftSingularForm.
195+ u := matrix decomposeSV leftSingularForm.
197196 m := u numberOfRows.
198-
199197 identity := PMSymmetricMatrix identity: m.
200198 self assert: u transpose * u closeTo: identity
201199]
@@ -205,10 +203,8 @@ PMSingularValueDecompositionTest >> testIsOrthonormalV [
205203 " Verifying that matrix U is orthonormal. That is, all columns of U are unit vectors and orthogonal to each other."
206204
207205 | v n identity |
208-
209- v := matrix decompose rightSingularForm.
206+ v := matrix decomposeSV rightSingularForm.
210207 n := v numberOfRows.
211-
212208 identity := PMSymmetricMatrix identity: n.
213209 self assert: v transpose * v closeTo: identity
214210]
@@ -218,35 +214,26 @@ PMSingularValueDecompositionTest >> testIsSquareU [
218214 " U should be a square matrix"
219215
220216 | u |
221-
222- u := matrix decompose leftSingularForm.
223- self
224- assert: u numberOfRows
225- equals: u numberOfColumns.
217+ u := matrix decomposeSV leftSingularForm.
218+ self assert: u numberOfRows equals: u numberOfColumns
226219]
227220
228221{ #category : #tests }
229222PMSingularValueDecompositionTest >> testIsSquareV [
230223 " V should be a square matrix"
231224
232225 | v |
233-
234- v := matrix decompose rightSingularForm.
235- self
236- assert: v numberOfRows
237- equals: v numberOfColumns.
226+ v := matrix decomposeSV rightSingularForm.
227+ self assert: v numberOfRows equals: v numberOfColumns
238228]
239229
240230{ #category : #tests }
241231PMSingularValueDecompositionTest >> testReconstruction [
242-
243232 | svd u v s reconstructed |
244-
245- svd := matrix decompose.
233+ svd := matrix decomposeSV.
246234 u := svd leftSingularForm.
247235 v := svd rightSingularForm.
248236 s := svd sForm.
249-
250237 reconstructed := u * s * v transpose.
251238 self assert: reconstructed closeTo: matrix
252239]
@@ -256,64 +243,58 @@ PMSingularValueDecompositionTest >> testShapeS [
256243 " If A is an (m x n) matrix, then S should be an (m x n) matrix"
257244
258245 | s m n |
259-
260- s := matrix decompose sForm.
246+ s := matrix decomposeSV sForm.
261247 m := matrix numberOfRows.
262248 n := matrix numberOfColumns.
263-
264249 self assert: s numberOfRows equals: m.
265- self assert: s numberOfColumns equals: n.
250+ self assert: s numberOfColumns equals: n
266251]
267252
268253{ #category : #tests }
269254PMSingularValueDecompositionTest >> testShapeU [
270255 " If A is an (m x n) matrix, then U should be an (m x m) matrix"
271256
272257 | u m |
273-
274- u := matrix decompose leftSingularForm.
258+ u := matrix decomposeSV leftSingularForm.
275259 m := matrix numberOfRows.
276-
277260 self assert: u numberOfRows equals: m.
278- self assert: u numberOfColumns equals: m.
261+ self assert: u numberOfColumns equals: m
279262]
280263
281264{ #category : #tests }
282265PMSingularValueDecompositionTest >> testShapeV [
283266 " If A is an (m x n) matrix, then V should be an (n x n) matrix"
284267
285268 | v n |
286-
287- v := matrix decompose rightSingularForm.
269+ v := matrix decomposeSV rightSingularForm.
288270 n := matrix numberOfColumns.
289-
290271 self assert: v numberOfRows equals: n.
291- self assert: v numberOfColumns equals: n.
272+ self assert: v numberOfColumns equals: n
292273]
293274
294275{ #category : #tests }
295276PMSingularValueDecompositionTest >> testValueS [
296277 " Comparing S to its known value"
297278
298279 | s |
299- s := matrix decompose sForm.
300- self assert: s closeTo: actualS.
280+ s := matrix decomposeSV sForm.
281+ self assert: s closeTo: actualS
301282]
302283
303284{ #category : #tests }
304285PMSingularValueDecompositionTest >> testValueU [
305286 " Comparing U to its known value"
306287
307288 | u |
308- u := matrix decompose leftSingularForm.
309- self assert: u closeTo: actualU.
289+ u := matrix decomposeSV leftSingularForm.
290+ self assert: u closeTo: actualU
310291]
311292
312293{ #category : #tests }
313294PMSingularValueDecompositionTest >> testValueV [
314295 " Comparing V to its known value"
315296
316297 | v |
317- v := matrix decompose rightSingularForm.
318- self assert: v closeTo: actualV.
298+ v := matrix decomposeSV rightSingularForm.
299+ self assert: v closeTo: actualV
319300]
0 commit comments