@@ -37,50 +37,51 @@ macro_rules! impl_eigh {
37
37
calc_v: bool ,
38
38
layout: MatrixLayout ,
39
39
uplo: UPLO ,
40
- mut a: & mut [ Self ] ,
40
+ a: & mut [ Self ] ,
41
41
) -> Result <Vec <Self :: Real >> {
42
42
assert_eq!( layout. len( ) , layout. lda( ) ) ;
43
43
let n = layout. len( ) ;
44
44
let jobz = if calc_v { EigenVectorFlag :: Calc } else { EigenVectorFlag :: Not } ;
45
45
let mut eigs = unsafe { vec_uninit( n as usize ) } ;
46
46
47
47
$(
48
- let mut $rwork_ident = unsafe { vec_uninit( 3 * n as usize - 2 as usize ) } ;
48
+ let mut $rwork_ident: Vec < Self :: Real > = unsafe { vec_uninit( 3 * n as usize - 2 as usize ) } ;
49
49
) *
50
50
51
51
// calc work size
52
52
let mut info = 0 ;
53
53
let mut work_size = [ Self :: zero( ) ] ;
54
54
unsafe {
55
55
$ev(
56
- jobz as u8 ,
57
- uplo as u8 ,
58
- n,
59
- & mut a ,
60
- n,
61
- & mut eigs,
62
- & mut work_size,
63
- - 1 ,
64
- $( & mut $rwork_ident, ) *
56
+ jobz. as_ptr ( ) ,
57
+ uplo. as_ptr ( ) ,
58
+ & n,
59
+ AsPtr :: as_mut_ptr ( a ) ,
60
+ & n,
61
+ AsPtr :: as_mut_ptr ( & mut eigs) ,
62
+ AsPtr :: as_mut_ptr ( & mut work_size) ,
63
+ & ( - 1 ) ,
64
+ $( AsPtr :: as_mut_ptr ( & mut $rwork_ident) , ) *
65
65
& mut info,
66
66
) ;
67
67
}
68
68
info. as_lapack_result( ) ?;
69
69
70
70
// actual ev
71
71
let lwork = work_size[ 0 ] . to_usize( ) . unwrap( ) ;
72
- let mut work = unsafe { vec_uninit( lwork) } ;
72
+ let mut work: Vec <Self > = unsafe { vec_uninit( lwork) } ;
73
+ let lwork = lwork as i32 ;
73
74
unsafe {
74
75
$ev(
75
- jobz as u8 ,
76
- uplo as u8 ,
77
- n,
78
- & mut a ,
79
- n,
80
- & mut eigs,
81
- & mut work,
82
- lwork as i32 ,
83
- $( & mut $rwork_ident, ) *
76
+ jobz. as_ptr ( ) ,
77
+ uplo. as_ptr ( ) ,
78
+ & n,
79
+ AsPtr :: as_mut_ptr ( a ) ,
80
+ & n,
81
+ AsPtr :: as_mut_ptr ( & mut eigs) ,
82
+ AsPtr :: as_mut_ptr ( & mut work) ,
83
+ & lwork,
84
+ $( AsPtr :: as_mut_ptr ( & mut $rwork_ident) , ) *
84
85
& mut info,
85
86
) ;
86
87
}
@@ -92,57 +93,58 @@ macro_rules! impl_eigh {
92
93
calc_v: bool ,
93
94
layout: MatrixLayout ,
94
95
uplo: UPLO ,
95
- mut a: & mut [ Self ] ,
96
- mut b: & mut [ Self ] ,
96
+ a: & mut [ Self ] ,
97
+ b: & mut [ Self ] ,
97
98
) -> Result <Vec <Self :: Real >> {
98
99
assert_eq!( layout. len( ) , layout. lda( ) ) ;
99
100
let n = layout. len( ) ;
100
101
let jobz = if calc_v { EigenVectorFlag :: Calc } else { EigenVectorFlag :: Not } ;
101
102
let mut eigs = unsafe { vec_uninit( n as usize ) } ;
102
103
103
104
$(
104
- let mut $rwork_ident = unsafe { vec_uninit( 3 * n as usize - 2 ) } ;
105
+ let mut $rwork_ident: Vec < Self :: Real > = unsafe { vec_uninit( 3 * n as usize - 2 ) } ;
105
106
) *
106
107
107
108
// calc work size
108
109
let mut info = 0 ;
109
110
let mut work_size = [ Self :: zero( ) ] ;
110
111
unsafe {
111
112
$evg(
112
- & [ 1 ] ,
113
- jobz as u8 ,
114
- uplo as u8 ,
115
- n,
116
- & mut a ,
117
- n,
118
- & mut b ,
119
- n,
120
- & mut eigs,
121
- & mut work_size,
122
- - 1 ,
123
- $( & mut $rwork_ident, ) *
113
+ & 1 , // ITYPE A*x = (lambda)*B*x
114
+ jobz. as_ptr ( ) ,
115
+ uplo. as_ptr ( ) ,
116
+ & n,
117
+ AsPtr :: as_mut_ptr ( a ) ,
118
+ & n,
119
+ AsPtr :: as_mut_ptr ( b ) ,
120
+ & n,
121
+ AsPtr :: as_mut_ptr ( & mut eigs) ,
122
+ AsPtr :: as_mut_ptr ( & mut work_size) ,
123
+ & ( - 1 ) ,
124
+ $( AsPtr :: as_mut_ptr ( & mut $rwork_ident) , ) *
124
125
& mut info,
125
126
) ;
126
127
}
127
128
info. as_lapack_result( ) ?;
128
129
129
130
// actual evg
130
131
let lwork = work_size[ 0 ] . to_usize( ) . unwrap( ) ;
131
- let mut work = unsafe { vec_uninit( lwork) } ;
132
+ let mut work: Vec <Self > = unsafe { vec_uninit( lwork) } ;
133
+ let lwork = lwork as i32 ;
132
134
unsafe {
133
135
$evg(
134
- & [ 1 ] ,
135
- jobz as u8 ,
136
- uplo as u8 ,
137
- n,
138
- & mut a ,
139
- n,
140
- & mut b ,
141
- n,
142
- & mut eigs,
143
- & mut work,
144
- lwork as i32 ,
145
- $( & mut $rwork_ident, ) *
136
+ & 1 , // ITYPE A*x = (lambda)*B*x
137
+ jobz. as_ptr ( ) ,
138
+ uplo. as_ptr ( ) ,
139
+ & n,
140
+ AsPtr :: as_mut_ptr ( a ) ,
141
+ & n,
142
+ AsPtr :: as_mut_ptr ( b ) ,
143
+ & n,
144
+ AsPtr :: as_mut_ptr ( & mut eigs) ,
145
+ AsPtr :: as_mut_ptr ( & mut work) ,
146
+ & lwork,
147
+ $( AsPtr :: as_mut_ptr ( & mut $rwork_ident) , ) *
146
148
& mut info,
147
149
) ;
148
150
}
@@ -153,7 +155,7 @@ macro_rules! impl_eigh {
153
155
} ;
154
156
} // impl_eigh!
155
157
156
- impl_eigh ! ( @real, f64 , lapack :: dsyev , lapack :: dsygv ) ;
157
- impl_eigh ! ( @real, f32 , lapack :: ssyev , lapack :: ssygv ) ;
158
- impl_eigh ! ( @complex, c64, lapack :: zheev , lapack :: zhegv ) ;
159
- impl_eigh ! ( @complex, c32, lapack :: cheev , lapack :: chegv ) ;
158
+ impl_eigh ! ( @real, f64 , lapack_sys :: dsyev_ , lapack_sys :: dsygv_ ) ;
159
+ impl_eigh ! ( @real, f32 , lapack_sys :: ssyev_ , lapack_sys :: ssygv_ ) ;
160
+ impl_eigh ! ( @complex, c64, lapack_sys :: zheev_ , lapack_sys :: zhegv_ ) ;
161
+ impl_eigh ! ( @complex, c32, lapack_sys :: cheev_ , lapack_sys :: chegv_ ) ;
0 commit comments