Skip to content

Commit 5fb1e1b

Browse files
Reduced the scope of the identity matrix to the code block.
1 parent b270613 commit 5fb1e1b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Math-Matrix/PMQRDecomposition.class.st

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,22 @@ https://en.wikipedia.org/wiki/QR_decomposition#Using_Householder_reflections
7171
{ #category : #arithmetic }
7272
PMQRDecomposition >> decomposeWithPivot [
7373

74-
| identityMatrix householderVector i v vectorOfNormSquareds rank mx pivot matrixOfMinor |
74+
| householderVector i v vectorOfNormSquareds rank mx pivot matrixOfMinor |
7575
vectorOfNormSquareds := matrixToDecompose columnsCollect: [
7676
:columnVector | columnVector * columnVector ].
7777
mx := vectorOfNormSquareds indexOf: vectorOfNormSquareds max.
7878
pivot := Array new: vectorOfNormSquareds size.
7979
rank := 0.
80-
identityMatrix := PMSymmetricMatrix identity: colSize.
8180
[
82-
| householderMatrix columnVectorFromRMatrix |
81+
| householderMatrix columnVectorFromRMatrix identityMatrix |
8382
rank := rank + 1.
8483
pivot at: rank put: mx.
8584
r swapColumn: rank withColumn: mx.
8685
vectorOfNormSquareds swap: rank with: mx.
8786
columnVectorFromRMatrix := r columnVectorAt: rank size: colSize.
8887
householderVector := columnVectorFromRMatrix householder.
8988
v := (PMVector zeros: rank - 1) , (householderVector at: 2).
89+
identityMatrix := PMSymmetricMatrix identity: colSize.
9090
householderMatrix := identityMatrix
9191
-
9292
((householderVector at: 1) * v tensorProduct: v).

0 commit comments

Comments
 (0)