Get the number of dimensions of Dim4
(&self)
| 98 | |
| 99 | /// Get the number of dimensions of Dim4 |
| 100 | pub fn ndims(&self) -> usize { |
| 101 | let nelems = self.elements(); |
| 102 | match nelems { |
| 103 | 0 => 0, |
| 104 | 1 => 1, |
| 105 | _ => { |
| 106 | if self.dims[3] != 1 { |
| 107 | 4 |
| 108 | } else if self.dims[2] != 1 { |
| 109 | 3 |
| 110 | } else if self.dims[1] != 1 { |
| 111 | 2 |
| 112 | } else { |
| 113 | 1 |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /// Get the dimensions as a slice of 4 values |
| 120 | pub fn get(&self) -> &[u64; 4] { |
no test coverage detected