88 ' matrixToDecompose' ,
99 ' colSize' ,
1010 ' r' ,
11- ' q'
11+ ' q' ,
12+ ' comparisonPrecision'
1213 ],
1314 #category : ' Math-Matrix' ,
1415 #package : ' Math-Matrix'
@@ -21,6 +22,18 @@ PMQRDecomposition class >> of: matrix [
2122 ^ self new of: matrix
2223]
2324
25+ { #category : ' constants' }
26+ PMQRDecomposition >> comparisonPrecision [
27+
28+ ^ comparisonPrecision ifNil: [ self defaultComparisonPrecision ]
29+ ]
30+
31+ { #category : ' accessing' }
32+ PMQRDecomposition >> comparisonPrecision: anObject [
33+
34+ comparisonPrecision := anObject
35+ ]
36+
2437{ #category : ' arithmetic' }
2538PMQRDecomposition >> decompose [
2639 "
@@ -108,7 +121,7 @@ PMQRDecomposition >> decomposeWithPivot [
108121 positionOfMaximum := (vectorOfNormSquareds
109122 copyFrom: rank + 1
110123 to: vectorOfNormSquareds size) max.
111- (positionOfMaximum closeTo: 0 ) ifTrue: [ positionOfMaximum := 0 ].
124+ (positionOfMaximum closeTo: 0 precision: self comparisonPrecision ) ifTrue: [ positionOfMaximum := 0 ].
112125 positionOfMaximum := positionOfMaximum > 0
113126 ifTrue: [
114127 vectorOfNormSquareds indexOf: positionOfMaximum startingAt: rank + 1 ]
@@ -128,6 +141,12 @@ PMQRDecomposition >> decomposeWithPivot [
128141 ^ Array with: q with: r with: pivot
129142]
130143
144+ { #category : ' constants' }
145+ PMQRDecomposition >> defaultComparisonPrecision [
146+
147+ ^ 0.0001
148+ ]
149+
131150{ #category : ' private' }
132151PMQRDecomposition >> householderReflectionOf: columnVector atColumnNumber: columnNumber [
133152
0 commit comments