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