Vector

Struct Vector 

Source
pub struct Vector<T, const N: usize> { /* private fields */ }
Expand description

Vector of fixed size.

Implementations§

Source§

impl<T, const N: usize> Vector<T, N>

Source

pub fn uninit() -> Vector<MaybeUninit<T>, N>

Create a vector with uninitialized content.

Source§

impl<T, const N: usize> Vector<MaybeUninit<T>, N>

Source

pub unsafe fn assume_init(self) -> Vector<T, N>

Assume that vector content is initialized.

Source§

impl<T, const N: usize> Vector<T, N>

Source

pub fn init<F: FnMut() -> T>(f: F) -> Self

Initialize a vector with values from closure.

Source§

impl<T, const N: usize> Vector<T, N>
where T: Default,

Source

pub fn new() -> Self

Create default vector.

Source§

impl<T, const N: usize> Vector<T, N>
where T: Copy,

Source

pub fn fill(v: T) -> Self

Create vector which elements are filled with scalar value.

Source§

impl<T, const N: usize> Vector<T, N>

Source

pub fn from_array(array: [T; N]) -> Self

Create from array.

Source

pub fn into_array(self) -> [T; N]

Convert to array.

Source

pub fn as_array(&self) -> &[T; N]

Get a reference to underlying array.

Source

pub fn as_mut_array(&mut self) -> &mut [T; N]

Get a mutable reference to underlying array.

Source§

impl<T, const N: usize> Vector<T, N>

Source

pub fn as_ptr(&self) -> *const T

Get pointer to the first element.

Source

pub fn as_mut_ptr(&mut self) -> *mut T

Get mutable pointer to the first element.

Source

pub unsafe fn get_unchecked(&self, i: usize) -> &T

Get reference to the elements without boundary checking.

Source

pub unsafe fn get_unchecked_mut(&mut self, i: usize) -> &mut T

Get mutable reference to the elements without boundary checking.

Source§

impl<T, const N: usize> Vector<T, N>

Source

pub fn iter(&self) -> Iter<'_, T>

Returns iterator over vector element refrences.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns iterator over vector element mutable refrences.

Source§

impl<T, const N: usize> Vector<T, N>

Source

pub fn try_from_iter<I>(iter: I) -> Option<Self>
where I: Iterator<Item = T>,

Try to conctruct a vector from iterator. If iterator conatains less items than vector, then Err is returned.

Source§

impl<const N: usize> Vector<usize, N>

Source

pub fn indices() -> Self

Create vector which element value equals to its position in vector.

Source§

impl<T, const N: usize> Vector<T, N>

Source

pub fn for_each<F: FnMut(T)>(self, f: F)

Call closure for each element of the vector passing it by value.

Source

pub fn map<U, F: FnMut(T) -> U>(self, f: F) -> Vector<U, N>

Map vector elements.

Source

pub fn zip<U>(self, other: Vector<U, N>) -> Vector<(T, U), N>

Zip two vectors into one.

Source

pub fn enumerate(self) -> Vector<(usize, T), N>

Enumerate vector elements.

Source§

impl<T, U, const N: usize> Vector<(T, U), N>

Source

pub fn unzip(self) -> (Vector<T, N>, Vector<U, N>)

Unzip vector of tuples into two vectors.

Source§

impl<T, const N: usize> Vector<T, N>

Source

pub fn fold<S, F: FnMut(S, T) -> S>(self, s: S, f: F) -> S

Source

pub fn fold_first<F: FnMut(T, T) -> T>(self, f: F) -> T

Source

pub fn scan<S, U, F: FnMut(&mut S, T) -> U>(self, s: S, f: F) -> Vector<U, N>

Source§

impl<T, const N: usize> Vector<T, N>
where T: Add<Output = T> + Mul<Output = T> + Copy,

Source

pub fn square_length(self) -> T

Source§

impl<T, const N: usize> Vector<T, N>
where T: Float,

Source

pub fn length(self) -> T

Source

pub fn normalize(self) -> Vector<T, N>

Source§

impl<T, const N: usize> Vector<T, N>

Source

pub fn sum(self) -> T
where T: Add<Output = T>,

Source

pub fn max(self) -> T
where T: PartialOrd,

Source

pub fn min(self) -> T
where T: PartialOrd,

