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 @@ -15,4 +15,25 @@ impl Order {
15
15
16
16
/// "F" (for Fortran) is an alias for column major ordering
17
17
pub const F : Order = Order :: ColumnMajor ;
18
+
19
+ /// Return Order::RowMajor if the input is true, Order::ColumnMajor otherwise
20
+ #[ inline]
21
+ pub fn use_c ( use_c : bool ) -> Order {
22
+ if use_c { Order :: C } else { Order :: F }
23
+ }
24
+
25
+ /// Return Order::ColumnMajor if the input is true, Order::RowMajor otherwise
26
+ #[ inline]
27
+ pub fn use_f ( use_f : bool ) -> Order {
28
+ Self :: use_c ( !use_f)
29
+ }
30
+
31
+ /// Return the transpose: row major becomes column major and vice versa.
32
+ #[ inline]
33
+ pub fn transpose ( self ) -> Order {
34
+ match self {
35
+ Order :: RowMajor => Order :: ColumnMajor ,
36
+ Order :: ColumnMajor => Order :: RowMajor ,
37
+ }
38
+ }
18
39
}
You can’t perform that action at this time.
0 commit comments