Skip to content

Commit 0c2ba52

Browse files
committed
Naming integers
1 parent 69aef5e commit 0c2ba52

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/layout.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,36 @@
22
use ndarray::*;
33

44
use super::error::*;
5-
use lapack::c::Layout as FFI_Layout;
5+
use lapack::c::Layout as Layout_;
6+
7+
pub type Row = usize;
8+
pub type Col = usize;
9+
10+
pub type Row_ = i32;
11+
pub type Col_ = i32;
612

713
pub enum Layout {
8-
C((usize, usize)),
9-
F((usize, usize)),
14+
C((Row, Col)),
15+
F((Row, Col)),
1016
}
1117

1218
impl Layout {
13-
pub fn size(&self) -> (usize, usize) {
19+
pub fn size(&self) -> (Row, Col) {
1420
match self {
1521
&Layout::C(s) => s,
1622
&Layout::F(s) => s,
1723
}
1824
}
1925

20-
pub fn ffi_size(&self) -> (i32, i32) {
26+
pub fn ffi_size(&self) -> (Col_, Row_) {
2127
let (n, m) = self.size();
22-
(m as i32, n as i32)
28+
(m as Col_, n as Row_)
2329
}
2430

25-
pub fn ffi_layout(&self) -> FFI_Layout {
31+
pub fn ffi_layout(&self) -> Layout_ {
2632
match self {
27-
&Layout::C(_) => FFI_Layout::RowMajor,
28-
&Layout::F(_) => FFI_Layout::ColumnMajor,
33+
&Layout::C(_) => Layout_::RowMajor,
34+
&Layout::F(_) => Layout_::ColumnMajor,
2935
}
3036
}
3137
}

0 commit comments

Comments
 (0)