@@ -30,30 +30,30 @@ macro_rules! impl_solveh {
30
30
let mut work_size = [ Self :: zero( ) ] ;
31
31
unsafe {
32
32
$trf(
33
- uplo as u8 ,
34
- n,
35
- a ,
36
- l. lda( ) ,
37
- & mut ipiv,
38
- & mut work_size,
39
- - 1 ,
33
+ uplo. as_ptr ( ) ,
34
+ & n,
35
+ AsPtr :: as_mut_ptr ( a ) ,
36
+ & l. lda( ) ,
37
+ ipiv. as_mut_ptr ( ) ,
38
+ AsPtr :: as_mut_ptr ( & mut work_size) ,
39
+ & ( - 1 ) ,
40
40
& mut info,
41
41
)
42
42
} ;
43
43
info. as_lapack_result( ) ?;
44
44
45
45
// actual
46
46
let lwork = work_size[ 0 ] . to_usize( ) . unwrap( ) ;
47
- let mut work = unsafe { vec_uninit( lwork) } ;
47
+ let mut work: Vec < Self > = unsafe { vec_uninit( lwork) } ;
48
48
unsafe {
49
49
$trf(
50
- uplo as u8 ,
51
- n,
52
- a ,
53
- l. lda( ) ,
54
- & mut ipiv,
55
- & mut work,
56
- lwork as i32 ,
50
+ uplo. as_ptr ( ) ,
51
+ & n,
52
+ AsPtr :: as_mut_ptr ( a ) ,
53
+ & l. lda( ) ,
54
+ ipiv. as_mut_ptr ( ) ,
55
+ AsPtr :: as_mut_ptr ( & mut work) ,
56
+ & ( lwork as i32 ) ,
57
57
& mut info,
58
58
)
59
59
} ;
@@ -64,8 +64,18 @@ macro_rules! impl_solveh {
64
64
fn invh( l: MatrixLayout , uplo: UPLO , a: & mut [ Self ] , ipiv: & Pivot ) -> Result <( ) > {
65
65
let ( n, _) = l. size( ) ;
66
66
let mut info = 0 ;
67
- let mut work = unsafe { vec_uninit( n as usize ) } ;
68
- unsafe { $tri( uplo as u8 , n, a, l. lda( ) , ipiv, & mut work, & mut info) } ;
67
+ let mut work: Vec <Self > = unsafe { vec_uninit( n as usize ) } ;
68
+ unsafe {
69
+ $tri(
70
+ uplo. as_ptr( ) ,
71
+ & n,
72
+ AsPtr :: as_mut_ptr( a) ,
73
+ & l. lda( ) ,
74
+ ipiv. as_ptr( ) ,
75
+ AsPtr :: as_mut_ptr( & mut work) ,
76
+ & mut info,
77
+ )
78
+ } ;
69
79
info. as_lapack_result( ) ?;
70
80
Ok ( ( ) )
71
81
}
@@ -79,15 +89,47 @@ macro_rules! impl_solveh {
79
89
) -> Result <( ) > {
80
90
let ( n, _) = l. size( ) ;
81
91
let mut info = 0 ;
82
- unsafe { $trs( uplo as u8 , n, 1 , a, l. lda( ) , ipiv, b, n, & mut info) } ;
92
+ unsafe {
93
+ $trs(
94
+ uplo. as_ptr( ) ,
95
+ & n,
96
+ & 1 ,
97
+ AsPtr :: as_ptr( a) ,
98
+ & l. lda( ) ,
99
+ ipiv. as_ptr( ) ,
100
+ AsPtr :: as_mut_ptr( b) ,
101
+ & n,
102
+ & mut info,
103
+ )
104
+ } ;
83
105
info. as_lapack_result( ) ?;
84
106
Ok ( ( ) )
85
107
}
86
108
}
87
109
} ;
88
110
} // impl_solveh!
89
111
90
- impl_solveh ! ( f64 , lapack:: dsytrf, lapack:: dsytri, lapack:: dsytrs) ;
91
- impl_solveh ! ( f32 , lapack:: ssytrf, lapack:: ssytri, lapack:: ssytrs) ;
92
- impl_solveh ! ( c64, lapack:: zhetrf, lapack:: zhetri, lapack:: zhetrs) ;
93
- impl_solveh ! ( c32, lapack:: chetrf, lapack:: chetri, lapack:: chetrs) ;
112
+ impl_solveh ! (
113
+ f64 ,
114
+ lapack_sys:: dsytrf_,
115
+ lapack_sys:: dsytri_,
116
+ lapack_sys:: dsytrs_
117
+ ) ;
118
+ impl_solveh ! (
119
+ f32 ,
120
+ lapack_sys:: ssytrf_,
121
+ lapack_sys:: ssytri_,
122
+ lapack_sys:: ssytrs_
123
+ ) ;
124
+ impl_solveh ! (
125
+ c64,
126
+ lapack_sys:: zhetrf_,
127
+ lapack_sys:: zhetri_,
128
+ lapack_sys:: zhetrs_
129
+ ) ;
130
+ impl_solveh ! (
131
+ c32,
132
+ lapack_sys:: chetrf_,
133
+ lapack_sys:: chetri_,
134
+ lapack_sys:: chetrs_
135
+ ) ;
0 commit comments