File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 6767" 15"
6868]
6969
70+ { #category : #' instance creation' }
71+ PMMatrix class >> identity: dimension [
72+ ^ PMSymmetricMatrix identity: dimension
73+ ]
74+
7075{ #category : #' instance creation' }
7176PMMatrix class >> join: anArrayOfMatrices [
7277 " Inverse of the split operation."
Original file line number Diff line number Diff line change @@ -197,6 +197,20 @@ PMMatrixTest >> testFlattenRows [
197197 self assert: m flattenRows equals: #(1 2 3 4 5 6 7 8 9) asPMVector
198198]
199199
200+ { #category : #tests }
201+ PMMatrixTest >> testIdentityMatrix [
202+ |expectedIdentityMatrix identityMatrix |
203+
204+ expectedIdentityMatrix := PMMatrix zerosRows: 3 cols: 3 .
205+
206+ expectedIdentityMatrix at: 1 at: 1 put: 1 .
207+ expectedIdentityMatrix at: 2 at: 2 put: 1 .
208+ expectedIdentityMatrix at: 3 at: 3 put: 1 .
209+
210+ identityMatrix := PMMatrix identity: 3 .
211+ self assert: identityMatrix equals: expectedIdentityMatrix.
212+ ]
213+
200214{ #category : #tests }
201215PMMatrixTest >> testIsRealOnComplexMatrix [
202216 | matrix |
Original file line number Diff line number Diff line change 11Class {
22 #name : #PMSymmetricMatrixTest ,
33 #superclass : #TestCase ,
4- #category : ' Math-Tests-Matrix'
4+ #category : # ' Math-Tests-Matrix'
55}
66
77{ #category : #tests }
@@ -38,6 +38,16 @@ PMSymmetricMatrixTest >> testEqual [
3838 self assert: b ~= a
3939]
4040
41+ { #category : #tests }
42+ PMSymmetricMatrixTest >> testIdentityMatrix [
43+ |expectedIdentityMatrix identityMatrix |
44+
45+ identityMatrix := PMSymmetricMatrix identity: 3 .
46+ expectedIdentityMatrix := PMSymmetricMatrix rows: #(#(1 0 0) #(0 1 0) #(0 0 1) ).
47+
48+ self assert: identityMatrix equals: expectedIdentityMatrix.
49+ ]
50+
4151{ #category : #tests }
4252PMSymmetricMatrixTest >> testInversePureLUP [
4353 | m i |
You can’t perform that action at this time.
0 commit comments