Skip to content

Commit 2944c81

Browse files
committed
Change factorizeh* to require square input
The LAPACK factorization routine only uses the upper left square of a rectangular matrix anyway, so allowing a rectangular input is somewhat confusing. If someone really wants to call `factorizeh*` on a rectangular matrix, they can take a square slice of portion of the rectangular matrix they want to use. This change is necessary for `BKFactorized::det()` to be able to return `A::Real` instead of having to check that the matrix is square and return `Result<A::Real>`.
1 parent a30d24f commit 2944c81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/solveh.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ where
153153
S: DataMut<Elem = A>,
154154
{
155155
fn factorizeh_into(mut self) -> Result<BKFactorized<S>> {
156-
let ipiv = unsafe { A::bk(self.layout()?, UPLO::Upper, self.as_allocated_mut()?)? };
156+
let ipiv = unsafe { A::bk(self.square_layout()?, UPLO::Upper, self.as_allocated_mut()?)? };
157157
Ok(BKFactorized {
158158
a: self,
159159
ipiv: ipiv,
@@ -168,7 +168,7 @@ where
168168
{
169169
fn factorizeh(&self) -> Result<BKFactorized<OwnedRepr<A>>> {
170170
let mut a: Array2<A> = replicate(self);
171-
let ipiv = unsafe { A::bk(a.layout()?, UPLO::Upper, a.as_allocated_mut()?)? };
171+
let ipiv = unsafe { A::bk(a.square_layout()?, UPLO::Upper, a.as_allocated_mut()?)? };
172172
Ok(BKFactorized { a: a, ipiv: ipiv })
173173
}
174174
}

0 commit comments

Comments
 (0)