Skip to content

Commit 87094ea

Browse files
Merge pull request #178 from mabdi/testHouseHolder
testHouseholder added
2 parents 955ec6e + 1d91d31 commit 87094ea

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Math-Tests-Core/PMVectorTest.class.st

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ PMVectorTest >> testGreaterThan [
6969
self assert: vec equals: vecCopy asPMVector.
7070
]
7171

72+
{ #category : #tests }
73+
PMVectorTest >> testHouseholder [
74+
| u w |
75+
u := #(-1 0 1) asPMVector. "`x <= 0` when x = -1"
76+
w := u householder.
77+
self
78+
assert: (w at: 1) equals: 1.7071067811865475;
79+
assert: (w at: 2) asArray equals: #(1.0 -0.0 -0.4142135623730951).
80+
u := #(1.00001 2.00007) asPMVector. "`x <= 0` when x = 1.00001"
81+
w := u householder.
82+
self
83+
assert: (w at: 1) equals: 0.5527953485259909;
84+
assert: (w at: 2) asArray equals: #(1.0 -1.6180158992689828).
85+
]
86+
7287
{ #category : #tests }
7388
PMVectorTest >> testLessThan [
7489
| vec vecCopy |
@@ -79,7 +94,7 @@ PMVectorTest >> testLessThan [
7994
self assert: vec equals: vecCopy asPMVector.
8095
]
8196

82-
{ #category : #tests }
97+
{ #category : #tests }
8398
PMVectorTest >> testMatrixConversionWithBothDims [
8499
| vect result expected |
85100
vect := #(1 0.5 0.2 3 1 -1 7 3 2 12 13 3) asPMVector .

0 commit comments

Comments
 (0)