Skip to main content

Matrix

Struct Matrix 

Source
pub struct Matrix<const M: usize, const N: usize, T: Sized + Copy + Default> {
    pub values: [[T; N]; M],
}

Fields§

§values: [[T; N]; M]

Implementations§

Source§

impl<const M: usize, const N: usize, T: Sized + Copy + Default> Matrix<M, N, T>

Source

pub const fn new(values: [[T; N]; M]) -> Matrix<M, N, T>

Source

pub fn submatrix( &self, rmin: usize, rmax: usize, cmin: usize, cmax: usize, ) -> Matrix<M, N, T>

Returns only a subpart of the matrix

Source

pub fn augment<const O: usize, const R: usize>( &self, other: &Matrix<M, O, T>, ) -> Matrix<M, R, T>

Source

pub fn swap_rows(&mut self, r1: usize, r2: usize)

§Panics
Source§

impl<const M: usize, const N: usize, T: Default + Copy + Zero + AddAssign + Mul<Output = T>> Matrix<M, N, T>

Source

pub fn mul<const P: usize>(&self, other: Matrix<N, P, T>) -> Matrix<M, P, T>

Source§

impl<T: Sized + Copy + Default + One> Matrix<2, 2, T>

Source

pub fn empty() -> Self

Source

pub fn identity() -> Self

Source

pub fn transpose(&self) -> Self

Source§

impl Matrix<2, 2, f64>

Source

pub fn lup_decompose(&self) -> LUPDecomposition<2, 2, f64>

Source§

impl<T: Sized + Copy + Default + One> Matrix<3, 3, T>

Source

pub fn empty() -> Self

Source

pub fn identity() -> Self

Source

pub fn transpose(&self) -> Self

Source§

impl Matrix<3, 3, f64>

Source

pub fn lup_decompose(&self) -> LUPDecomposition<3, 3, f64>

Source§

impl<T: Sized + Copy + Default + One> Matrix<4, 4, T>

Source

pub fn empty() -> Self

Source

pub fn identity() -> Self

Source

pub fn transpose(&self) -> Self

Source§

impl Matrix<4, 4, f64>

Source

pub fn lup_decompose(&self) -> LUPDecomposition<4, 4, f64>

Source§

impl<T: Sized + Copy + Default + One> Matrix<5, 5, T>

Source

pub fn empty() -> Self

Source

pub fn identity() -> Self

Source

pub fn transpose(&self) -> Self

Source§

impl Matrix<5, 5, f64>

Source

pub fn lup_decompose(&self) -> LUPDecomposition<5, 5, f64>

Source§

impl<T: Sized + Copy + Default + One> Matrix<6, 6, T>

Source

pub fn empty() -> Self

Source

pub fn identity() -> Self

Source

pub fn transpose(&self) -> Self

Source§

impl Matrix<6, 6, f64>

Source

pub fn lup_decompose(&self) -> LUPDecomposition<6, 6, f64>

Source§

impl<T: Sized + Copy + Default + One> Matrix<7, 7, T>

Source

pub fn empty() -> Self

Source

pub fn identity() -> Self

Source

pub fn transpose(&self) -> Self

Source§

impl Matrix<7, 7, f64>

Source

pub fn lup_decompose(&self) -> LUPDecomposition<7, 7, f64>

Source§

impl<T: Sized + Copy + Default + One> Matrix<8, 8, T>

Source

pub fn empty() -> Self

Source

pub fn identity() -> Self

Source

pub fn transpose(&self) -> Self

Source§

impl Matrix<8, 8, f64>

Source

pub fn lup_decompose(&self) -> LUPDecomposition<8, 8, f64>

Source§

impl<T: Sized + Copy + Default + One> Matrix<9, 9, T>

Source

pub fn empty() -> Self

Source

pub fn identity() -> Self

Source

pub fn transpose(&self) -> Self

Source§

impl Matrix<9, 9, f64>

Source

pub fn lup_decompose(&self) -> LUPDecomposition<9, 9, f64>

