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};
40
40
/// A^\dagger V = V Λ ⟺ V^\dagger A = Λ V^\dagger
41
41
/// $$
42
42
///
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_]
81
43
#[ non_exhaustive]
82
44
pub struct EigWork < T : Scalar > {
83
45
/// Problem size
Original file line number Diff line number Diff line change @@ -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,37 @@ 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
+ 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