Skip to content

Commit d087fb7

Browse files
committed
Visible nrhs in solve_triangular
1 parent 2ac7e45 commit d087fb7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/solve.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ pub trait ImplSolve: Sized {
2222
uplo: u8,
2323
size: usize,
2424
a: &[Self],
25-
b: Vec<Self>)
25+
b: Vec<Self>,
26+
nrhs: i32)
2627
-> Result<Vec<Self>, LapackError>;
2728
}
2829

@@ -65,14 +66,14 @@ impl ImplSolve for $scalar {
6566
Err(From::from(info))
6667
}
6768
}
68-
fn solve_triangle(layout: Layout, uplo: u8, size: usize, a: &[Self], mut b: Vec<Self>) -> Result<Vec<Self>, LapackError> {
69+
fn solve_triangle(layout: Layout, uplo: u8, size: usize, a: &[Self], mut b: Vec<Self>, nrhs: i32) -> Result<Vec<Self>, LapackError> {
6970
let n = size as i32;
7071
let lda = n;
7172
let ldb = match layout {
7273
Layout::ColumnMajor => n,
7374
Layout::RowMajor => 1,
7475
};
75-
let info = $trtrs(layout, uplo, 'N' as u8, 'N' as u8, n, 1, a, lda, &mut b, ldb);
76+
let info = $trtrs(layout, uplo, 'N' as u8, 'N' as u8, n, nrhs, a, lda, &mut b, ldb);
7677
if info == 0 {
7778
Ok(b)
7879
} else {

src/triangular.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ impl<A: MFloat> TriangularMatrix for Array<A, Ix2> {
1919
let (n, _) = self.size();
2020
let layout = self.layout()?;
2121
let a = self.as_slice_memory_order().unwrap();
22-
let x = ImplSolve::solve_triangle(layout, 'U' as u8, n, a, b.into_raw_vec())?;
22+
let x = ImplSolve::solve_triangle(layout, 'U' as u8, n, a, b.into_raw_vec(), 1)?;
2323
Ok(Array::from_vec(x))
2424
}
2525
fn solve_lower(&self, b: Self::Vector) -> Result<Self::Vector, LinalgError> {
2626
self.check_square()?;
2727
let (n, _) = self.size();
2828
let layout = self.layout()?;
2929
let a = self.as_slice_memory_order().unwrap();
30-
let x = ImplSolve::solve_triangle(layout, 'L' as u8, n, a, b.into_raw_vec())?;
30+
let x = ImplSolve::solve_triangle(layout, 'L' as u8, n, a, b.into_raw_vec(), 1)?;
3131
Ok(Array::from_vec(x))
3232
}
3333
}

0 commit comments

Comments
 (0)