Source§

impl<T: Sized + Copy + Default + One> Matrix<10, 10, T>

Source

pub fn empty() -> Self

Source

pub fn identity() -> Self

Source

pub fn transpose(&self) -> Self

Source§

impl Matrix<10, 10, f64>

Source

pub fn lup_decompose(&self) -> LUPDecomposition<10, 10, f64>

Source§

impl Matrix<2, 2, f64>

Source

pub fn rotation_counterclockwise(angle: f64) -> Self

Source

pub fn rotate_counterclockwise(&self, angle: f64) -> Self

Source

pub fn rotation_clockwise(angle: f64) -> Self

Source

pub fn rotate_clockwise(&self, angle: f64) -> Self

Source

pub fn sheered_x(factor: f64) -> Self

Source

pub fn sheer_x(&self, factor: f64) -> Self

Source

pub const fn sheered_y(factor: f64) -> Self

Source

pub fn sheer_y(&self, factor: f64) -> Self

Source

pub const fn scaled_x(factor: f64) -> Self

Source

pub fn scale_x(&self, factor: f64) -> Self

Source

pub const fn scaled_y(factor: f64) -> Self

Source

pub fn scale_y(&self, factor: f64) -> Self

Source

pub const fn scaled(factor: f64) -> Self

Source

pub fn scale(&self, factor: f64) -> Self

Source

pub const fn reflected() -> Self

Source

pub fn reflect(&self) -> Self

Source

pub const fn reflected_x() -> Self

Source

pub fn reflect_x(&self) -> Self

Source

pub const fn reflected_y() -> Self

Source

pub fn reflect_y(&self) -> Self

Source§

impl<T: Copy + Default + FloatExt<Type = T> + One + Zero + Neg<Output = T> + Add + AddAssign<T> + Mul<Output = T>> Matrix<3, 1, T>

Source

pub fn translate(&self, x: T, y: T) -> Self

Source

pub fn rotate_x(&self, angle: T) -> Self

Available on crate feature std only.
Source

pub fn rotate_y(&self, angle: T) -> Self

Available on crate feature std only.
Source

pub fn rotate_z(&self, angle: T) -> Self

Available on crate feature std only.
Source

pub fn rotate_zyx(&self, x_angle: T, y_angle: T, z_angle: T) -> Self

Available on crate feature std only.
Source§

impl<T: Copy + Default + FloatExt<Type = T> + One + Zero + Neg<Output = T> + Add + AddAssign<T> + Mul<Output = T>> Matrix<3, 3, T>

Source

pub fn rotated_x(angle: T) -> Self

Available on crate feature std only.
Source

pub fn rotate_x(&self, angle: T) -> Self

Available on crate feature std only.
Source

pub fn rotated_y(angle: T) -> Self

Available on crate feature std only.
Source

pub fn rotate_y(&self, angle: T) -> Self

Available on crate feature std only.
Source

pub fn rotated_z(angle: T) -> Self

Available on crate feature std only.
Source

pub fn rotate_z(&self, angle: T) -> Self

Available on crate feature std only.
Source

pub fn rotated_zyx(x_angle: T, y_angle: T, z_angle: T) -> Self

Available on crate feature std only.
Source

pub fn rotate_zyx(&self, x_angle: T, y_angle: T, z_angle: T) -> Self

Available on crate feature std only.
Source

pub const fn scaled_x(factor: T) -> Self

Available on crate feature std only.
Source

pub fn scale_x(&self, factor: T) -> Self

Available on crate feature std only.
Source

pub const fn scaled_y(factor: T) -> Self

Available on crate feature std only.
Source

pub fn scale_y(&self, factor: T) -> Self

Available on crate feature std only.
Source

pub const fn scaled_z(factor: T) -> Self

Available on crate feature std only.
Source

pub fn scale_z(&self, factor: T) -> Self

Available on crate feature std only.

Trait Implementations§

Source§

