You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use TruncatedSvd with a generic Float type but it can not compile as it has to use the MagnitudeCorrection trait which is not exported from ndarray-linalg::lobpcg module. My test program here:
use ndarray::{arr1, arr2,Array1,Array2,ScalarOperand};use ndarray_linalg::{close_l2,Lapack,TruncatedOrder,TruncatedSvd};// should use MagnitudeCorrection as welluse num_traits::Float;fntest_truncated_svd<F:Float + Lapack + ScalarOperand + Default>(// should add MagnitudeCorrection trait bounda:Array2<F>,) -> Array1<F>{let res = TruncatedSvd::new(a,TruncatedOrder::Largest).precision(1e-5).maxiter(10).decompose(2).unwrap();let(_, sigma, _) = res.values_vectors();
sigma
}fnmain(){let a = arr2(&[[3.,2.,2.],[2.,3., -2.]]);let sigma = test_truncated_svd(a);close_l2(&sigma,&arr1(&[5.0,3.0]),1e-5);}
Activity