Skip to content

Commit 2e645ab

Browse files
committed
test
1 parent 9d9e43b commit 2e645ab

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/Math-Matrix-Tests/PMMatrixTest.class.st

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,22 @@ PMMatrixTest >> testDimension [
163163

164164
]
165165

166+
{ #category : 'linear algebra' }
167+
PMMatrixTest >> testEigenForSingleValueMatrix [
168+
169+
| matrix expectedEigenvalues eigenvalues expectedEigenvectors eigenvectors |
170+
matrix := PMMatrix rows: #( #( 3 ) ).
171+
172+
expectedEigenvalues := #( 3 ).
173+
expectedEigenvectors := PMVector with: (PMVector ones: 1).
174+
175+
eigenvalues := matrix eigen values.
176+
eigenvectors := matrix eigen vectors.
177+
178+
eigenvalues with: expectedEigenvalues do: [ :actual :expected | self assert: actual closeTo: expected ].
179+
eigenvectors with: expectedEigenvectors do: [ :actual :expected | self assert: actual closeTo: expected ]
180+
]
181+
166182
{ #category : 'linear algebra' }
167183
PMMatrixTest >> testEigenvalues [
168184
"Code Example 8.15"

0 commit comments

Comments
 (0)