Skip to content

Commit 7e3cd8b

Browse files
committed
Fix F-contiguous case
1 parent 2a199fa commit 7e3cd8b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lax/src/least_squares.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ macro_rules! impl_least_squares {
4242
}
4343
let k = ::std::cmp::min(m, n);
4444
let nrhs = 1;
45+
let ldb = match a_layout {
46+
MatrixLayout::F { .. } => m.max(n),
47+
MatrixLayout::C { .. } => 1,
48+
};
4549
let rcond: Self::Real = -1.;
4650
let mut singular_values: Vec<Self::Real> = vec![Self::Real::zero(); k as usize];
4751
let mut rank: i32 = 0;
@@ -54,9 +58,7 @@ macro_rules! impl_least_squares {
5458
a,
5559
a_layout.lda(),
5660
b,
57-
// this is the 'leading dimension of b', in the case where
58-
// b is a single vector, this is 1
59-
nrhs,
61+
ldb,
6062
&mut singular_values,
6163
rcond,
6264
&mut rank,

0 commit comments

Comments
 (0)