[−][src]Struct vectrs::Vector
Represents a constant-size, n-dimensional vector.
See the crate root for usage examples.
Implementations
impl<T: Num, const N: usize> Vector<T, N> where
Self: X,
[src]
Self: X,
pub fn x(&self) -> T
[src]
Returns this component of the vector.
pub fn x_ref(&self) -> &T
[src]
Returns a reference to this component of the vector.
pub fn x_mut(&mut self) -> &mut T
[src]
Returns a mutable reference to this component of the vector.
impl<T: Num, const N: usize> Vector<T, N> where
Self: Y,
[src]
Self: Y,
pub fn y(&self) -> T
[src]
Returns this component of the vector.
pub fn y_ref(&self) -> &T
[src]
Returns a reference to this component of the vector.
pub fn y_mut(&mut self) -> &mut T
[src]
Returns a mutable reference to this component of the vector.
impl<T: Num, const N: usize> Vector<T, N> where
Self: Z,
[src]
Self: Z,
pub fn z(&self) -> T
[src]
Returns this component of the vector.
pub fn z_ref(&self) -> &T
[src]
Returns a reference to this component of the vector.
pub fn z_mut(&mut self) -> &mut T
[src]
Returns a mutable reference to this component of the vector.
impl<T: Num, const N: usize> Vector<T, N> where
Self: W,
[src]
Self: W,
pub fn w(&self) -> T
[src]
Returns this component of the vector.
pub fn w_ref(&self) -> &T
[src]
Returns a reference to this component of the vector.
pub fn w_mut(&mut self) -> &mut T
[src]
Returns a mutable reference to this component of the vector.
impl<T: Num, const N: usize> Vector<T, N>
[src]
pub const fn new(arr: [T; N]) -> Self
[src]
Create a new vector.
pub fn zero() -> Self
[src]
Returns a zero vector.
pub fn from_partial<U>(partial: U) -> Self where
Self: FromPartial<T, U>,
[src]
Self: FromPartial<T, U>,
Create a vector from various types, filling with zeroes as needed.
pub fn from_partial_with<U>(partial: U, fill: T) -> Self where
Self: FromPartial<T, U>,
[src]
Self: FromPartial<T, U>,
Create a vector from various types, filling with the given value as needed.
pub fn as_slice(&self) -> &[T]
[src]
Views the underlying vector representation as a slice.
pub fn as_mut_slice(&mut self) -> &mut [T]
[src]
Views the underlying vector representation as a mutable slice.
pub fn into_array(self) -> [T; N]
[src]
Consumes this vector and returns the underlying array.
pub fn abs(self) -> Self
[src]
Returns the absolute value of the vector.
pub fn reduced(self) -> Self
[src]
Returns the reduced row echelon form of the vector.
This is the same as dividing each element by the greatest common divisor of all the elements.
pub fn dot(&self, other: &Self) -> T
[src]
Calculates the dot-product between self
and other
.
pub fn l1_norm(&self) -> T
[src]
Returns the L1 norm of the vector.
Also known as Manhattan Distance or Taxicab norm. L1 Norm is the sum of the magnitudes of the vectors in a space.
Trait Implementations
impl<T: Num, const N: usize, '_> Add<&'_ Vector<T, N>> for Vector<T, N>
[src]
type Output = Vector<T, N>
The resulting type after applying the +
operator.
pub fn add(self, other: &Vector<T, N>) -> Self::Output
[src]
impl<T: Num, const N: usize, '_, '_> Add<&'_ Vector<T, N>> for &'_ Vector<T, N>
[src]
type Output = Vector<T, N>
The resulting type after applying the +
operator.
pub fn add(self, other: &Vector<T, N>) -> Self::Output
[src]
impl<T: Num, const N: usize> Add<Vector<T, N>> for Vector<T, N>
[src]
type Output = Vector<T, N>
The resulting type after applying the +
operator.
pub fn add(self, other: Vector<T, N>) -> Self::Output
[src]
impl<T: Num, const N: usize, '_> AddAssign<&'_ Vector<T, N>> for Vector<T, N>
[src]
pub fn add_assign(&mut self, other: &Vector<T, N>)
[src]
impl<T: Num, const N: usize> AddAssign<Vector<T, N>> for Vector<T, N>
[src]
pub fn add_assign(&mut self, other: Vector<T, N>)
[src]
impl<T: Clone, const N: usize> Clone for Vector<T, N>
[src]
impl<T: Copy, const N: usize> Copy for Vector<T, N>
[src]
impl<T: Debug, const N: usize> Debug for Vector<T, N>
[src]
impl<T: Num, const N: usize> Default for Vector<T, N>
[src]
impl<T, const N: usize> Deref for Vector<T, N>
[src]
impl<T, const N: usize> DerefMut for Vector<T, N>
[src]
impl<T: Eq, const N: usize> Eq for Vector<T, N>
[src]
impl<'a, T: Num, const N: usize> From<&'a [T]> for Vector<T, N>
[src]
impl<T, const N: usize> From<[T; N]> for Vector<T, N>
[src]
impl<T> From<(T, T, T, T, T, T, T, T, T, T, T, T)> for Vector<T, 12>
[src]
pub fn from(
(x, y, z, w, a, b, c, d, e, f, g, h): (T, T, T, T, T, T, T, T, T, T, T, T)
) -> Self
[src]
(x, y, z, w, a, b, c, d, e, f, g, h): (T, T, T, T, T, T, T, T, T, T, T, T)
) -> Self
impl<T> From<(T, T, T, T, T, T, T, T, T, T, T)> for Vector<T, 11>
[src]
impl<T> From<(T, T, T, T, T, T, T, T, T, T)> for Vector<T, 10>
[src]
impl<T> From<(T, T, T, T, T, T, T, T, T)> for Vector<T, 9>
[src]
impl<T> From<(T, T, T, T, T, T, T, T)> for Vector<T, 8>
[src]
impl<T> From<(T, T, T, T, T, T, T)> for Vector<T, 7>
[src]
impl<T> From<(T, T, T, T, T, T)> for Vector<T, 6>
[src]
impl<T> From<(T, T, T, T, T)> for Vector<T, 5>
[src]
impl<T> From<(T, T, T, T)> for Vector<T, 4>
[src]
impl<T> From<(T, T, T)> for Vector<T, 3>
[src]
impl<T> From<(T, T)> for Vector<T, 2>
[src]
impl<T> From<(T,)> for Vector<T, 1>
[src]
impl<T: Num, const N: usize> From<Vec<T, Global>> for Vector<T, N>
[src]
impl<T: Num, const N: usize> FromIterator<T> for Vector<T, N>
[src]
pub fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
[src]
impl<'a, T: Num, const N: usize> FromPartial<T, &'a [T]> for Vector<T, N>
[src]
pub fn from_partial(slice: &'a [T], fill: T) -> Self
[src]
impl<T: Num, const M: usize, const N: usize> FromPartial<T, [T; M]> for Vector<T, N>
[src]
pub fn from_partial(arr: [T; M], fill: T) -> Self
[src]
impl<T: Num, const N: usize> FromPartial<T, (T, T, T, T, T, T, T, T, T, T, T, T)> for Vector<T, N>
[src]
pub fn from_partial(
(x, y, z, w, a, b, c, d, e, f, g, h): (T, T, T, T, T, T, T, T, T, T, T, T),
fill: T
) -> Self
[src]
(x, y, z, w, a, b, c, d, e, f, g, h): (T, T, T, T, T, T, T, T, T, T, T, T),
fill: T
) -> Self
impl<T: Num, const N: usize> FromPartial<T, (T, T, T, T, T, T, T, T, T, T, T)> for Vector<T, N>
[src]
pub fn from_partial(
(x, y, z, w, a, b, c, d, e, f, g): (T, T, T, T, T, T, T, T, T, T, T),
fill: T
) -> Self
[src]
(x, y, z, w, a, b, c, d, e, f, g): (T, T, T, T, T, T, T, T, T, T, T),
fill: T
) -> Self
impl<T: Num, const N: usize> FromPartial<T, (T, T, T, T, T, T, T, T, T, T)> for Vector<T, N>
[src]
pub fn from_partial(
(x, y, z, w, a, b, c, d, e, f): (T, T, T, T, T, T, T, T, T, T),
fill: T
) -> Self
[src]
(x, y, z, w, a, b, c, d, e, f): (T, T, T, T, T, T, T, T, T, T),
fill: T
) -> Self
impl<T: Num, const N: usize> FromPartial<T, (T, T, T, T, T, T, T, T, T)> for Vector<T, N>
[src]
pub fn from_partial(
(x, y, z, w, a, b, c, d, e): (T, T, T, T, T, T, T, T, T),
fill: T
) -> Self
[src]
(x, y, z, w, a, b, c, d, e): (T, T, T, T, T, T, T, T, T),
fill: T
) -> Self
impl<T: Num, const N: usize> FromPartial<T, (T, T, T, T, T, T, T, T)> for Vector<T, N>
[src]
pub fn from_partial(
(x, y, z, w, a, b, c, d): (T, T, T, T, T, T, T, T),
fill: T
) -> Self
[src]
(x, y, z, w, a, b, c, d): (T, T, T, T, T, T, T, T),
fill: T
) -> Self
impl<T: Num, const N: usize> FromPartial<T, (T, T, T, T, T, T, T)> for Vector<T, N>
[src]
pub fn from_partial(
(x, y, z, w, a, b, c): (T, T, T, T, T, T, T),
fill: T
) -> Self
[src]
(x, y, z, w, a, b, c): (T, T, T, T, T, T, T),
fill: T
) -> Self
impl<T: Num, const N: usize> FromPartial<T, (T, T, T, T, T, T)> for Vector<T, N>
[src]
pub fn from_partial((x, y, z, w, a, b): (T, T, T, T, T, T), fill: T) -> Self
[src]
impl<T: Num, const N: usize> FromPartial<T, (T, T, T, T, T)> for Vector<T, N>
[src]
pub fn from_partial((x, y, z, w, a): (T, T, T, T, T), fill: T) -> Self
[src]
impl<T: Num, const N: usize> FromPartial<T, (T, T, T, T)> for Vector<T, N>
[src]
pub fn from_partial((x, y, z, w): (T, T, T, T), fill: T) -> Self
[src]
impl<T: Num, const N: usize> FromPartial<T, (T, T, T)> for Vector<T, N>
[src]
pub fn from_partial((x, y, z): (T, T, T), fill: T) -> Self
[src]
impl<T: Num, const N: usize> FromPartial<T, (T, T)> for Vector<T, N>
[src]
pub fn from_partial((x, y): (T, T), fill: T) -> Self
[src]
impl<T: Num, const N: usize> FromPartial<T, (T,)> for Vector<T, N>
[src]
pub fn from_partial((x): (T,), fill: T) -> Self
[src]
impl<T: Num, const N: usize> FromPartial<T, Vec<T, Global>> for Vector<T, N>
[src]
pub fn from_partial(vec: Vec<T>, fill: T) -> Self
[src]
impl<T: Hash, const N: usize> Hash for Vector<T, N>
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Num, const N: usize> IntoIterator for Vector<T, N>
[src]
type Item = T
The type of the elements being iterated over.
type IntoIter = IntoIter<T, N>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T: Num, const N: usize> Mul<&'a T> for Vector<T, N>
[src]
type Output = Vector<T, N>
The resulting type after applying the *
operator.
pub fn mul(self, other: &'a T) -> Self::Output
[src]
impl<'a, T: Num, const N: usize, '_> Mul<&'a T> for &'_ Vector<T, N>
[src]
type Output = Vector<T, N>
The resulting type after applying the *
operator.
pub fn mul(self, other: &'a T) -> Self::Output
[src]
impl<'a, T: Num, const N: usize> Mul<T> for Vector<T, N>
[src]
type Output = Vector<T, N>
The resulting type after applying the *
operator.
pub fn mul(self, other: T) -> Self::Output
[src]
impl<'a, T: Num, const N: usize, '_> Mul<T> for &'_ Vector<T, N>
[src]
type Output = Vector<T, N>
The resulting type after applying the *
operator.
pub fn mul(self, other: T) -> Self::Output
[src]
impl<T: Ord, const N: usize> Ord for Vector<T, N>
[src]
pub fn cmp(&self, other: &Vector<T, N>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq, const N: usize> PartialEq<Vector<T, N>> for Vector<T, N>
[src]
pub fn eq(&self, other: &Vector<T, N>) -> bool
[src]
pub fn ne(&self, other: &Vector<T, N>) -> bool
[src]
impl<T: PartialOrd, const N: usize> PartialOrd<Vector<T, N>> for Vector<T, N>
[src]
pub fn partial_cmp(&self, other: &Vector<T, N>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Vector<T, N>) -> bool
[src]
pub fn le(&self, other: &Vector<T, N>) -> bool
[src]
pub fn gt(&self, other: &Vector<T, N>) -> bool
[src]
pub fn ge(&self, other: &Vector<T, N>) -> bool
[src]
impl<T, const N: usize> StructuralEq for Vector<T, N>
[src]
impl<T, const N: usize> StructuralPartialEq for Vector<T, N>
[src]
impl<T: Num, const N: usize, '_> Sub<&'_ Vector<T, N>> for Vector<T, N>
[src]
type Output = Vector<T, N>
The resulting type after applying the -
operator.
pub fn sub(self, other: &Vector<T, N>) -> Self::Output
[src]
impl<T: Num, const N: usize, '_, '_> Sub<&'_ Vector<T, N>> for &'_ Vector<T, N>
[src]
type Output = Vector<T, N>
The resulting type after applying the -
operator.
pub fn sub(self, other: &Vector<T, N>) -> Self::Output
[src]
impl<T: Num, const N: usize> Sub<Vector<T, N>> for Vector<T, N>
[src]
type Output = Vector<T, N>
The resulting type after applying the -
operator.
pub fn sub(self, other: Vector<T, N>) -> Self::Output
[src]
impl<T: Num, const N: usize, '_> SubAssign<&'_ Vector<T, N>> for Vector<T, N>
[src]
pub fn sub_assign(&mut self, other: &Vector<T, N>)
[src]
impl<T: Num, const N: usize> SubAssign<Vector<T, N>> for Vector<T, N>
[src]
pub fn sub_assign(&mut self, other: Vector<T, N>)
[src]
Auto Trait Implementations
impl<T, const N: usize> RefUnwindSafe for Vector<T, N> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T, const N: usize> Send for Vector<T, N> where
T: Send,
[src]
T: Send,
impl<T, const N: usize> Sync for Vector<T, N> where
T: Sync,
[src]
T: Sync,
impl<T, const N: usize> Unpin for Vector<T, N> where
T: Unpin,
[src]
T: Unpin,
impl<T, const N: usize> UnwindSafe for Vector<T, N> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> 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.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,