File tree Expand file tree Collapse file tree 1 file changed +27
-6
lines changed
Expand file tree Collapse file tree 1 file changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ pub use self::svddc::*;
115115pub use self :: triangular:: * ;
116116pub use self :: tridiagonal:: * ;
117117
118- use self :: alloc:: * ;
118+ use self :: { alloc:: * , error :: * , layout :: * } ;
119119use cauchy:: * ;
120120use std:: mem:: MaybeUninit ;
121121
@@ -130,16 +130,37 @@ pub trait Lapack:
130130 + Solve_
131131 + Solveh_
132132 + Cholesky_
133- + Eig_
134133 + Eigh_
135134 + Triangular_
136135 + Tridiagonal_
137136 + Rcond_
138137 + LeastSquaresSvdDivideConquer_
139138{
139+ /// Compute right eigenvalue and eigenvectors
140+ fn eig (
141+ calc_v : bool ,
142+ l : MatrixLayout ,
143+ a : & mut [ Self ] ,
144+ ) -> Result < ( Vec < Self :: Complex > , Vec < Self :: Complex > ) > ;
140145}
141146
142- impl Lapack for f32 { }
143- impl Lapack for f64 { }
144- impl Lapack for c32 { }
145- impl Lapack for c64 { }
147+ macro_rules! impl_lapack {
148+ ( $s: ty) => {
149+ impl Lapack for $s {
150+ fn eig(
151+ calc_v: bool ,
152+ l: MatrixLayout ,
153+ a: & mut [ Self ] ,
154+ ) -> Result <( Vec <Self :: Complex >, Vec <Self :: Complex >) > {
155+ use eig:: * ;
156+ let work = EigWork :: <$s>:: new( calc_v, l) ?;
157+ let EigOwned { eigs, vr, vl } = work. eval( a) ?;
158+ Ok ( ( eigs, vr. or( vl) . unwrap_or_default( ) ) )
159+ }
160+ }
161+ } ;
162+ }
163+ impl_lapack ! ( c64) ;
164+ impl_lapack ! ( c32) ;
165+ impl_lapack ! ( f64 ) ;
166+ impl_lapack ! ( f32 ) ;
You can’t perform that action at this time.
0 commit comments