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]
Notable traits for &'_ [u8]
impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
;
fn as_mut_slice(&mut self) -> &mut [S]
Notable traits for &'_ [u8]
impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
;
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>
Notable traits for UnitVecs<S, V>
impl<S, V> Iterator for UnitVecs<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;
{ ... }
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

The default layout to use with this vector.

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

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.

Returns the L∞ norm of the vector.

This is also called the maximum or Chebychev norm.

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.

Returns the partial ordering by component of two vectors.

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.

Creates a vector of ones.

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.

Returns an iterator that yields the unit vectors.

Returns an iterator that yields the vectors to orthogonal neighbours.

These are the vectors with L1 norm equal to 1.

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

These correspond to a single orthogonal or diagonal step.

Implementors