Source§

impl<const N: usize> Vector<bool, N>

Source

pub fn any(self) -> bool

Source§

impl<const N: usize> Vector<bool, N>

Source

pub fn all(self) -> bool

Source§

impl<T, const N: usize> Vector<T, N>
where T: Integer,

Source

pub fn div_floor(self, other: Vector<T, N>) -> Vector<T, N>

Source

pub fn mod_floor(self, other: Vector<T, N>) -> Vector<T, N>

Source

pub fn div_mod_floor(self, other: Vector<T, N>) -> (Vector<T, N>, Vector<T, N>)

Source§

impl<T, const N: usize> Vector<T, N>
where T: PartialEq,

Source

pub fn veq(self, other: Vector<T, N>) -> Vector<bool, N>

Source

pub fn vne(self, other: Vector<T, N>) -> Vector<bool, N>

Source§

impl<T, const N: usize> Vector<T, N>
where T: PartialOrd,

Source

pub fn vlt(self, other: Vector<T, N>) -> Vector<bool, N>

Source

pub fn vle(self, other: Vector<T, N>) -> Vector<bool, N>

Source

pub fn vgt(self, other: Vector<T, N>) -> Vector<bool, N>

Source

pub fn vge(self, other: Vector<T, N>) -> Vector<bool, N>

Source§

impl<T> Vector<T, 2>
where T: Copy,

Source

pub fn x(&self) -> T

Source

pub fn y(&self) -> T

Source§

impl<T> Vector<T, 3>
where T: Copy,

Source

pub fn x(&self) -> T

Source

pub fn y(&self) -> T

Source

pub fn z(&self) -> T

Source§

impl<T> Vector<T, 4>
where T: Copy,

Source

pub fn x(&self) -> T

Source

pub fn y(&self) -> T

Source

pub fn z(&self) -> T

Source

pub fn w(&self) -> T

Source§

impl<T> Vector<T, 2>

Source

pub fn x_ref(&self) -> &T

Source

pub fn y_ref(&self) -> &T

Source

pub fn x_mut(&mut self) -> &mut T

Source

pub fn y_mut(&mut self) -> &mut T

Source§

impl<T> Vector<T, 3>

Source

pub fn x_ref(&self) -> &T

Source

pub fn y_ref(&self) -> &T

Source

pub fn z_ref(&self) -> &T

Source

pub fn x_mut(&mut self) -> &mut T

Source

pub fn y_mut(&mut self) -> &mut T

Source

pub fn z_mut(&mut self) -> &mut T

Source§

impl<T> Vector<T, 4>

Source

pub fn x_ref(&self) -> &T

Source

pub fn y_ref(&self) -> &T

Source

pub fn z_ref(&self) -> &T

Source

pub fn w_ref(&self) -> &T

Source

pub fn x_mut(&mut self) -> &mut T

Source

pub fn y_mut(&mut self) -> &mut T

Source

pub fn z_mut(&mut self) -> &mut T

Source

pub fn w_mut(&mut self) -> &mut T

Source§

impl<T> Vector<T, 2>
where T: Mul<Output = T> + Sub<Output = T> + Copy,

Source

pub fn cross(self, other: Vector<T, 2>) -> T

Pseudo-cross product for 2D vector.

Source§

impl<T> Vector<T, 3>
where T: Mul<Output = T> + Sub<Output = T> + Copy,

Source

pub fn cross(self, other: Vector<T, 3>) -> Vector<T, 3>

Cross product.

Source§

impl<T> Vector<T, 4>
where T: Mul<Output = T> + Sub<Output = T> + Zero + Copy,

Source

pub fn cross(self, other: Vector<T, 4>) -> Vector<T, 4>

Cross product of first three components, fourth one is set to zero.

Source§

impl<T> Vector<T, 2>

Source

pub fn from_tuple((x, y): (T, T)) -> Self

Source

pub fn into_tuple(self) -> (T, T)

Source§

impl<T> Vector<T, 3>

Source

pub fn from_tuple((x, y, z): (T, T, T)) -> Self

Source

pub fn into_tuple(self) -> (T, T, T)

Source§

impl<T> Vector<T, 4>

Source

pub fn from_tuple((x, y, z, w): (T, T, T, T)) -> Self

Source

