@@ -44,16 +44,8 @@ macro_rules! impl_eig_complex {
44
44
let mut eigs = unsafe { vec_uninit( n as usize ) } ;
45
45
let mut rwork = unsafe { vec_uninit( 2 * n as usize ) } ;
46
46
47
- let mut vl = if jobvl == EigenVectorFlag :: Calc {
48
- Some ( unsafe { vec_uninit( ( n * n) as usize ) } )
49
- } else {
50
- None
51
- } ;
52
- let mut vr = if jobvr == EigenVectorFlag :: Calc {
53
- Some ( unsafe { vec_uninit( ( n * n) as usize ) } )
54
- } else {
55
- None
56
- } ;
47
+ let mut vl = jobvl. then( || unsafe { vec_uninit( ( n * n) as usize ) } ) ;
48
+ let mut vr = jobvr. then( || unsafe { vec_uninit( ( n * n) as usize ) } ) ;
57
49
58
50
// calc work size
59
51
let mut info = 0 ;
@@ -102,7 +94,7 @@ macro_rules! impl_eig_complex {
102
94
info. as_lapack_result( ) ?;
103
95
104
96
// Hermite conjugate
105
- if jobvl == EigenVectorFlag :: Calc {
97
+ if jobvl. is_calc ( ) {
106
98
for c in vl. as_mut( ) . unwrap( ) . iter_mut( ) {
107
99
c. im = -c. im
108
100
}
@@ -153,16 +145,10 @@ macro_rules! impl_eig_real {
153
145
let mut eig_re: Vec <Self > = unsafe { vec_uninit( n as usize ) } ;
154
146
let mut eig_im: Vec <Self > = unsafe { vec_uninit( n as usize ) } ;
155
147
156
- let mut vl: Option <Vec <Self >> = if jobvl == EigenVectorFlag :: Calc {
157
- Some ( unsafe { vec_uninit( ( n * n) as usize ) } )
158
- } else {
159
- None
160
- } ;
161
- let mut vr: Option <Vec <Self >> = if jobvr == EigenVectorFlag :: Calc {
162
- Some ( unsafe { vec_uninit( ( n * n) as usize ) } )
163
- } else {
164
- None
165
- } ;
148
+ let mut vl: Option <Vec <Self >> =
149
+ jobvl. then( || unsafe { vec_uninit( ( n * n) as usize ) } ) ;
150
+ let mut vr: Option <Vec <Self >> =
151
+ jobvr. then( || unsafe { vec_uninit( ( n * n) as usize ) } ) ;
166
152
167
153
// calc work size
168
154
let mut info = 0 ;
@@ -255,7 +241,7 @@ macro_rules! impl_eig_real {
255
241
for row in 0 ..n {
256
242
let re = v[ row + col * n] ;
257
243
let mut im = v[ row + ( col + 1 ) * n] ;
258
- if jobvl == EigenVectorFlag :: Calc {
244
+ if jobvl. is_calc ( ) {
259
245
im = -im;
260
246
}
261
247
eigvecs[ row + col * n] = Self :: complex( re, im) ;
0 commit comments