Trait lowdim::Vector [−][src]
pub trait Vector<S> where
S: Integer,
Self: Clone + Copy + Eq + Hash,
Self: Index<usize, Output = S>,
Self: FromIterator<S>,
Self: VectorOps<S, Self>,
Self: for<'a> VectorOps<S, &'a Self>,
Self: Div<S, Output = Self>,
Self: for<'a> Div<&'a S, Output = Self>,
Self: Sum<Self> + for<'a> Sum<&'a Self>, {
type DefaultLayout: Layout<S, Self>;
const DIM: usize;
Show 17 methods
fn with<F>(f: F) -> Self
where
F: Fn(usize) -> S;
fn as_slice(&self) -> &[S]ⓘ;
fn as_mut_slice(&mut self) -> &mut [S]ⓘ;
fn norm_l1(&self) -> S;
fn norm_l_infty(&self) -> S;
fn norm_l2_squared(&self) -> S;
fn componentwise_cmp(&self, other: &Self) -> Option<Ordering>;
fn lex_cmp(&self, other: &Self) -> Ordering;
fn zero() -> Self { ... }
fn ones() -> Self { ... }
fn is_zero(&self) -> bool { ... }
fn min(&self, other: Self) -> Self { ... }
fn max(&self, other: Self) -> Self { ... }
fn signum(&self) -> Self { ... }
fn unit_vecs() -> UnitVecs<S, Self>ⓘ { ... }
fn unit_vecs_l1() -> UnitVecsL1<S, Self>ⓘNotable traits for UnitVecsL1<S, V>impl<S, V> Iterator for UnitVecsL1<S, V> where
S: Integer,
V: Vector<S>, type Item = V; { ... }
fn unit_vecs_l_infty() -> UnitVecsLInfty<S, Self>ⓘNotable traits for UnitVecsLInfty<S, V>impl<S, V> Iterator for UnitVecsLInfty<S, V> where
S: Integer,
V: Vector<S>, type Item = V; { ... }
}Expand description
Required traits and operations for vectors.
Associated Types
type DefaultLayout: Layout<S, Self>
type DefaultLayout: Layout<S, Self>
The default layout to use with this vector.
Associated Constants
Required methods
Create a vector from a function which computes the coordinates.
The function must return a scalar value for each possible coordinate index.
Example
assert_eq!(v4d(0, 1, 2, 3), Vec4d::with(|i| i64::try_from(i).unwrap()));Returns a slice containing the coordinates of the vector.
Returns a mutable slice containing the coordinates of the vector.
Returns the L1 norm of the vector.
This is also called the taxicab, Manhatten or city block norm.
fn norm_l_infty(&self) -> S
fn norm_l_infty(&self) -> S
Returns the L∞ norm of the vector.
This is also called the maximum or Chebychev norm.
fn norm_l2_squared(&self) -> S
fn norm_l2_squared(&self) -> S
Returns the square of the L2-norm of the vector.
The L2-norm is also called the Euclidean norm and is the standard notion of the length of a vector.
fn componentwise_cmp(&self, other: &Self) -> Option<Ordering>
fn componentwise_cmp(&self, other: &Self) -> Option<Ordering>
Returns the partial ordering by component of two vectors.
Provided methods
Signum by component.
Maps a vector to a unit step in the L∞ norm. This is a step on a shortest path w.r.t. L∞ along the vector.
Returns an iterator that yields the unit vectors.
fn unit_vecs_l1() -> UnitVecsL1<S, Self>ⓘNotable traits for UnitVecsL1<S, V>impl<S, V> Iterator for UnitVecsL1<S, V> where
S: Integer,
V: Vector<S>, type Item = V;
fn unit_vecs_l1() -> UnitVecsL1<S, Self>ⓘNotable traits for UnitVecsL1<S, V>impl<S, V> Iterator for UnitVecsL1<S, V> where
S: Integer,
V: Vector<S>, type Item = V;
impl<S, V> Iterator for UnitVecsL1<S, V> where
S: Integer,
V: Vector<S>, type Item = V;Returns an iterator that yields the vectors to orthogonal neighbours.
These are the vectors with L1 norm equal to 1.
fn unit_vecs_l_infty() -> UnitVecsLInfty<S, Self>ⓘNotable traits for UnitVecsLInfty<S, V>impl<S, V> Iterator for UnitVecsLInfty<S, V> where
S: Integer,
V: Vector<S>, type Item = V;
fn unit_vecs_l_infty() -> UnitVecsLInfty<S, Self>ⓘNotable traits for UnitVecsLInfty<S, V>impl<S, V> Iterator for UnitVecsLInfty<S, V> where
S: Integer,
V: Vector<S>, type Item = V;
impl<S, V> Iterator for UnitVecsLInfty<S, V> where
S: Integer,
V: Vector<S>, type Item = V;Creates a vector of the vectors with L∞ norm equal to 1.
These correspond to a single orthogonal or diagonal step.
