[−][src]Struct matmath::vector::Vector
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]
T: Mul<U, Output = O>,
U: Clone,
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]
T: Mul<Output = O> + Clone,
O: Add<Output = O> + MatrixElement,
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]
T: Mul<Output = U> + Clone,
U: Add<Output = U> + MatrixElement,
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]
self,
rhs: Vector<U>
) -> Result<O, DimensionsDontMatch<usize, usize>> where
T: Mul<U, Output = O>,
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]
F: Fn(T) -> U,
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(&self) -> 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?
fn into_iter(self) -> Self::IntoIter
[src]
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.
fn add(self, rhs: Vector<U>) -> Vector<O>
[src]
impl<T, U, O> Sub<Vector<U>> for Vector<T> where
T: Sub<U, Output = O>,
[src]
T: Sub<U, Output = O>,
Subtracts two vectors element by element
type Output = Vector<O>
The resulting type after applying the -
operator.
fn sub(self, rhs: Vector<U>) -> Vector<O>
[src]
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]
T: Mul<U, Output = O> + Clone,
U: Clone,
O: Add<O, Output = O> + MatrixElement,
Matrix-Vector Multiplication
type Output = Vector<O>
The resulting type after applying the *
operator.
fn mul(self, rhs: Vector<U>) -> Vector<O>
[src]
impl<T, O> Neg for Vector<T> where
T: Neg<Output = O>,
[src]
T: Neg<Output = O>,
type Output = Vector<O>
The resulting type after applying the -
operator.
fn neg(self) -> Vector<O>
[src]
impl<T> Index<usize> for Vector<T>
[src]
impl<T> IndexMut<usize> for Vector<T>
[src]
impl<T> FromIterator<T> for Vector<T>
[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
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?
fn into_iter(self) -> I
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,