Struct Matrix

Source
pub struct Matrix<const R: usize, const C: usize>(/* private fields */)
where
    Zero<R>: Failed,
    Zero<C>: Failed;

Implementations§

Source§

impl<const R: usize, const C: usize> Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source

pub fn new(closure: impl Fn(usize, usize) -> f32) -> Self

Source

pub fn zero() -> Self

Source

pub const fn is_square(&self) -> bool

Source

pub fn rows(&self) -> [[f32; C]; R]

Source

pub fn columns(&self) -> [[f32; R]; C]

Source

pub fn transpose(&self) -> Matrix<C, R>

Source

pub fn map<F>(&self, f: F) -> Self
where F: Fn(f32) -> f32,

Source

pub fn merge<F>(&self, other: Matrix<R, C>, f: F) -> Self
where F: Fn(f32, f32) -> f32,

Source§

impl<const D: usize> Matrix<D, D>
where Zero<D>: Failed,

Source

pub fn identity() -> Self

Source

pub fn determinant(&self) -> f32

Source

pub fn has_inverse(&self) -> bool

Source

pub fn inverse(&self) -> Option<Self>

Trait Implementations§

Source§

impl<const R: usize, const C: usize> Add for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

type Output = Matrix<R, C>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<const R: usize, const C: usize> Clone for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

fn clone(&self) -> Matrix<R, C>

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

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

Performs copy-assignment from source. Read more
Source§

impl<const R: usize, const C: usize> Debug for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

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

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

impl<const R: usize, const C: usize> Default for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

fn default() -> Self

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

impl<const R: usize, const C: usize> Display for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

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

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

impl<const R: usize, const C: usize> From<&Matrix<R, C>> for VecMatrix
where Zero<R>: Failed, Zero<C>: Failed,

Source§

fn from(val: &Matrix<R, C>) -> Self

Converts to this type from the input type.
Source§

impl<const R: usize, const C: usize> From<[[f32; C]; R]> for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

fn from(value: [[f32; C]; R]) -> Self

Converts to this type from the input type.
Source§

impl<const R: usize, const C: usize> From<[[i32; C]; R]> for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

fn from(value: [[i32; C]; R]) -> Self

Converts to this type from the input type.
Source§

impl<const R: usize, const C: usize> From<[[usize; C]; R]> for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

fn from(value: [[usize; C]; R]) -> Self

Converts to this type from the input type.
Source§

impl<const R: usize, const C: usize> Index<usize> for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

type Output = [f32; C]

The returned type after indexing.
Source§

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

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

impl<const R: usize, const C: usize, const C2: usize> Mul<Matrix<C, C2>> for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed, Zero<C2>: Failed,

Source§

type Output = Matrix<R, C2>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Matrix<C, C2>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const R: usize, const C: usize> Mul<f32> for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

type Output = Matrix<R, C>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
Source§

impl<const R: usize, const C: usize> PartialEq for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

fn eq(&self, other: &Matrix<R, C>) -> bool

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

const 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 R: usize, const C: usize> Sub for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

type Output = Matrix<R, C>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<const R: usize, const C: usize> Copy for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Source§

impl<const R: usize, const C: usize> StructuralPartialEq for Matrix<R, C>
where Zero<R>: Failed, Zero<C>: Failed,

Auto Trait Implementations§

§

impl<const R: usize, const C: usize> Freeze for Matrix<R, C>

§

impl<const R: usize, const C: usize> RefUnwindSafe for Matrix<R, C>

§

impl<const R: usize, const C: usize> Send for Matrix<R, C>

§

impl<const R: usize, const C: usize> Sync for Matrix<R, C>

§

impl<const R: usize, const C: usize> Unpin for Matrix<R, C>

§

impl<const R: usize, const C: usize> UnwindSafe for Matrix<R, C>

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.