File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,14 @@ pub struct TruncatedEig<A: Scalar> {
20
20
problem : Array2 < A > ,
21
21
pub constraints : Option < Array2 < A > > ,
22
22
preconditioner : Option < Array2 < A > > ,
23
- precision : A :: Real ,
23
+ precision : f32 ,
24
24
maxiter : usize ,
25
25
}
26
26
27
27
impl < A : Float + Scalar + ScalarOperand + Lapack + PartialOrd + Default > TruncatedEig < A > {
28
28
pub fn new ( problem : Array2 < A > , order : Order ) -> TruncatedEig < A > {
29
29
TruncatedEig {
30
- precision : NumCast :: from ( 1e-5 ) . unwrap ( ) ,
30
+ precision : 1e-5 ,
31
31
maxiter : problem. len_of ( Axis ( 0 ) ) * 2 ,
32
32
preconditioner : None ,
33
33
constraints : None ,
@@ -36,7 +36,7 @@ impl<A: Float + Scalar + ScalarOperand + Lapack + PartialOrd + Default> Truncate
36
36
}
37
37
}
38
38
39
- pub fn precision ( mut self , precision : A :: Real ) -> Self {
39
+ pub fn precision ( mut self , precision : f32 ) -> Self {
40
40
self . precision = precision;
41
41
42
42
self
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ pub fn lobpcg<
146
146
mut x : Array2 < A > ,
147
147
m : G ,
148
148
y : Option < Array2 < A > > ,
149
- tol : A :: Real ,
149
+ tol : f32 ,
150
150
maxiter : usize ,
151
151
order : Order ,
152
152
) -> LobpcgResult < A > {
@@ -166,6 +166,7 @@ pub fn lobpcg<
166
166
167
167
// cap the number of iteration
168
168
let mut iter = usize:: min ( n * 10 , maxiter) ;
169
+ let tol = NumCast :: from ( tol) . unwrap ( ) ;
169
170
170
171
// calculate cholesky factorization of YY' and apply constraints to initial guess
171
172
let cholesky_yy = y. as_ref ( ) . map ( |y| {
Original file line number Diff line number Diff line change @@ -94,21 +94,21 @@ impl<A: Float + PartialOrd + DivAssign<A> + 'static + MagnitudeCorrection> Trunc
94
94
pub struct TruncatedSvd < A : Scalar > {
95
95
order : Order ,
96
96
problem : Array2 < A > ,
97
- precision : A :: Real ,
97
+ precision : f32 ,
98
98
maxiter : usize ,
99
99
}
100
100
101
101
impl < A : Float + Scalar + ScalarOperand + Lapack + PartialOrd + Default > TruncatedSvd < A > {
102
102
pub fn new ( problem : Array2 < A > , order : Order ) -> TruncatedSvd < A > {
103
103
TruncatedSvd {
104
- precision : NumCast :: from ( 1e-5 ) . unwrap ( ) ,
104
+ precision : 1e-5 ,
105
105
maxiter : problem. len_of ( Axis ( 0 ) ) * 2 ,
106
106
order,
107
107
problem,
108
108
}
109
109
}
110
110
111
- pub fn precision ( mut self , precision : A :: Real ) -> Self {
111
+ pub fn precision ( mut self , precision : f32 ) -> Self {
112
112
self . precision = precision;
113
113
114
114
self
You can’t perform that action at this time.
0 commit comments