@@ -20,6 +20,7 @@ type Dgesvder interface {
20
20
}
21
21
22
22
func DgesvdTest (t * testing.T , impl Dgesvder ) {
23
+ rnd := rand .New (rand .NewSource (1 ))
23
24
// TODO(btracey): Add tests for all of the cases when the SVD implementation
24
25
// is finished.
25
26
// TODO(btracey): Add tests for m > mnthr and n > mnthr when other SVD
@@ -73,17 +74,17 @@ func DgesvdTest(t *testing.T, impl Dgesvder) {
73
74
74
75
a := make ([]float64 , m * lda )
75
76
for i := range a {
76
- a [i ] = rand .NormFloat64 ()
77
+ a [i ] = rnd .NormFloat64 ()
77
78
}
78
79
79
80
u := make ([]float64 , m * ldu )
80
81
for i := range u {
81
- u [i ] = rand .NormFloat64 ()
82
+ u [i ] = rnd .NormFloat64 ()
82
83
}
83
84
84
85
vt := make ([]float64 , n * ldvt )
85
86
for i := range vt {
86
- vt [i ] = rand .NormFloat64 ()
87
+ vt [i ] = rnd .NormFloat64 ()
87
88
}
88
89
89
90
uAllOrig := make ([]float64 , len (u ))
@@ -125,14 +126,15 @@ func DgesvdTest(t *testing.T, impl Dgesvder) {
125
126
// svdCheckPartial checks that the singular values and vectors are computed when
126
127
// not all of them are computed.
127
128
func svdCheckPartial (t * testing.T , impl Dgesvder , job lapack.SVDJob , errStr string , uAllOrig , vtAllOrig , aCopy []float64 , m , n int , a []float64 , lda int , s , u []float64 , ldu int , vt []float64 , ldvt int , work []float64 , shortWork bool ) {
129
+ rnd := rand .New (rand .NewSource (1 ))
128
130
jobU := job
129
131
jobVT := job
130
132
// Compare the singular values when computed with {SVDNone, SVDNone.}
131
133
sCopy := make ([]float64 , len (s ))
132
134
copy (sCopy , s )
133
135
copy (a , aCopy )
134
136
for i := range s {
135
- s [i ] = rand .Float64 ()
137
+ s [i ] = rnd .Float64 ()
136
138
}
137
139
tmp1 := make ([]float64 , 1 )
138
140
tmp2 := make ([]float64 , 1 )
@@ -167,7 +169,7 @@ func svdCheckPartial(t *testing.T, impl Dgesvder, job lapack.SVDJob, errStr stri
167
169
jobVT = lapack .SVDNone
168
170
copy (a , aCopy )
169
171
for i := range s {
170
- s [i ] = rand .Float64 ()
172
+ s [i ] = rnd .Float64 ()
171
173
}
172
174
impl .Dgesvd (jobU , jobVT , m , n , a , lda , s , u , ldu , tmp2 , ldvt , work , - 1 )
173
175
work = make ([]float64 , int (work [0 ]))
@@ -186,7 +188,7 @@ func svdCheckPartial(t *testing.T, impl Dgesvder, job lapack.SVDJob, errStr stri
186
188
jobVT = job
187
189
copy (a , aCopy )
188
190
for i := range s {
189
- s [i ] = rand .Float64 ()
191
+ s [i ] = rnd .Float64 ()
190
192
}
191
193
impl .Dgesvd (jobU , jobVT , m , n , a , lda , s , tmp1 , ldu , vt , ldvt , work , - 1 )
192
194
work = make ([]float64 , int (work [0 ]))
@@ -281,5 +283,4 @@ func svdCheck(t *testing.T, thin bool, errStr string, m, n int, s, a, u []float6
281
283
}
282
284
}
283
285
}
284
-
285
286
}
0 commit comments