@@ -189,61 +189,67 @@ PMSingularValueDecompositionTest >> testIsExampleOrthonormalV [
189
189
190
190
{ #category : #tests }
191
191
PMSingularValueDecompositionTest >> testIsOrthonormalU [
192
+
192
193
" Verifying that matrix U is orthonormal. That is, all columns of U are unit vectors and orthogonal to each other."
193
194
194
195
| u m identity |
195
- u := matrix decomposeSV leftSingularForm .
196
+ u := matrix decomposeSV leftSingularMatrix .
196
197
m := u numberOfRows.
197
198
identity := PMSymmetricMatrix identity: m.
198
199
self assert: u transpose * u closeTo: identity
199
200
]
200
201
201
202
{ #category : #tests }
202
203
PMSingularValueDecompositionTest >> testIsOrthonormalV [
204
+
203
205
" Verifying that matrix U is orthonormal. That is, all columns of U are unit vectors and orthogonal to each other."
204
206
205
207
| v n identity |
206
- v := matrix decomposeSV rightSingularForm .
208
+ v := matrix decomposeSV rightSingularMatrix .
207
209
n := v numberOfRows.
208
210
identity := PMSymmetricMatrix identity: n.
209
211
self assert: v transpose * v closeTo: identity
210
212
]
211
213
212
214
{ #category : #tests }
213
215
PMSingularValueDecompositionTest >> testIsSquareU [
216
+
214
217
" U should be a square matrix"
215
218
216
219
| u |
217
- u := matrix decomposeSV leftSingularForm .
220
+ u := matrix decomposeSV leftSingularMatrix .
218
221
self assert: u numberOfRows equals: u numberOfColumns
219
222
]
220
223
221
224
{ #category : #tests }
222
225
PMSingularValueDecompositionTest >> testIsSquareV [
226
+
223
227
" V should be a square matrix"
224
228
225
229
| v |
226
- v := matrix decomposeSV rightSingularForm .
230
+ v := matrix decomposeSV rightSingularMatrix .
227
231
self assert: v numberOfRows equals: v numberOfColumns
228
232
]
229
233
230
234
{ #category : #tests }
231
235
PMSingularValueDecompositionTest >> testReconstruction [
236
+
232
237
| svd u v s reconstructed |
233
238
svd := matrix decomposeSV.
234
- u := svd leftSingularForm .
235
- v := svd rightSingularForm .
236
- s := svd sForm .
239
+ u := svd leftSingularMatrix .
240
+ v := svd rightSingularMatrix .
241
+ s := svd diagonalSingularValueMatrix .
237
242
reconstructed := u * s * v transpose.
238
243
self assert: reconstructed closeTo: matrix
239
244
]
240
245
241
246
{ #category : #tests }
242
247
PMSingularValueDecompositionTest >> testShapeS [
248
+
243
249
" If A is an (m x n) matrix, then S should be an (m x n) matrix"
244
250
245
251
| s m n |
246
- s := matrix decomposeSV sForm .
252
+ s := matrix decomposeSV diagonalSingularValueMatrix .
247
253
m := matrix numberOfRows.
248
254
n := matrix numberOfColumns.
249
255
self assert: s numberOfRows equals: m.
@@ -252,49 +258,54 @@ PMSingularValueDecompositionTest >> testShapeS [
252
258
253
259
{ #category : #tests }
254
260
PMSingularValueDecompositionTest >> testShapeU [
261
+
255
262
" If A is an (m x n) matrix, then U should be an (m x m) matrix"
256
263
257
264
| u m |
258
- u := matrix decomposeSV leftSingularForm .
265
+ u := matrix decomposeSV leftSingularMatrix .
259
266
m := matrix numberOfRows.
260
267
self assert: u numberOfRows equals: m.
261
268
self assert: u numberOfColumns equals: m
262
269
]
263
270
264
271
{ #category : #tests }
265
272
PMSingularValueDecompositionTest >> testShapeV [
273
+
266
274
" If A is an (m x n) matrix, then V should be an (n x n) matrix"
267
275
268
276
| v n |
269
- v := matrix decomposeSV rightSingularForm .
277
+ v := matrix decomposeSV rightSingularMatrix .
270
278
n := matrix numberOfColumns.
271
279
self assert: v numberOfRows equals: n.
272
280
self assert: v numberOfColumns equals: n
273
281
]
274
282
275
283
{ #category : #tests }
276
284
PMSingularValueDecompositionTest >> testValueS [
285
+
277
286
" Comparing S to its known value"
278
287
279
288
| s |
280
- s := matrix decomposeSV sForm .
289
+ s := matrix decomposeSV diagonalSingularValueMatrix .
281
290
self assert: s closeTo: actualS
282
291
]
283
292
284
293
{ #category : #tests }
285
294
PMSingularValueDecompositionTest >> testValueU [
295
+
286
296
" Comparing U to its known value"
287
297
288
298
| u |
289
- u := matrix decomposeSV leftSingularForm .
299
+ u := matrix decomposeSV leftSingularMatrix .
290
300
self assert: u closeTo: actualU
291
301
]
292
302
293
303
{ #category : #tests }
294
304
PMSingularValueDecompositionTest >> testValueV [
305
+
295
306
" Comparing V to its known value"
296
307
297
308
| v |
298
- v := matrix decomposeSV rightSingularForm .
309
+ v := matrix decomposeSV rightSingularMatrix .
299
310
self assert: v closeTo: actualV
300
311
]
0 commit comments