use na::{DefaultAllocator}; use aliases::Vec; use traits::{Number, Alloc, Dimension}; /// Checks that all the vector components are `true`. pub fn all(v: &Vec) -> bool where DefaultAllocator: Alloc { v.iter().all(|x| *x) } /// Checks that at least one of the vector components is `true`. pub fn any(v: &Vec) -> bool where DefaultAllocator: Alloc { v.iter().any(|x| *x) } /// Componentwise equality comparison. pub fn equal(x: &Vec, y: &Vec) -> Vec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x == y) } /// Componentwise `>` comparison. pub fn greater_than(x: &Vec, y: &Vec) -> Vec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x > y) } /// Componentwise `>=` comparison. pub fn greater_than_equal(x: &Vec, y: &Vec) -> Vec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x >= y) } /// Componentwise `<` comparison. pub fn less_than(x: &Vec, y: &Vec) -> Vec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x < y) } /// Componentwise `>=` comparison. pub fn less_than_equal(x: &Vec, y: &Vec) -> Vec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x <= y) } /// Componentwise not `!`. pub fn not(v: &Vec) -> Vec where DefaultAllocator: Alloc { v.map(|x| !x) } /// Componentwise not-equality `!=`. pub fn not_equal(x: &Vec, y: &Vec) -> Vec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x != y) }