pub fn into_tuple(self) -> (T, T, T, T)

Source§

impl<T: Float, const N: usize> Vector<T, N>

Source

pub fn abs(self) -> Self

Source

pub fn abs_sub<B: Broadcast<Self>>(self, other: B) -> Self

Source

pub fn signum(self) -> Self

Source

pub fn cbrt(self) -> Self

Source

pub fn sqrt(self) -> Self

Source

pub fn vmin<B: Broadcast<Self>>(self, other: B) -> Self

Source

pub fn vmax<B: Broadcast<Self>>(self, other: B) -> Self

Source

pub fn clamp<A: Broadcast<Self>, B: Broadcast<Self>>(self, a: A, b: B) -> Self

Source

pub fn acos(self) -> Self

Source

pub fn asin(self) -> Self

Source

pub fn atan(self) -> Self

Source

pub fn atan2<B: Broadcast<Self>>(self, other: B) -> Self

Source

pub fn cosh(self) -> Self

Source

pub fn hypot<B: Broadcast<Self>>(self, other: B) -> Self

Source

pub fn sinh(self) -> Self

Source

pub fn tan(self) -> Self

Source

pub fn tanh(self) -> Self

Source

pub fn log2(self) -> Self

Source

pub fn mul_add<A: Broadcast<Self>, B: Broadcast<Self>>(self, a: A, b: B) -> Self

Source

pub fn exp(self) -> Self

Source

pub fn powi<B: Broadcast<Vector<i32, N>>>(self, other: B) -> Self

Source

pub fn ln(self) -> Self

Source

pub fn powf<B: Broadcast<Self>>(self, other: B) -> Self

Source

pub fn log<B: Broadcast<Self>>(self, other: B) -> Self

Source

pub fn sin(self) -> Self

Source

pub fn cos(self) -> Self

Source

pub fn asinh(self) -> Self

Source

pub fn acosh(self) -> Self

Source

pub fn atanh(self) -> Self

Source

pub fn floor(self) -> Self

Source

pub fn ceil(self) -> Self

Source

pub fn round(self) -> Self

Source

pub fn trunc(self) -> Self

Source

pub fn fract(self) -> Self

Source

pub fn recip(self) -> Self

Source

pub fn exp2(self) -> Self

Source

pub fn log10(self) -> Self

Source

pub fn sin_cos(self) -> (Self, Self)

Source

pub fn exp_m1(self) -> Self

Source

pub fn ln_1p(self) -> Self

Trait Implementations§

Source§

impl<T, const N: usize> AbsDiffEq for Vector<T, N>
where T: AbsDiffEq<Epsilon = T> + Copy,

Source§

type Epsilon = T

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
Source§

impl<T, const N: usize> Add for Vector<T, N>
where T: Add<Output = T>,

Source§

type Output = Vector<T, N>

The resulting type after applying the + operator.
Source§

fn add(self, vec: Vector<T, N>) -> Self::Output

Performs the + operation. Read more
Source§

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

Source§

fn add_assign(&mut self, vec: Vector<T, N>)

Performs the += operation. Read more
Source§

impl<T, const N: usize> AsMut<[T; N]> for Vector<T, N>

Source§

fn as_mut(&mut self) -> &mut [T; N]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T, const M: usize, const N: usize> AsMut<Vector<Vector<T, N>, M>> for Matrix<T, M, N>

Source§

fn as_mut(&mut self) -> &mut Vector<Vector<T, N>, M>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T, const N: usize> AsRef<[T; N]> for Vector<T, N>

Source§

fn as_ref(&self) -> &[T; N]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T, const M: usize, const N: usize> AsRef<Vector<Vector<T, N>, M>> for Matrix<T, M, N>

Source§

fn as_ref(&self) -> &Vector<Vector<T, N>, M>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T, const N: usize> BitAnd for Vector<T, N>
where T: BitAnd<Output = T>,

Source§

type Output = Vector<T, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: Vector<T, N>) -> Self::Output

Performs the & operation. Read more
Source§

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

Source§

fn bitand_assign(&mut self, other: Vector<T, N>)

Performs the &= operation. Read more
Source§

impl<T, const N: usize> BitOr for Vector<T, N>
where T: BitOr<Output = T>,

Source§

type Output = Vector<T, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Vector<T, N>) -> Self::Output

