Skip to content

Commit d93dfc5

Browse files
Merge pull request #214 from SergeStinckwich/master
Clean variables in SVD
2 parents d689214 + 24af120 commit d93dfc5

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Math-Matrix/PMSingularValueDecomposition.class.st

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ matrix := PMMatrix rows: #(
2020
(0 0 0 3)
2121
(0 0 0 0)).
2222
23-
svd := matrix decompose.
23+
svd := matrix decomposeSV.
2424
u := svd leftSingularForm.
2525
v := svd rightSingularForm.
2626
s := svd sForm.
@@ -32,15 +32,11 @@ Class {
3232
#name : #PMSingularValueDecomposition,
3333
#superclass : #Object,
3434
#instVars : [
35-
'm',
36-
'n',
3735
'u',
3836
's',
39-
'v',
40-
'signU',
41-
'signV'
37+
'v'
4238
],
43-
#category : 'Math-Matrix'
39+
#category : #'Math-Matrix'
4440
}
4541

4642
{ #category : #'instance creation' }
@@ -50,7 +46,8 @@ PMSingularValueDecomposition class >> decompose: aMatrix [
5046

5147
{ #category : #initialization }
5248
PMSingularValueDecomposition >> initialize: aMatrix [
53-
| symU symV eigenU eigenV diag |
49+
50+
| m n symU symV eigenU eigenV diag |
5451
m := aMatrix numberOfRows.
5552
n := aMatrix numberOfColumns.
5653
symU := aMatrix * aMatrix transpose.
@@ -62,8 +59,8 @@ PMSingularValueDecomposition >> initialize: aMatrix [
6259
u := (PMMatrix rows: eigenU vectors) transpose.
6360
v := (PMMatrix rows: eigenV vectors) transpose.
6461
diag := m < n
65-
ifTrue: [ eigenU values ]
66-
ifFalse: [ eigenV values ].
62+
ifTrue: [ eigenU values ]
63+
ifFalse: [ eigenV values ].
6764
s := PMMatrix rows: m columns: n random: 0.
6865
s setDiagonal: diag sqrt
6966
]

0 commit comments

Comments
 (0)