File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -44,4 +44,25 @@ impl Order {
44
44
45
45
/// "F" (for Fortran) is an alias for column major ordering
46
46
pub const F : Order = Order :: ColumnMajor ;
47
+
48
+ /// Return Order::RowMajor if the input is true, Order::ColumnMajor otherwise
49
+ #[ inline]
50
+ pub fn use_c ( use_c : bool ) -> Order {
51
+ if use_c { Order :: C } else { Order :: F }
52
+ }
53
+
54
+ /// Return Order::ColumnMajor if the input is true, Order::RowMajor otherwise
55
+ #[ inline]
56
+ pub fn use_f ( use_f : bool ) -> Order {
57
+ Self :: use_c ( !use_f)
58
+ }
59
+
60
+ /// Return the transpose: row major becomes column major and vice versa.
61
+ #[ inline]
62
+ pub fn transpose ( self ) -> Order {
63
+ match self {
64
+ Order :: RowMajor => Order :: ColumnMajor ,
65
+ Order :: ColumnMajor => Order :: RowMajor ,
66
+ }
67
+ }
47
68
}
You can’t perform that action at this time.
0 commit comments