Performs the | operation. Read more
Source§

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

Source§

fn bitor_assign(&mut self, other: Vector<T, N>)

Performs the |= operation. Read more
Source§

impl<T, const N: usize> BitXor for Vector<T, N>
where T: BitXor<Output = T>,

Source§

type Output = Vector<T, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: Vector<T, N>) -> Self::Output

Performs the ^ operation. Read more
Source§

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

Source§

fn bitxor_assign(&mut self, other: Vector<T, N>)

Performs the ^= operation. Read more
Source§

impl<T: Copy, const M: usize, const N: usize> Broadcast<Matrix<T, M, N>> for Vector<T, N>

Source§

fn broadcast(self) -> Matrix<T, M, N>

Copy values along axes to get V.
Source§

impl<T, const N: usize> Broadcast<Vector<T, N>> for Vector<T, N>

Source§

fn broadcast(self) -> Self

Copy values along axes to get V.
Source§

impl<T: Clone, const N: usize> Clone for Vector<T, N>

Source§

fn clone(&self) -> Vector<T, N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
Source§

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

Source§

fn default() -> Self

Create vector filled with default values.

Source§

impl<T> Directional<Vector<T, 2>> for Rotation2<T>
where Self: Transform<Vector<T, 2>>,

Source§

fn apply_dir(&self, pos: Vector<T, 2>, dir: Vector<T, 2>) -> Vector<T, 2>

Returns the result of the direction transformation at the specified position.
Source§

fn apply_normal(&self, pos: Vector<T, 2>, normal: Vector<T, 2>) -> Vector<T, 2>

Returns the result of the normal transformation at the specified position. Read more
Source§

impl<T> Directional<Vector<T, 3>> for Rotation3<T>
where Self: Transform<Vector<T, 3>>,

Source§

fn apply_dir(&self, pos: Vector<T, 3>, dir: Vector<T, 3>) -> Vector<T, 3>

Returns the result of the direction transformation at the specified position.
Source§

fn apply_normal(&self, pos: Vector<T, 3>, normal: Vector<T, 3>) -> Vector<T, 3>

Returns the result of the normal transformation at the specified position. Read more
Source§

impl<T, const N: usize> Directional<Vector<T, N>> for Linear<T, N>
where Self: Transform<Vector<T, N>>, T: Neg<Output = T> + Num + Copy, Vector<T, N>: Normalize, Matrix<T, N, N>: Inv<Output = Matrix<T, N, N>>,

Source§

fn apply_dir(&self, pos: Vector<T, N>, dir: Vector<T, N>) -> Vector<T, N>

Returns the result of the direction transformation at the specified position.
Source§

fn apply_normal(&self, _: Vector<T, N>, normal: Vector<T, N>) -> Vector<T, N>

Returns the result of the normal transformation at the specified position. Read more
Source§

impl<T, const N: usize> Directional<Vector<T, N>> for Scale<T>
where Self: Transform<Vector<T, N>>,

Source§

fn apply_dir(&self, _: Vector<T, N>, dir: Vector<T, N>) -> Vector<T, N>

Returns the result of the direction transformation at the specified position.
Source§

fn apply_normal(&self, _: Vector<T, N>, normal: Vector<T, N>) -> Vector<T, N>

Returns the result of the normal transformation at the specified position. Read more
Source§

impl<T, const N: usize> Directional<Vector<T, N>> for Shift<T, N>
where Self: Transform<Vector<T, N>>,

Source§

fn apply_dir(&self, _: Vector<T, N>, dir: Vector<T, N>) -> Vector<T, N>

Returns the result of the direction transformation at the specified position.
Source§

fn apply_normal(&self, _: Vector<T, N>, normal: Vector<T, N>) -> Vector<T, N>

Returns the result of the normal transformation at the specified position. Read more
Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
Source§

impl<T: Float, const N: usize> Distribution<Vector<T, N>> for NonZero
where Normal: Distribution<Vector<T, N>>,

Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

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

Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl<T: Float, const N: usize> Distribution<Vector<T, N>> for Unit
where NonZero: Distribution<Vector<T, N>>,

Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl<D: Distribution<T>, T, const N: usize> Distribution<Vector<T, N>> for VectorDistribution<D, T, N>

Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl<T, const N: usize> Div<T> for Vector<T, N>
where T: Div<Output = T> + Copy,

