use na::{self, DefaultAllocator}; use traits::{Alloc, Number, Dimension}; use aliases::Vec; /// Component-wise maximum between a vector and a scalar. pub fn max(a: &Vec, b: N) -> Vec where DefaultAllocator: Alloc { a.map(|a| na::sup(&a, &b)) } /// Component-wise maximum between two vectors. pub fn max2(a: &Vec, b: &Vec) -> Vec where DefaultAllocator: Alloc { na::sup(a, b) } /// Component-wise maximum between three vectors. pub fn max3(a: &Vec, b: &Vec, c: &Vec) -> Vec where DefaultAllocator: Alloc { max2(&max2(a, b), c) } /// Component-wise maximum between four vectors. pub fn max4(a: &Vec, b: &Vec, c: &Vec, d: &Vec) -> Vec where DefaultAllocator: Alloc { max2(&max2(a, b), &max2(c, d)) } /// Component-wise minimum between a vector and a scalar. pub fn min(x: &Vec, y: N) -> Vec where DefaultAllocator: Alloc { x.map(|x| na::inf(&x, &y)) } /// Component-wise minimum between two vectors. pub fn min2(x: &Vec, y: &Vec) -> Vec where DefaultAllocator: Alloc { na::inf(x, y) } /// Component-wise minimum between three vectors. pub fn min3(a: &Vec, b: &Vec, c: &Vec) -> Vec where DefaultAllocator: Alloc { min2(&min2(a, b), c) } /// Component-wise minimum between four vectors. pub fn min4(a: &Vec, b: &Vec, c: &Vec, d: &Vec) -> Vec where DefaultAllocator: Alloc { min2(&min2(a, b), &min2(c, d)) }