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> {
2020 problem : Array2 < A > ,
2121 pub constraints : Option < Array2 < A > > ,
2222 preconditioner : Option < Array2 < A > > ,
23- precision : A :: Real ,
23+ precision : f32 ,
2424 maxiter : usize ,
2525}
2626
2727impl < A : Float + Scalar + ScalarOperand + Lapack + PartialOrd + Default > TruncatedEig < A > {
2828 pub fn new ( problem : Array2 < A > , order : Order ) -> TruncatedEig < A > {
2929 TruncatedEig {
30- precision : NumCast :: from ( 1e-5 ) . unwrap ( ) ,
30+ precision : 1e-5 ,
3131 maxiter : problem. len_of ( Axis ( 0 ) ) * 2 ,
3232 preconditioner : None ,
3333 constraints : None ,
@@ -36,7 +36,7 @@ impl<A: Float + Scalar + ScalarOperand + Lapack + PartialOrd + Default> Truncate
3636 }
3737 }
3838
39- pub fn precision ( mut self , precision : A :: Real ) -> Self {
39+ pub fn precision ( mut self , precision : f32 ) -> Self {
4040 self . precision = precision;
4141
4242 self
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ pub fn lobpcg<
146146 mut x : Array2 < A > ,
147147 m : G ,
148148 y : Option < Array2 < A > > ,
149- tol : A :: Real ,
149+ tol : f32 ,
150150 maxiter : usize ,
151151 order : Order ,
152152) -> LobpcgResult < A > {
@@ -166,6 +166,7 @@ pub fn lobpcg<
166166
167167 // cap the number of iteration
168168 let mut iter = usize:: min ( n * 10 , maxiter) ;
169+ let tol = NumCast :: from ( tol) . unwrap ( ) ;
169170
170171 // calculate cholesky factorization of YY' and apply constraints to initial guess
171172 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
9494pub struct TruncatedSvd < A : Scalar > {
9595 order : Order ,
9696 problem : Array2 < A > ,
97- precision : A :: Real ,
97+ precision : f32 ,
9898 maxiter : usize ,
9999}
100100
101101impl < A : Float + Scalar + ScalarOperand + Lapack + PartialOrd + Default > TruncatedSvd < A > {
102102 pub fn new ( problem : Array2 < A > , order : Order ) -> TruncatedSvd < A > {
103103 TruncatedSvd {
104- precision : NumCast :: from ( 1e-5 ) . unwrap ( ) ,
104+ precision : 1e-5 ,
105105 maxiter : problem. len_of ( Axis ( 0 ) ) * 2 ,
106106 order,
107107 problem,
108108 }
109109 }
110110
111- pub fn precision ( mut self , precision : A :: Real ) -> Self {
111+ pub fn precision ( mut self , precision : f32 ) -> Self {
112112 self . precision = precision;
113113
114114 self
You can’t perform that action at this time.
0 commit comments