Trait lowdim::Vector[][src]

pub trait Vector<S> where
    S: Integer,
    Self: Clone + Copy,
    Self: Index<usize, Output = S>,
    Self: PartialOrd,
    Self: VectorOps<S, Self>,
    Self: for<'a> VectorOps<S, &'a Self>,
    Self: Div<S, Output = Self>,
    Self: for<'a> Div<&'a S, Output = Self>, 
{ const DIM: usize; fn with<F>(f: F) -> Self
    where
        F: Fn(usize) -> S
;
fn norm_l1(&self) -> S;
fn norm_l_infty(&self) -> S;
fn unit_vecs_l_infty() -> Vec<Self>;
fn lex_cmp(&self, other: &Self) -> Ordering; fn zero() -> 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() -> Vec<Self> { ... }
fn unit_vecs_l1() -> Vec<Self> { ... } }
Expand description

Required traits and operations for vectors.

Associated Constants

The dimension of the vectors in this type.

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()));

The L1, taxicab or Manhatten norm.

The maximum, Chebychev or L∞ norm.

Creates a vector of the vectors with L∞ norm equal to 1.

These correspond to a single orthogonal or diagonal step.

Returns the lexicographic total ordering for this and another vector.

That is, the first different coordinate decides the ordering. This is useful as an arbitrary total ordering for sorting, but is not intended to be otherwise meaningful.

Provided methods

Creates the zero vector.

Returns true if a vector is the zero vector.

Apply min by component

Apply max by component

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.

Creates a vector of the unit vectors.

Creates a vector of the vectors to orthogonal neighbours.

These are the vectors with L1 norm equal to 1.

Implementors