[][src]Struct matmath::vector::Vector

pub struct Vector<T> { /* fields omitted */ }

A Vector with generic type items. Can be indexed by vector[i]

Methods

impl<T> Vector<T>[src]

pub fn new(coords: Vec<T>) -> Self[src]

Creates a new Vector with the given coordinates

pub fn dim(&self) -> usize[src]

Returns the amount of dimensions the Vector has

pub fn scaled<U, O>(self, scalar: U) -> Vector<O> where
    T: Mul<U, Output = O>,
    U: Clone
[src]

Multiplies the vector with a scalar

pub fn mag_sqr<O>(self) -> O where
    T: Mul<Output = O> + Clone,
    O: Add<Output = O> + MatrixElement
[src]

Returns the square of the Magnitude (also called Norm) of the Vector

pub fn mag<O, U: SquareRootable<Output = O>>(self) -> O where
    T: Mul<Output = U> + Clone,
    U: Add<Output = U> + MatrixElement
[src]

Returns the Magnitude (also called Norm) of the Vector

pub fn dot<U, O: Add<Output = O> + MatrixElement>(
    self,
    rhs: Vector<U>
) -> Result<O, DimensionsDontMatch<usize, usize>> where
    T: Mul<U, Output = O>, 
[src]

Returns the Dot Product of the Vector and rhs

pub fn map<F, U>(self, f: F) -> Vector<U> where
    F: Fn(T) -> U, 
[src]

Applies a function to every element of the vector

Trait Implementations

impl<T> Into<Vector<T>> for Vector2<T>[src]

impl<T> Into<Vector<T>> for Vector3<T>[src]

impl<T> Into<Vector<T>> for Vector4<T>[src]

impl<T> Into<Matrix<T>> for Vector<T>[src]

A Vector can be cast to a matrix and back

impl<T: Eq> Eq for Vector<T>[src]

impl<T: PartialEq> PartialEq<Vector<T>> for Vector<T>[src]

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

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

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

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

A Vector can be converted to a matrix and back

impl<T: Clone> Clone for Vector<T>[src]

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

Performs copy-assignment from source. Read more

impl<T> IntoIterator for Vector<T>[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?

impl<T: Display> Display for Vector<T>[src]

impl<T: Debug> Debug for Vector<T>[src]

impl<T: Add<U, Output = O>, U, O> Add<Vector<U>> for Vector<T>[src]

Adds two vectors element by element

type Output = Vector<O>

The resulting type after applying the + operator.

impl<T, U, O> Sub<Vector<U>> for Vector<T> where
    T: Sub<U, Output = O>, 
[src]

Subtracts two vectors element by element

type Output = Vector<O>

The resulting type after applying the - operator.

impl<T, U, O> Mul<Vector<U>> for Matrix<T> where
    T: Mul<U, Output = O> + Clone,
    U: Clone,
    O: Add<O, Output = O> + MatrixElement
[src]

Matrix-Vector Multiplication

type Output = Vector<O>

The resulting type after applying the * operator.

impl<T, O> Neg for Vector<T> where
    T: Neg<Output = O>, 
[src]

type Output = Vector<O>

The resulting type after applying the - operator.

impl<T> Index<usize> for Vector<T>[src]

type Output = T

The returned type after indexing.

impl<T> IndexMut<usize> for Vector<T>[src]

impl<T> FromIterator<T> for Vector<T>[src]

Auto Trait Implementations

impl<T> Send for Vector<T> where
    T: Send

impl<T> Sync for Vector<T> where
    T: Sync

Blanket Implementations

impl<T, U> Into 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> From for T[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.