Struct matrix_rs::Matrix

source ·
pub struct Matrix<const R: usize, const C: usize>(_);

Implementations§

source§

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

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) -> Selfwhere F: Fn(f32) -> f32,

source

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

source§

impl<const D: usize> Matrix<D, D>

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<Matrix<R, C>> for Matrix<R, C>

§

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>

source§

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

Returns a copy 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 R: usize, const C: usize> Debug for Matrix<R, C>

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>

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>

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

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>

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>

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>

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>

§

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>

§

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>

§

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<Matrix<R, C>> for Matrix<R, C>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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<Matrix<R, C>> for Matrix<R, C>

§

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>

source§

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

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

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 Twhere U: TryFrom<T>,

§

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.