Skip to content

Commit 8a0d429

Browse files
committed
Add UPLO
1 parent 58f3775 commit 8a0d429

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/impl2/cholesky.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ use types::*;
66
use error::*;
77
use layout::Layout;
88

9-
use super::into_result;
9+
use super::{into_result, UPLO};
1010

1111
pub trait Cholesky_: Sized {
12-
fn cholesky(Layout, a: &mut [Self]) -> Result<()>;
12+
fn cholesky(Layout, UPLO, a: &mut [Self]) -> Result<()>;
1313
}
1414

1515
macro_rules! impl_cholesky {
1616
($scalar:ty, $potrf:path) => {
1717
impl Cholesky_ for $scalar {
18-
fn cholesky(l: Layout, mut a: &mut [Self]) -> Result<()> {
18+
fn cholesky(l: Layout, uplo: UPLO, mut a: &mut [Self]) -> Result<()> {
1919
let (n, _) = l.size();
20-
let info = $potrf(l.lapacke_layout(), b'U', n, &mut a, n);
20+
let info = $potrf(l.lapacke_layout(), uplo as u8, n, &mut a, n);
2121
into_result(info, ())
2222
}
2323
}

src/impl2/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ pub fn into_result<T>(info: i32, val: T) -> Result<T> {
2323
Err(LapackError::new(info).into())
2424
}
2525
}
26+
27+
#[derive(Debug, Clone, Copy)]
28+
#[repr(u8)]
29+
pub enum UPLO {
30+
Upper = b'U',
31+
Lower = b'L',
32+
}

0 commit comments

Comments
 (0)