forked from PolyMathOrg/vector-matrix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPMJacobiTransformationTest.class.st
More file actions
33 lines (25 loc) · 1.02 KB
/
PMJacobiTransformationTest.class.st
File metadata and controls
33 lines (25 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Class {
#name : 'PMJacobiTransformationTest',
#superclass : 'TestCase',
#category : 'Math-Matrix-Tests',
#package : 'Math-Matrix-Tests'
}
{ #category : 'tests' }
PMJacobiTransformationTest >> testEigenvalueOfIdentityMatrixIsOne [
"The eigenvalue of I is 1"
| jacobiTransformation identityMatrix expected |
identityMatrix := PMMatrix rows: #(#(1 0) #(0 1)).
jacobiTransformation := PMJacobiTransformation matrix: identityMatrix.
expected := #(1 1).
self assert: jacobiTransformation eigenValues equals: expected
]
{ #category : 'tests' }
PMJacobiTransformationTest >> testEigenvectorsOfIdentityMatrixAreTheUnitVectors [
"The eigenvectors of I are (1 0) and (0 1), the unit basis vectors"
| identityMatrix jacobiTransform matrixOfEigenvectors expected |
identityMatrix := PMMatrix rows: #(#(1 0) #(0 1)).
jacobiTransform := PMJacobiTransformation matrix: identityMatrix.
matrixOfEigenvectors := jacobiTransform eigenVectors.
expected := PMSymmetricMatrix identity: 2.
self assert: matrixOfEigenvectors equals: expected.
]