58
58
//! According to the property input metrix,
59
59
//! there are several types of eigenvalue problem API
60
60
//!
61
- //! - [Eig_] trait provides methods for eigenvalue problem for general matrix.
61
+ //! - [eig] module for eigenvalue problem for general matrix.
62
62
//! - [Eigh_] trait provides methods for eigenvalue problem for symmetric/hermite matrix.
63
63
//!
64
64
//! Singular Value Decomposition
@@ -101,7 +101,6 @@ mod triangular;
101
101
mod tridiagonal;
102
102
103
103
pub use self :: cholesky:: * ;
104
- pub use self :: eig:: Eig_ ;
105
104
pub use self :: eigh:: * ;
106
105
pub use self :: flags:: * ;
107
106
pub use self :: least_squares:: * ;
@@ -115,7 +114,7 @@ pub use self::svddc::*;
115
114
pub use self :: triangular:: * ;
116
115
pub use self :: tridiagonal:: * ;
117
116
118
- use self :: alloc:: * ;
117
+ use self :: { alloc:: * , error :: * , layout :: * } ;
119
118
use cauchy:: * ;
120
119
use std:: mem:: MaybeUninit ;
121
120
@@ -130,16 +129,38 @@ pub trait Lapack:
130
129
+ Solve_
131
130
+ Solveh_
132
131
+ Cholesky_
133
- + Eig_
134
132
+ Eigh_
135
133
+ Triangular_
136
134
+ Tridiagonal_
137
135
+ Rcond_
138
136
+ LeastSquaresSvdDivideConquer_
139
137
{
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 > ) > ;
140
144
}
141
145
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
+ /// Compute right eigenvalue and eigenvectors
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 ) ;
0 commit comments