[][src]Struct aljabar::Vector

pub struct Vector<T, const N: usize>(_);

N-element vector.

Vectors can be constructed from arrays of any type and size. There are convenience constructor functions provided for the most common sizes.

Methods

impl<T, const N: usize> Vector<T, { N }>[src]

pub fn trunc(self) -> (TruncatedVector<T, { N }>, T)[src]

Drop the last component and return the vector with one fewer dimension.

Trait Implementations

impl<T, const N: usize> Zero for Vector<T, { N }> where
    T: Zero
[src]

impl<T, const N: usize> VectorSpace for Vector<T, { N }> where
    T: Clone + Zero,
    T: Add<T, Output = T>,
    T: Sub<T, Output = T>,
    T: Mul<T, Output = T>,
    T: Div<T, Output = T>, 
[src]

type Scalar = T

impl<T, const N: usize> MetricSpace for Vector<T, { N }> where
    Self: InnerSpace
[src]

type Metric = Self::Scalar

impl<T, const N: usize> InnerSpace for Vector<T, { N }> where
    T: Clone + Zero,
    T: Add<T, Output = T>,
    T: Sub<T, Output = T>,
    T: Mul<T, Output = T>,
    T: Div<T, Output = T>,
    T: AddAssign<T>,
    Self: Clone
[src]

fn magnitude2(self) -> Self::Scalar[src]

Returns the squared length of the value.

impl<T, const N: usize> Clone for Vector<T, { N }> where
    T: Clone
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T, const N: usize> Copy for Vector<T, { N }> where
    T: Copy
[src]

impl<T, const N: usize> From<[T; N]> for Vector<T, { N }>[src]

impl<T, const N: usize> Into<[T; N]> for Vector<T, { N }>[src]

impl<A, B, RHS, const N: usize> PartialEq<RHS> for Vector<A, { N }> where
    RHS: Deref<Target = [B; {N}]>,
    A: PartialEq<B>, 
[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl<T, const N: usize> Eq for Vector<T, { N }> where
    T: Eq
[src]

impl<T, const N: usize> Debug for Vector<T, { N }> where
    T: Debug
[src]

impl<A, B, const N: usize> Div<B> for Vector<A, { N }> where
    A: Div<B>,
    B: Clone
[src]

Scalar divide

type Output = Vector<<A as Div<B>>::Output, { N }>

The resulting type after applying the / operator.

impl<A, B, const N: usize> Add<Vector<B, N>> for Vector<A, { N }> where
    A: Add<B>, 
[src]

type Output = Vector<<A as Add<B>>::Output, { N }>

The resulting type after applying the + operator.

impl<A, B, const N: usize> Sub<Vector<B, N>> for Vector<A, { N }> where
    A: Sub<B>, 
[src]

type Output = Vector<<A as Sub<B>>::Output, { N }>

The resulting type after applying the - operator.

impl<A, B, const N: usize> Mul<B> for Vector<A, { N }> where
    A: Mul<B>,
    B: Clone
[src]

Scalar multiply

type Output = Vector<<A as Mul<B>>::Output, { N }>

The resulting type after applying the * operator.

impl<T, const N: usize, const M: usize> Mul<Vector<T, M>> for Matrix<T, { N }, { M }> where
    T: Add<T, Output = T> + Mul<T, Output = T> + Clone,
    Vector<T, { M }>: InnerSpace
[src]

type Output = Vector<<Vector<T, { M }> as VectorSpace>::Scalar, { N }>

The resulting type after applying the * operator.

impl<T, const N: usize> Neg for Vector<T, { N }> where
    T: Neg
[src]

type Output = Vector<<T as Neg>::Output, { N }>

The resulting type after applying the - operator.

impl<A, B, const N: usize> AddAssign<Vector<B, N>> for Vector<A, { N }> where
    A: AddAssign<B>, 
[src]

impl<A, B, const N: usize> SubAssign<Vector<B, N>> for Vector<A, { N }> where
    A: SubAssign<B>, 
[src]

impl<A, B, const N: usize> MulAssign<B> for Vector<A, { N }> where
    A: MulAssign<B>,
    B: Clone
[src]

Scalar multiply assign

impl<A, B, const N: usize> DivAssign<B> for Vector<A, { N }> where
    A: DivAssign<B>,
    B: Clone
[src]

Scalar divide assign

impl<T, const N: usize> Deref for Vector<T, { N }>[src]

type Target = [T; {N}]

The resulting type after dereferencing.

impl<T, const N: usize> DerefMut for Vector<T, { N }>[src]

Auto Trait Implementations

impl<const N: usize, T> Sync for Vector<T, N> where
    T: Sync

impl<const N: usize, T> Unpin for Vector<T, N> where
    T: Unpin

impl<const N: usize, T> Send for Vector<T, N> where
    T: Send

impl<const N: usize, T> UnwindSafe for Vector<T, N> where
    T: UnwindSafe

impl<const N: usize, T> RefUnwindSafe for Vector<T, N> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> RealMetricSpace for T where
    T: MetricSpace,
    <T as MetricSpace>::Metric: Real
[src]

fn distance(self, other: Self) -> Self::Metric[src]

Returns the distance between the two values.

impl<T> RealInnerSpace for T where
    T: InnerSpace,
    <T as VectorSpace>::Scalar: Real
[src]

fn magnitude(self) -> Self::Scalar[src]

Returns the length of the vector.

fn normalize(self) -> Self where
    Self::Scalar: One
[src]

Returns a vector with the same direction and a magnitude of 1.

fn normalize_to(self, magnitude: Self::Scalar) -> Self[src]

Returns a vector with the same direction and a given magnitude.

fn project_on(self, other: Self) -> Self[src]

Returns the vector projection of the current inner space projected onto the supplied argument. Read more

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]