Source§

type Output = Vector<T, N>

The resulting type after applying the / operator.
Source§

fn div(self, a: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T, const N: usize> Div for Vector<T, N>
where T: Div<Output = T>,

Source§

type Output = Vector<T, N>

The resulting type after applying the / operator.
Source§

fn div(self, vec: Vector<T, N>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T, const N: usize> DivAssign<T> for Vector<T, N>
where T: DivAssign + Copy,

Source§

fn div_assign(&mut self, a: T)

Performs the /= operation. Read more
Source§

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

Source§

fn div_assign(&mut self, vec: Vector<T, N>)

Performs the /= operation. Read more
Source§

impl<T, const M: usize, const N: usize> Dot<Matrix<T, M, N>> for Vector<T, M>
where T: Mul<Output = T> + Add<Output = T> + Copy,

Source§

type Output = Vector<T, N>

Dot product output type.
Source§

fn dot(self, mat: Matrix<T, M, N>) -> Self::Output

Perform dot product.
Source§

impl<T, const M: usize, const N: usize> Dot<Vector<T, N>> for Matrix<T, M, N>
where T: Mul<Output = T> + Add<Output = T> + Copy,

Source§

type Output = Vector<T, M>

Dot product output type.
Source§

fn dot(self, vec: Vector<T, N>) -> Self::Output

Perform dot product.
Source§

impl<T, const N: usize> Dot for Vector<T, N>
where T: Mul<Output = T> + Add<Output = T>,

Source§

type Output = T

Dot product output type.
Source§

fn dot(self, other: Vector<T, N>) -> Self::Output

Perform dot product.
Source§

impl<T, const N: usize> From<&[T; N]> for Vector<T, N>
where T: Copy,

Source§

fn from(ar: &[T; N]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, const M: usize, const N: usize> From<&'a Matrix<T, M, N>> for &'a Vector<Vector<T, N>, M>

Source§

fn from(mr: &'a Matrix<T, M, N>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, const N: usize> From<&'a Vector<T, N>> for &'a [T; N]

Source§

fn from(vr: &'a Vector<T, N>) -> Self

Converts to this type from the input type.
Source§

impl<T, const M: usize, const N: usize> From<&Vector<Vector<T, N>, M>> for Matrix<T, M, N>
where T: Copy,

Source§

fn from(ar: &Vector<Vector<T, N>, M>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, const M: usize, const N: usize> From<&'a mut Matrix<T, M, N>> for &'a mut Vector<Vector<T, N>, M>

Source§

fn from(mr: &'a mut Matrix<T, M, N>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, const N: usize> From<&'a mut Vector<T, N>> for &'a mut [T; N]

Source§

fn from(vr: &'a mut Vector<T, N>) -> Self

Converts to this type from the input type.
Source§

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

Source§

fn from(a: [T; N]) -> Self

Converts to this type from the input type.
Source§

impl<T> From<(T, T)> for Vector<T, 2>

Source§

fn from(tuple: (T, T)) -> Self

Converts to this type from the input type.
Source§

impl<T> From<(T, T, T)> for Vector<T, 3>

Source§

fn from(tuple: (T, T, T)) -> Self

Converts to this type from the input type.
Source§

impl<T> From<(T, T, T, T)> for Vector<T, 4>

Source§

fn from(tuple: (T, T, T, T)) -> Self

Converts to this type from the input type.
Source§

impl<T, const M: usize, const N: usize> From<Matrix<T, M, N>> for Vector<Vector<T, N>, M>

Source§

fn from(mat: Matrix<T, M, N>) -> Self

Converts to this type from the input type.
Source§

impl<T, const N: usize> From<Shift<T, N>> for Vector<T, N>

Source§

fn from(shift: Shift<T, N>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Vector<T, 2>> for (T, T)

Source§

fn from(vec: Vector<T, 2>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Vector<T, 2>> for Complex<T>

Source§

fn from(vec: Vector2<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Vector<T, 3>> for (T, T, T)

Source§

fn from(vec: Vector<T, 3>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Vector<T, 4>> for (T, T, T, T)

Source§

fn from(vec: Vector<T, 4>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Vector<T, 4>> for Quaternion<T>

Source§

fn from(vec: Vector4<T>) -> Self

Converts to this type from the input type.
Source§

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

Source§

fn from(vec: Vector<T, N>) -> Self

Converts to this type from the input type.
Source§

impl<T, const N: usize> From<Vector<T, N>> for Shift<T, N>

Source§

fn from(pos: Vector<T, N>) -> Self

Converts to this type from the input type.
Source§

impl<T, const M: usize, const N: usize> From<Vector<Vector<T, N>, M>> for Matrix<T, M, N>

Source§

fn from(a: Vector<Vector<T, N>, M>) -> Self

Converts to this type from the input type.
Source§

impl<T, const N: usize> Index<usize> for Vector<T, N>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, i: usize) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T, const N: usize> IndexMut<usize> for Vector<T, N>

Source§

fn index_mut(&mut self, i: usize) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, T, const N: usize> IntoIterator for &'a Vector<T, N>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T, const N: usize> IntoIterator for &'a mut Vector<T, N>

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T, const N: usize> IntoIterator for Vector<T, N>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T, N>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T, const N: usize> Mul<T> for Vector<T, N>
where T: Mul<Output = T> + Copy,

Source§

type Output = Vector<T, N>

The resulting type after applying the * operator.
Source§

fn mul(self, a: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Vector<f32, N>> for f32

Workaround for reverse multiplication.

Source§

type Output = Vector<f32, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector<f32, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Vector<f64, N>> for f64

Workaround for reverse multiplication.

Source§

type Output = Vector<f64, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector<f64, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Vector<i16, N>> for i16

Workaround for reverse multiplication.

Source§

type Output = Vector<i16, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector<i16, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Vector<i32, N>> for i32

Workaround for reverse multiplication.

Source§

type Output = Vector<i32, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector<i32, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Vector<i64, N>> for i64

Workaround for reverse multiplication.

Source§

type Output = Vector<i64, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector<i64, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Vector<i8, N>> for i8

Workaround for reverse multiplication.

Source§

type Output = Vector<i8, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector<i8, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Vector<u16, N>> for u16

Workaround for reverse multiplication.

Source§

type Output = Vector<u16, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector<u16, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Vector<u32, N>> for u32

Workaround for reverse multiplication.

Source§

type Output = Vector<u32, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector<u32, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Vector<u64, N>> for u64

Workaround for reverse multiplication.

Source§

type Output = Vector<u64, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector<u64, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Vector<u8, N>> for u8

Workaround for reverse multiplication.

Source§

type Output = Vector<u8, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector<u8, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, const N: usize> Mul for Vector<T, N>
where T: Mul<Output = T>,

Source§

type Output = Vector<T, N>

The resulting type after applying the * operator.
Source§

fn mul(self, vec: Vector<T, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, const N: usize> MulAssign<T> for Vector<T, N>
where T: MulAssign + Copy,

Source§

fn mul_assign(&mut self, a: T)

Performs the *= operation. Read more
Source§

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

Source§

fn mul_assign(&mut self, vec: Vector<T, N>)

Performs the *= operation. Read more
Source§

impl<T, const N: usize> Neg for Vector<T, N>
where T: Neg<Output = T>,

Source§

type Output = Vector<T, N>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T, const N: usize> NormL1 for Vector<T, N>
where T: NormL1<Output = T> + Add<Output = T>,

Source§

type Output = T

Type of the norm.
Source§

fn norm_l1(self) -> T

Norm of the element.
Source§

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

Source§

type Output = T

Type of the norm.
Source§

fn norm_l2_sqr(self) -> T

Square norm of the element.
Source§

fn norm_l2(self) -> T

Norm of the element.
Source§

impl<T, const N: usize> NormLInf for Vector<T, N>
where T: NormLInf<Output = T> + PartialOrd,

Source§

type Output = T

Type of the norm.
Source§

fn norm_l_inf(self) -> T

Norm of the element.
Source§

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

Source§

fn normalize(self) -> Self

Normalize object.
Source§

impl<T, const N: usize> Not for Vector<T, N>
where T: Not<Output = T>,

Source§

type Output = Vector<T, N>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T, const M: usize, const N: usize> Outer<Vector<T, N>> for Vector<T, M>
where T: Mul<Output = T> + Copy,

Source§

type Output = Matrix<T, M, N>

Outer product output type.
Source§

fn outer(self, other: Vector<T, N>) -> Self::Output

Perform outer product.
Source§

impl<T: PartialEq, const N: usize> PartialEq for Vector<T, N>

Source§

fn eq(&self, other: &Vector<T, N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: One + Mul, const N: usize> Product for Vector<T, N>

Source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<T, const N: usize> Rem<T> for Vector<T, N>
where T: Rem<Output = T> + Copy,

Source§

type Output = Vector<T, N>

The resulting type after applying the % operator.
Source§

fn rem(self, a: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T, const N: usize> Rem for Vector<T, N>
where T: Rem<Output = T>,

Source§

type Output = Vector<T, N>

The resulting type after applying the % operator.
Source§

fn rem(self, vec: Vector<T, N>) -> Self::Output

Performs the % operation. Read more
Source§

impl<T, const N: usize> RemAssign<T> for Vector<T, N>
where T: RemAssign + Copy,

Source§

fn rem_assign(&mut self, a: T)

Performs the %= operation. Read more
Source§

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

Source§

fn rem_assign(&mut self, vec: Vector<T, N>)

Performs the %= operation. Read more
Source§

impl<T, const N: usize> Reorder<Linear<T, N>, Vector<T, N>> for Shift<T, N>
where Linear<T, N>: Transform<Vector<T, N>> + Copy, Self: Transform<Vector<T, N>>,

Source§

fn reorder(self, other: Linear<T, N>) -> (Linear<T, N>, Shift<T, N>)

For given A and B returns B' and A'.
Source§

impl<T> Reorder<Rotation2<T>, Vector<T, 2>> for Shift<T, 2>
where Rotation2<T>: Transform<Vector<T, 2>> + Copy, Self: Transform<Vector<T, 2>>,

Source§

fn reorder(self, other: Rotation2<T>) -> (Rotation2<T>, Shift<T, 2>)

For given A and B returns B' and A'.
Source§

impl<T> Reorder<Rotation3<T>, Vector<T, 3>> for Shift<T, 3>
where Rotation3<T>: Transform<Vector<T, 3>> + Copy, Self: Transform<Vector<T, 3>>,

Source§

fn reorder(self, other: Rotation3<T>) -> (Rotation3<T>, Shift<T, 3>)

For given A and B returns B' and A'.
Source§

impl<T, const N: usize> Reorder<Scale<T>, Vector<T, N>> for Shift<T, N>
where Scale<T>: Transform<Vector<T, N>> + Copy, Self: Transform<Vector<T, N>>,

Source§

fn reorder(self, other: Scale<T>) -> (Scale<T>, Shift<T, N>)

For given A and B returns B' and A'.
Source§

impl<T> Reorder<Shift<T, 2>, Vector<T, 2>> for Rotation2<T>
where Self: Transform<Vector<T, 2>>, Shift<T, 2>: Transform<Vector<T, 2>>,

Source§

fn reorder(self, other: Shift<T, 2>) -> (Shift<T, 2>, Rotation2<T>)

For given A and B returns B' and A'.
Source§

impl<T> Reorder<Shift<T, 3>, Vector<T, 3>> for Rotation3<T>
where Self: Transform<Vector<T, 3>>, Shift<T, 3>: Transform<Vector<T, 3>>,

Source§

fn reorder(self, other: Shift<T, 3>) -> (Shift<T, 3>, Rotation3<T>)

For given A and B returns B' and A'.
Source§

impl<T, const N: usize> Reorder<Shift<T, N>, Vector<T, N>> for Linear<T, N>
where Self: Transform<Vector<T, N>>, Shift<T, N>: Transform<Vector<T, N>>,

Source§

fn reorder(self, other: Shift<T, N>) -> (Shift<T, N>, Linear<T, N>)

For given A and B returns B' and A'.
Source§

impl<T, const N: usize> Reorder<Shift<T, N>, Vector<T, N>> for Scale<T>
where Self: Transform<Vector<T, N>>, Shift<T, N>: Transform<Vector<T, N>>,

Source§

fn reorder(self, other: Shift<T, N>) -> (Shift<T, N>, Scale<T>)

For given A and B returns B' and A'.
Source§

impl<T, const N: usize> Sub for Vector<T, N>
where T: Sub<Output = T>,

Source§

type Output = Vector<T, N>

The resulting type after applying the - operator.
Source§

fn sub(self, vec: Vector<T, N>) -> Self::Output

Performs the - operation. Read more
Source§

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

Source§

fn sub_assign(&mut self, vec: Vector<T, N>)

Performs the -= operation. Read more
Source§

impl<T: Zero + Add, const N: usize> Sum for Vector<T, N>

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<T> Transform<Vector<T, 2>> for Rotation2<T>
where T: Neg<Output = T> + Num + Copy,

Source§

fn identity() -> Self

Identity transformation.
Source§

fn inv(self) -> Self

Inverse transformation.
Source§

fn apply(&self, pos: Vector<T, 2>) -> Vector<T, 2>

Perform the transformation itself.
Source§

fn deriv(&self, _pos: Vector<T, 2>, dir: Vector<T, 2>) -> Vector<T, 2>

Find transformation directional derivative at specified point.
Source§

fn chain(self, other: Self) -> Self

Chain two transformations into a new one. Read more
Source§

impl<T> Transform<Vector<T, 3>> for Rotation3<T>
where T: Neg<Output = T> + Num + Copy,

Source§

fn identity() -> Self

Identity transformation.
Source§

fn inv(self) -> Self

Inverse transformation.
Source§

fn apply(&self, pos: Vector<T, 3>) -> Vector<T, 3>

Perform the transformation itself.
Source§

fn deriv(&self, _pos: Vector<T, 3>, dir: Vector<T, 3>) -> Vector<T, 3>

Find transformation directional derivative at specified point.
Source§

fn chain(self, other: Self) -> Self

Chain two transformations into a new one. Read more
Source§

impl<T, const N: usize> Transform<Vector<T, N>> for Linear<T, N>
where T: Neg<Output = T> + Num + Copy,

Source§

fn identity() -> Self

Identity transformation.
Source§

fn inv(self) -> Self

Inverse transformation.
Source§

fn apply(&self, pos: Vector<T, N>) -> Vector<T, N>

Perform the transformation itself.
Source§

fn deriv(&self, _pos: Vector<T, N>, dir: Vector<T, N>) -> Vector<T, N>

Find transformation directional derivative at specified point.
Source§

fn chain(self, other: Self) -> Self

Chain two transformations into a new one. Read more
Source§

impl<T, const N: usize> Transform<Vector<T, N>> for Scale<T>
where T: Num + Inv<Output = T> + Copy,

Source§

fn identity() -> Self

Identity transformation.
Source§

fn inv(self) -> Self

Inverse transformation.
Source§

fn apply(&self, pos: Vector<T, N>) -> Vector<T, N>

Perform the transformation itself.
Source§

fn deriv(&self, _pos: Vector<T, N>, dir: Vector<T, N>) -> Vector<T, N>

Find transformation directional derivative at specified point.
Source§

fn chain(self, other: Self) -> Self

Chain two transformations into a new one. Read more
Source§

impl<T, const N: usize> Transform<Vector<T, N>> for Shift<T, N>
where T: Neg<Output = T> + Num + Copy,

Source§

fn identity() -> Self

Identity transformation.
Source§

fn inv(self) -> Self

Inverse transformation.
Source§

fn apply(&self, pos: Vector<T, N>) -> Vector<T, N>

Perform the transformation itself.
Source§

fn deriv(&self, _pos: Vector<T, N>, dir: Vector<T, N>) -> Vector<T, N>

Find transformation directional derivative at specified point.
Source§

fn chain(self, other: Self) -> Self

Chain two transformations into a new one. Read more
Source§

impl<'a, T, const N: usize> TryFrom<&'a [T]> for Vector<T, N>
where T: Copy,

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(s: &'a [T]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl<T: Copy, const N: usize> Copy for Vector<T, N>

Source§

impl<T, const N: usize> StructuralPartialEq for Vector<T, N>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, const M: usize, const N: usize> Broadcast<Matrix<T, M, N>> for T
where T: Copy,

Source§

fn broadcast(self) -> Matrix<T, M, N>

Copy values along axes to get V.
Source§

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

Source§

fn broadcast(self) -> Vector<T, N>

Copy values along axes to get V.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,