Skip to content

Commit b964625

Browse files
committed
Use lapack_sys in Cholesky_
1 parent 7dd8e25 commit b964625

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

lax/src/cholesky.rs

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ macro_rules! impl_cholesky {
2929
}
3030
let mut info = 0;
3131
unsafe {
32-
$trf(uplo as u8, n, a, n, &mut info);
32+
$trf(uplo.as_ptr(), &n, AsPtr::as_mut_ptr(a), &n, &mut info);
3333
}
3434
info.as_lapack_result()?;
3535
if matches!(l, MatrixLayout::C { .. }) {
@@ -45,7 +45,7 @@ macro_rules! impl_cholesky {
4545
}
4646
let mut info = 0;
4747
unsafe {
48-
$tri(uplo as u8, n, a, l.lda(), &mut info);
48+
$tri(uplo.as_ptr(), &n, AsPtr::as_mut_ptr(a), &l.lda(), &mut info);
4949
}
5050
info.as_lapack_result()?;
5151
if matches!(l, MatrixLayout::C { .. }) {
@@ -70,7 +70,16 @@ macro_rules! impl_cholesky {
7070
}
7171
}
7272
unsafe {
73-
$trs(uplo as u8, n, nrhs, a, l.lda(), b, n, &mut info);
73+
$trs(
74+
uplo.as_ptr(),
75+
&n,
76+
&nrhs,
77+
AsPtr::as_ptr(a),
78+
&l.lda(),
79+
AsPtr::as_mut_ptr(b),
80+
&n,
81+
&mut info,
82+
);
7483
}
7584
info.as_lapack_result()?;
7685
if matches!(l, MatrixLayout::C { .. }) {
@@ -84,7 +93,27 @@ macro_rules! impl_cholesky {
8493
};
8594
} // end macro_rules
8695

87-
impl_cholesky!(f64, lapack::dpotrf, lapack::dpotri, lapack::dpotrs);
88-
impl_cholesky!(f32, lapack::spotrf, lapack::spotri, lapack::spotrs);
89-
impl_cholesky!(c64, lapack::zpotrf, lapack::zpotri, lapack::zpotrs);
90-
impl_cholesky!(c32, lapack::cpotrf, lapack::cpotri, lapack::cpotrs);
96+
impl_cholesky!(
97+
f64,
98+
lapack_sys::dpotrf_,
99+
lapack_sys::dpotri_,
100+
lapack_sys::dpotrs_
101+
);
102+
impl_cholesky!(
103+
f32,
104+
lapack_sys::spotrf_,
105+
lapack_sys::spotri_,
106+
lapack_sys::spotrs_
107+
);
108+
impl_cholesky!(
109+
c64,
110+
lapack_sys::zpotrf_,
111+
lapack_sys::zpotri_,
112+
lapack_sys::zpotrs_
113+
);
114+
impl_cholesky!(
115+
c32,
116+
lapack_sys::cpotrf_,
117+
lapack_sys::cpotri_,
118+
lapack_sys::cpotrs_
119+
);

0 commit comments

Comments
 (0)