impl<const M: usize, const N: usize, T: Sized + Copy + Default + Add<Output = T>> Add for Matrix<M, N, T>

Source§

type Output = Matrix<M, N, T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Matrix<M, N, T>) -> Matrix<M, N, T>

Performs the + operation. Read more
Source§

impl<const M: usize, const N: usize, T: Clone + Sized + Copy + Default> Clone for Matrix<M, N, T>

Source§

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

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<const M: usize, const N: usize, T: Debug + Sized + Copy + Default> Debug for Matrix<M, N, T>

Source§

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

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

impl<const M: usize, const N: usize, T: Sized + Copy + Default> Deref for Matrix<M, N, T>

Source§

type Target = [[T; N]; M]

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<const M: usize, const N: usize, T: Sized + Copy + Default> DerefMut for Matrix<M, N, T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<const M: usize, const N: usize, T: Sized + Copy + Default> From<&[[T; N]; M]> for Matrix<M, N, T>

Source§

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

Converts to this type from the input type.
Source§

impl<const M: usize, const N: usize, T: Sized + Copy + Default> From<[[T; N]; M]> for Matrix<M, N, T>

Source§

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

Converts to this type from the input type.
Source§

impl<const M: usize, const N: usize, T: Sized + Copy + Default> Index<usize> for Matrix<M, N, T>

Source§

type Output = [T; N]

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

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

impl<const M: usize, const N: usize, T: Sized + Copy + Default> IndexMut<usize> for Matrix<M, N, T>

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

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

impl<const M: usize, const N: usize, const P: usize, T: Sized + Copy + Default + Add + Mul + AddAssign<<T as Mul<T>>::Output>> Mul<Matrix<N, P, T>> for &Matrix<M, N, T>

Source§

type Output = Matrix<M, P, T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Matrix<N, P, T>) -> Matrix<M, P, T>

Performs the * operation. Read more
Source§

impl<const M: usize, const N: usize, const P: usize, T: Sized + Copy + Default + Add + Mul + AddAssign<<T as Mul<T>>::Output>> Mul<Matrix<N, P, T>> for &mut Matrix<M, N, T>

Source§

type Output = Matrix<M, P, T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Matrix<N, P, T>) -> Matrix<M, P, T>

Performs the * operation. Read more
Source§

impl<const M: usize, const N: usize, const P: usize, T: Sized + Copy + Default + Add + Mul + AddAssign<<T as Mul<T>>::Output>> Mul<Matrix<N, P, T>> for Matrix<M, N, T>

Source§

type Output = Matrix<M, P, T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Matrix<N, P, T>) -> Matrix<M, P, T>

Performs the * operation. Read more
Source§

impl<const M: usize, const N: usize, T: Sized + Copy + Default + Mul<T, Output = T>> Mul<T> for Matrix<M, N, T>

Source§

type Output = Matrix<M, N, T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Matrix<M, N, T>

Performs the * operation. Read more
Source§

impl<const M: usize, const N: usize, T: PartialEq + Sized + Copy + Default> PartialEq for Matrix<M, N, T>

Source§

fn eq(&self, other: &Matrix<M, N, T>) -> 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<const M: usize, const N: usize, T: Sized + Copy + Default + Add<Output = T> + Mul<T, Output = T> + ToSigned<Output = T>> Sub for Matrix<M, N, T>

Source§

type Output = Matrix<M, N, T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<const M: usize, const N: usize, T: Copy + Sized + Copy + Default> Copy for Matrix<M, N, T>

Source§

impl<const M: usize, const N: usize, T: Eq + Sized + Copy + Default> Eq for Matrix<M, N, T>

Source§

impl<const M: usize, const N: usize, T: Sized + Copy + Default> StructuralPartialEq for Matrix<M, N, T>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<const M: usize, const N: usize, T> UnwindSafe for Matrix<M, N, T>
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, U> MaybeInto<U> for T
where U: MaybeFrom<T>,

Source§

fn maybe_into(self) -> Option<U>

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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, 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.