@@ -5,40 +5,40 @@ pub type LEN = i32;
55pub type Col = i32 ;
66pub type Row = i32 ;
77
8- #[ derive( Debug , Clone , Copy , PartialEq ) ]
8+ #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
99pub enum MatrixLayout {
10- C ( ( Row , LDA ) ) ,
11- F ( ( Col , LDA ) ) ,
10+ C { row : i32 , lda : i32 } ,
11+ F { col : i32 , lda : i32 } ,
1212}
1313
1414impl MatrixLayout {
1515 pub fn size ( & self ) -> ( Row , Col ) {
1616 match * self {
17- MatrixLayout :: C ( ( row, lda) ) => ( row, lda) ,
18- MatrixLayout :: F ( ( col, lda) ) => ( lda, col) ,
17+ MatrixLayout :: C { row, lda } => ( row, lda) ,
18+ MatrixLayout :: F { col, lda } => ( lda, col) ,
1919 }
2020 }
2121
2222 pub fn resized ( & self , row : Row , col : Col ) -> MatrixLayout {
2323 match * self {
24- MatrixLayout :: C ( _ ) => MatrixLayout :: C ( ( row, col) ) ,
25- MatrixLayout :: F ( _ ) => MatrixLayout :: F ( ( col, row) ) ,
24+ MatrixLayout :: C { .. } => MatrixLayout :: C { row, lda : col } ,
25+ MatrixLayout :: F { .. } => MatrixLayout :: F { col, lda : row } ,
2626 }
2727 }
2828
2929 pub fn lda ( & self ) -> LDA {
3030 std:: cmp:: max (
3131 1 ,
3232 match * self {
33- MatrixLayout :: C ( ( _ , lda) ) | MatrixLayout :: F ( ( _ , lda) ) => lda,
33+ MatrixLayout :: C { lda, .. } | MatrixLayout :: F { lda, .. } => lda,
3434 } ,
3535 )
3636 }
3737
3838 pub fn len ( & self ) -> LEN {
3939 match * self {
40- MatrixLayout :: C ( ( row, _ ) ) => row,
41- MatrixLayout :: F ( ( col, _ ) ) => col,
40+ MatrixLayout :: C { row, .. } => row,
41+ MatrixLayout :: F { col, .. } => col,
4242 }
4343 }
4444
@@ -48,8 +48,8 @@ impl MatrixLayout {
4848
4949 pub fn lapacke_layout ( & self ) -> lapacke:: Layout {
5050 match * self {
51- MatrixLayout :: C ( _ ) => lapacke:: Layout :: RowMajor ,
52- MatrixLayout :: F ( _ ) => lapacke:: Layout :: ColumnMajor ,
51+ MatrixLayout :: C { .. } => lapacke:: Layout :: RowMajor ,
52+ MatrixLayout :: F { .. } => lapacke:: Layout :: ColumnMajor ,
5353 }
5454 }
5555
@@ -59,8 +59,8 @@ impl MatrixLayout {
5959
6060 pub fn toggle_order ( & self ) -> Self {
6161 match * self {
62- MatrixLayout :: C ( ( row, col ) ) => MatrixLayout :: F ( ( col , row) ) ,
63- MatrixLayout :: F ( ( col, row ) ) => MatrixLayout :: C ( ( row, col) ) ,
62+ MatrixLayout :: C { row, lda } => MatrixLayout :: F { lda : row, col : lda } ,
63+ MatrixLayout :: F { col, lda } => MatrixLayout :: C { row : lda , lda : col } ,
6464 }
6565 }
6666}
0 commit comments