Skip to main content

mindim

Function mindim 

pub fn mindim(dims: &[usize]) -> usize
Expand description

Get the minimum dimension from a slice of dimensions.

Returns 1 for an empty slice. This is used for DiagTensor where all indices must have the same dimension.

ยงExamples

use tensor4all_tensorbackend::mindim;

assert_eq!(mindim(&[2, 3, 4]), 2);
assert_eq!(mindim(&[5, 5, 5]), 5);
assert_eq!(mindim(&[]), 1);