@@ -123,7 +123,7 @@ macro_rules! impl_eig_real {
123
123
fn eig(
124
124
calc_v: bool ,
125
125
l: MatrixLayout ,
126
- mut a: & mut [ Self ] ,
126
+ a: & mut [ Self ] ,
127
127
) -> Result <( Vec <Self :: Complex >, Vec <Self :: Complex >) > {
128
128
let ( n, _) = l. size( ) ;
129
129
// LAPACK assumes a column-major input. A row-major input can
@@ -150,61 +150,62 @@ macro_rules! impl_eig_real {
150
150
} else {
151
151
( EigenVectorFlag :: Not , EigenVectorFlag :: Not )
152
152
} ;
153
- let mut eig_re = unsafe { vec_uninit( n as usize ) } ;
154
- let mut eig_im = unsafe { vec_uninit( n as usize ) } ;
153
+ let mut eig_re: Vec < Self > = unsafe { vec_uninit( n as usize ) } ;
154
+ let mut eig_im: Vec < Self > = unsafe { vec_uninit( n as usize ) } ;
155
155
156
- let mut vl = if jobvl == EigenVectorFlag :: Calc {
156
+ let mut vl: Option < Vec < Self >> = if jobvl == EigenVectorFlag :: Calc {
157
157
Some ( unsafe { vec_uninit( ( n * n) as usize ) } )
158
158
} else {
159
159
None
160
160
} ;
161
- let mut vr = if jobvr == EigenVectorFlag :: Calc {
161
+ let mut vr: Option < Vec < Self >> = if jobvr == EigenVectorFlag :: Calc {
162
162
Some ( unsafe { vec_uninit( ( n * n) as usize ) } )
163
163
} else {
164
164
None
165
165
} ;
166
166
167
167
// calc work size
168
168
let mut info = 0 ;
169
- let mut work_size = [ 0.0 ] ;
169
+ let mut work_size: [ Self ; 1 ] = [ 0.0 ] ;
170
170
unsafe {
171
171
$ev(
172
- jobvl as u8 ,
173
- jobvr as u8 ,
174
- n,
175
- & mut a ,
176
- n,
177
- & mut eig_re,
178
- & mut eig_im,
179
- vl. as_mut( ) . map( |v| v. as_mut_slice( ) ) . unwrap_or( & mut [ ] ) ,
180
- n,
181
- vr. as_mut( ) . map( |v| v. as_mut_slice( ) ) . unwrap_or( & mut [ ] ) ,
182
- n,
183
- & mut work_size,
184
- - 1 ,
172
+ jobvl. as_ptr ( ) ,
173
+ jobvr. as_ptr ( ) ,
174
+ & n,
175
+ AsPtr :: as_mut_ptr ( a ) ,
176
+ & n,
177
+ AsPtr :: as_mut_ptr ( & mut eig_re) ,
178
+ AsPtr :: as_mut_ptr ( & mut eig_im) ,
179
+ AsPtr :: as_mut_ptr ( vl. as_mut( ) . map( |v| v. as_mut_slice( ) ) . unwrap_or( & mut [ ] ) ) ,
180
+ & n,
181
+ AsPtr :: as_mut_ptr ( vr. as_mut( ) . map( |v| v. as_mut_slice( ) ) . unwrap_or( & mut [ ] ) ) ,
182
+ & n,
183
+ AsPtr :: as_mut_ptr ( & mut work_size) ,
184
+ & ( - 1 ) ,
185
185
& mut info,
186
186
)
187
187
} ;
188
188
info. as_lapack_result( ) ?;
189
189
190
190
// actual ev
191
191
let lwork = work_size[ 0 ] . to_usize( ) . unwrap( ) ;
192
- let mut work = unsafe { vec_uninit( lwork) } ;
192
+ let mut work: Vec <Self > = unsafe { vec_uninit( lwork) } ;
193
+ let lwork = lwork as i32 ;
193
194
unsafe {
194
195
$ev(
195
- jobvl as u8 ,
196
- jobvr as u8 ,
197
- n,
198
- & mut a ,
199
- n,
200
- & mut eig_re,
201
- & mut eig_im,
202
- vl. as_mut( ) . map( |v| v. as_mut_slice( ) ) . unwrap_or( & mut [ ] ) ,
203
- n,
204
- vr. as_mut( ) . map( |v| v. as_mut_slice( ) ) . unwrap_or( & mut [ ] ) ,
205
- n,
206
- & mut work,
207
- lwork as i32 ,
196
+ jobvl. as_ptr ( ) ,
197
+ jobvr. as_ptr ( ) ,
198
+ & n,
199
+ AsPtr :: as_mut_ptr ( a ) ,
200
+ & n,
201
+ AsPtr :: as_mut_ptr ( & mut eig_re) ,
202
+ AsPtr :: as_mut_ptr ( & mut eig_im) ,
203
+ AsPtr :: as_mut_ptr ( vl. as_mut( ) . map( |v| v. as_mut_slice( ) ) . unwrap_or( & mut [ ] ) ) ,
204
+ & n,
205
+ AsPtr :: as_mut_ptr ( vr. as_mut( ) . map( |v| v. as_mut_slice( ) ) . unwrap_or( & mut [ ] ) ) ,
206
+ & n,
207
+ AsPtr :: as_mut_ptr ( & mut work) ,
208
+ & lwork,
208
209
& mut info,
209
210
)
210
211
} ;
@@ -270,5 +271,5 @@ macro_rules! impl_eig_real {
270
271
} ;
271
272
}
272
273
273
- impl_eig_real ! ( f64 , lapack :: dgeev ) ;
274
- impl_eig_real ! ( f32 , lapack :: sgeev ) ;
274
+ impl_eig_real ! ( f64 , lapack_sys :: dgeev_ ) ;
275
+ impl_eig_real ! ( f32 , lapack_sys :: sgeev_ ) ;
0 commit comments