File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 3
3
use ndarray:: { Ix2 , Array , LinalgScalar } ;
4
4
use std:: fmt:: Debug ;
5
5
use num_traits:: float:: Float ;
6
+ use lapack:: c:: Layout ;
6
7
7
8
use matrix:: Matrix ;
8
9
use error:: { LinalgError , NotSquareError } ;
@@ -42,13 +43,12 @@ impl<A> SquareMatrix for Array<A, Ix2>
42
43
fn inv ( self ) -> Result < Self , LinalgError > {
43
44
try!( self . check_square ( ) ) ;
44
45
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 ( ) ) ?;
47
48
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 ( ) ) ,
52
52
}
53
53
}
54
54
fn trace ( & self ) -> Result < Self :: Scalar , LinalgError > {
You can’t perform that action at this time.
0 commit comments