Skip to content

Commit cf65cec

Browse files
committed
testHouseholder added
1 parent f69c94b commit cf65cec

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@ 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 class equals: Array;
79+
assert: (w at: 1) equals: 1.7071067811865475;
80+
assert: (w at: 2) asArray equals: #(1.0 -0.0 -0.4142135623730951).
81+
u := #(1.00001 2.00007) asPMVector. "`x <= 0` when x = 1.00001"
82+
w := u householder.
83+
self
84+
assert: w class equals: Array;
85+
assert: (w at: 1) equals: 0.5527953485259909;
86+
assert: (w at: 2) asArray equals: #(1.0 -1.6180158992689828).
87+
]
88+
7289
{ #category : #tests }
7390
PMVectorTest >> testLessThan [
7491
| vec vecCopy |
@@ -79,7 +96,7 @@ PMVectorTest >> testLessThan [
7996
self assert: vec equals: vecCopy asPMVector.
8097
]
8198

82-
{ #category : #tests }
99+
{ #category : #tests }
83100
PMVectorTest >> testMatrixConversionWithBothDims [
84101
| vect result expected |
85102
vect := #(1 0.5 0.2 3 1 -1 7 3 2 12 13 3) asPMVector .

0 commit comments

Comments
 (0)