MCPcopy Index your code
hub / github.com/arrayfire/arrayfire-rust / ndims

Method ndims

src/core/dim4.rs:100–117  ·  view source on GitHub ↗

Get the number of dimensions of Dim4

(&self)

Source from the content-addressed store, hash-verified

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] {

Callers 14

random_uniformFunction · 0.80
random_normalFunction · 0.80
newMethod · 0.80
new_stridedMethod · 0.80
new_emptyMethod · 0.80
new_from_device_ptrMethod · 0.80
generateMethod · 0.80
rangeFunction · 0.80
iotaFunction · 0.80
identityFunction · 0.80
moddimsFunction · 0.80
set_rowFunction · 0.80

Calls 1

elementsMethod · 0.45

Tested by

no test coverage detected