Struct Vector

Source
#[repr(align(16))]
pub struct Vector<T, const N: usize> { /* private fields */ }
Expand description

a const-sized vector of elements, supports all math operations that T does on an element-by-element basis.

can be iterated over using .into_iter() on Vector or &Vector can be constructed from iterators using collect().

is repr(align(16)) for simd

Implementations§

Source§

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

Source

pub fn ascend(self) -> Vector<Self, 1>

Source§

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

Source

pub fn transpose(&self) -> TransposedMatrixView<'_, T, N, M>

Source§

impl<'a, 'b, T, const M: usize, const N: usize> Vector<Vector<T, M>, N>
where &'a T: Mul<&'b T, Output = T>, T: Sum + 'a + 'b + Clone + Copy + Default,

Source

pub fn matrix_multiply<const O: usize>( &'a self, other: &'b Matrix<T, N, O>, ) -> Matrix<T, M, O>

Source§

impl<'a, 'b, T, const M: usize> Vector<T, M>
where &'a T: Mul<&'b T, Output = T>, T: Sum + 'a + 'b,

Source

pub fn dot(&'a self, other: &'b Vector<T, M>) -> T

Trait Implementations§

Source§

impl<'a, 'b, T, B, const N: usize> Add<B> for &'a Vector<T, N>
where &'a T: Add<&'b T, Output = T>, B: ConstIndex<&'b T, N> + Copy + Clone + 'b, T: 'a + 'b,

Source§

type Output = Vector<T, N>

The resulting type after applying the + operator.
Source§

default fn add(self, other: B) -> Vector<T, N>

Performs the + operation. Read more
Source§

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

Source§

fn add_assign(&mut self, other: &'a Vector<T, N>)

Performs the += operation. Read more
Source§

impl<'a, 'b, T, B, const N: usize> AddAssign<B> for Vector<T, N>
where T: AddAssign<&'b T> + 'a + 'b, B: ConstIndex<&'b T, N> + Copy + Clone + 'b,

Source§

default fn add_assign(&mut self, other: B)

Performs the += operation. Read more
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<'a, T, const N: usize> ConstIndex<&'a T, N> for &'a Vector<T, N>

Source§

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

Source§

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

Source§

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

Source§

impl<'a, T, const N: usize> ConstIndex<T, N> for Vector<T, N>
where T: Copy,

Source§

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

Source§

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

Source§

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

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

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

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, T, const N: usize> Deserialize<'de> for Vector<T, N>
where T: Deserialize<'de>,

Source§

fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

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

Source§

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

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

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

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§

impl<'a, 'b, T, B, const N: usize> Div<B> for &'a Vector<T, N>
where &'a T: Div<&'b T, Output = T>, B: ConstIndex<&'b T, N> + Copy + Clone + 'b, T: 'a + 'b,

Source§

type Output = Vector<T, N>

The resulting type after applying the / operator.
Source§

default fn div(self, other: B) -> Vector<T, N>

Performs the / operation. Read more
Source§

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

Source§

fn div_assign(&mut self, other: &'a Vector<T, N>)

Performs the /= operation. Read more
Source§

impl<'a, 'b, T, B, const N: usize> DivAssign<B> for Vector<T, N>
where T: DivAssign<&'b T> + 'a + 'b, B: ConstIndex<&'b T, N> + Copy + Clone + 'b,

Source§

default fn div_assign(&mut self, other: B)

Performs the /= operation. Read more
Source§

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

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
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, index: 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, index: 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 = ConstIterator<&'a T, &'a Vector<T, N>, 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> 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<'a, 'b, T, B, const N: usize> Mul<B> for &'a Vector<T, N>
where &'a T: Mul<&'b T, Output = T>, B: ConstIndex<&'b T, N> + Copy + Clone + 'b, T: 'a + 'b,

Source§

type Output = Vector<T, N>

The resulting type after applying the * operator.
Source§

default fn mul(self, other: B) -> Vector<T, N>

Performs the * operation. Read more
Source§

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

Source§

fn mul_assign(&mut self, other: &'a Vector<T, N>)

Performs the *= operation. Read more
Source§

impl<'a, 'b, T, B, const N: usize> MulAssign<B> for Vector<T, N>
where T: MulAssign<&'b T> + 'a + 'b, B: ConstIndex<&'b T, N> + Copy + Clone + 'b,

Source§

default fn mul_assign(&mut self, other: B)

Performs the *= operation. Read more
Source§

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

Source§

fn eq(&self, other: &Self) -> 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, const N: usize> Serialize for Vector<T, N>
where T: Serialize,

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

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

Source§

fn build_with_fn<F: FnMut(usize) -> T>(f: F) -> Self

Source§

impl<'a, 'b, T, B, const N: usize> Sub<B> for &'a Vector<T, N>
where &'a T: Sub<&'b T, Output = T>, B: ConstIndex<&'b T, N> + Copy + Clone + 'b, T: 'a + 'b,

Source§

type Output = Vector<T, N>

The resulting type after applying the - operator.
Source§

default fn sub(self, other: B) -> Vector<T, N>

Performs the - operation. Read more
Source§

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

Source§

fn sub_assign(&mut self, other: &'a Vector<T, N>)

Performs the -= operation. Read more
Source§

impl<'a, 'b, T, B, const N: usize> SubAssign<B> for Vector<T, N>
where T: SubAssign<&'b T> + 'a + 'b, B: ConstIndex<&'b T, N> + Copy + Clone + 'b,

Source§

default fn sub_assign(&mut self, other: B)

Performs the -= operation. Read more
Source§

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

Source§

impl<T: Eq, const N: usize> Eq 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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,