File tree Expand file tree Collapse file tree 2 files changed +27
-45
lines changed Expand file tree Collapse file tree 2 files changed +27
-45
lines changed Original file line number Diff line number Diff line change @@ -40,44 +40,6 @@ use num_traits::{ToPrimitive, Zero};
4040/// A^\dagger V = V Λ ⟺ V^\dagger A = Λ V^\dagger
4141/// $$
4242///
43- pub trait Eig_ : Scalar {
44- /// Compute right eigenvalue and eigenvectors $Ax = \lambda x$
45- ///
46- /// LAPACK correspondance
47- /// ----------------------
48- ///
49- /// | f32 | f64 | c32 | c64 |
50- /// |:------|:------|:------|:------|
51- /// | sgeev | dgeev | cgeev | zgeev |
52- ///
53- fn eig (
54- calc_v : bool ,
55- l : MatrixLayout ,
56- a : & mut [ Self ] ,
57- ) -> Result < ( Vec < Self :: Complex > , Vec < Self :: Complex > ) > ;
58- }
59-
60- macro_rules! impl_eig {
61- ( $s: ty) => {
62- impl Eig_ for $s {
63- fn eig(
64- calc_v: bool ,
65- l: MatrixLayout ,
66- a: & mut [ Self ] ,
67- ) -> Result <( Vec <Self :: Complex >, Vec <Self :: Complex >) > {
68- let work = EigWork :: <$s>:: new( calc_v, l) ?;
69- let EigOwned { eigs, vr, vl } = work. eval( a) ?;
70- Ok ( ( eigs, vr. or( vl) . unwrap_or_default( ) ) )
71- }
72- }
73- } ;
74- }
75- impl_eig ! ( c64) ;
76- impl_eig ! ( c32) ;
77- impl_eig ! ( f64 ) ;
78- impl_eig ! ( f32 ) ;
79-
80- /// Working memory for [Eig_]
8143#[ non_exhaustive]
8244pub struct EigWork < T : Scalar > {
8345 /// Problem size
Original file line number Diff line number Diff line change @@ -101,7 +101,6 @@ mod triangular;
101101mod tridiagonal;
102102
103103pub use self :: cholesky:: * ;
104- pub use self :: eig:: Eig_ ;
105104pub use self :: eigh:: * ;
106105pub use self :: flags:: * ;
107106pub use self :: least_squares:: * ;
@@ -115,7 +114,7 @@ pub use self::svddc::*;
115114pub use self :: triangular:: * ;
116115pub use self :: tridiagonal:: * ;
117116
118- use self :: alloc:: * ;
117+ use self :: { alloc:: * , error :: * , layout :: * } ;
119118use cauchy:: * ;
120119use std:: mem:: MaybeUninit ;
121120
@@ -130,16 +129,37 @@ pub trait Lapack:
130129 + Solve_
131130 + Solveh_
132131 + Cholesky_
133- + Eig_
134132 + Eigh_
135133 + Triangular_
136134 + Tridiagonal_
137135 + Rcond_
138136 + LeastSquaresSvdDivideConquer_
139137{
138+ /// Compute right eigenvalue and eigenvectors
139+ fn eig (
140+ calc_v : bool ,
141+ l : MatrixLayout ,
142+ a : & mut [ Self ] ,
143+ ) -> Result < ( Vec < Self :: Complex > , Vec < Self :: Complex > ) > ;
140144}
141145
142- impl Lapack for f32 { }
143- impl Lapack for f64 { }
144- impl Lapack for c32 { }
145- impl Lapack for c64 { }
146+ macro_rules! impl_lapack {
147+ ( $s: ty) => {
148+ impl Lapack for $s {
149+ fn eig(
150+ calc_v: bool ,
151+ l: MatrixLayout ,
152+ a: & mut [ Self ] ,
153+ ) -> Result <( Vec <Self :: Complex >, Vec <Self :: Complex >) > {
154+ use eig:: * ;
155+ let work = EigWork :: <$s>:: new( calc_v, l) ?;
156+ let EigOwned { eigs, vr, vl } = work. eval( a) ?;
157+ Ok ( ( eigs, vr. or( vl) . unwrap_or_default( ) ) )
158+ }
159+ }
160+ } ;
161+ }
162+ impl_lapack ! ( c64) ;
163+ impl_lapack ! ( c32) ;
164+ impl_lapack ! ( f64 ) ;
165+ impl_lapack ! ( f32 ) ;
You can’t perform that action at this time.
0 commit comments