@@ -24,29 +24,28 @@ PMQRTest >> assert: inverse isMoorePenroseInverseOf: aMatrix [
2424 self assert: (identityMatrix * aMatrix) closeTo: aMatrix.
2525]
2626
27- { #category : #running }
28- PMQRTest >> mpTestFunction: aMatrix [
29-
30- | inverse |
31- inverse := aMatrix mpInverse.
32- self assert: inverse isMoorePenroseInverseOf: aMatrix.
33-
34- ]
35-
3627{ #category : #tests }
3728PMQRTest >> testMoorePenroseInverse [
3829
39- | a |
30+ | a inverse |
4031 a := PMMatrix new initializeRows:
4132 #( #( 5 40 1 ) #( 0 0 1 ) #( 0 0 1 ) ).
42- self mpTestFunction: a.
33+ inverse := a mpInverse .
34+ self assert: inverse isMoorePenroseInverseOf: a.
35+
4336 a := a * (PMMatrix rows: 3 columns: 3 random: 5.0 ).
44- self mpTestFunction: a.
37+ inverse := a mpInverse .
38+ self assert: inverse isMoorePenroseInverseOf: a.
39+
4540 a := PMMatrix new initializeRows:
4641 #( #( 5 40 1 2.5 ) #( 0 0 1 2.5 ) #( 0 0 1 2.5 ) ).
47- self mpTestFunction: a.
42+ inverse := a mpInverse .
43+ self assert: inverse isMoorePenroseInverseOf: a.
44+
4845 a := a transpose.
49- self mpTestFunction: a.
46+ inverse := a mpInverse .
47+ self assert: inverse isMoorePenroseInverseOf: a.
48+
5049 3 timesRepeat: [
5150 a := PMMatrix rows: 3 columns: 3 random: 1.0 .
5251 self assert: (a mpInverse closeTo: a inverse).
0 commit comments