Skip to content

Commit b12d68e

Browse files
committed
Small rev for layout
1 parent 6654b3f commit b12d68e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/square.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use ndarray::{Ix2, Array, LinalgScalar};
44
use std::fmt::Debug;
55
use num_traits::float::Float;
6+
use lapack::c::Layout;
67

78
use matrix::Matrix;
89
use error::{LinalgError, NotSquareError};
@@ -42,13 +43,12 @@ impl<A> SquareMatrix for Array<A, Ix2>
4243
fn inv(self) -> Result<Self, LinalgError> {
4344
try!(self.check_square());
4445
let (n, _) = self.size();
45-
let is_fortran_align = self.strides()[0] > self.strides()[1];
46-
let a = ImplSolve::inv(self.layout()?, n, self.into_raw_vec())?;
46+
let layout = self.layout()?;
47+
let a = ImplSolve::inv(layout, n, self.into_raw_vec())?;
4748
let m = Array::from_vec(a).into_shape((n, n)).unwrap();
48-
if is_fortran_align {
49-
Ok(m)
50-
} else {
51-
Ok(m.reversed_axes())
49+
match layout {
50+
Layout::RowMajor => Ok(m),
51+
Layout::ColumnMajor => Ok(m.reversed_axes()),
5252
}
5353
}
5454
fn trace(&self) -> Result<Self::Scalar, LinalgError> {

0 commit comments

Comments
 (0)