Skip to main content

Matrix

Struct Matrix 

Source
pub struct Matrix<S, const R: usize, const C: usize> { /* private fields */ }
Expand description

Dense R×C matrix, row-major (self[(row, col)]).

Implementations§

Source§

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

Source

pub fn from_rows(data: [[S; C]; R]) -> Self

Source

pub fn zero() -> Self

Source

pub fn from_columns(cols: [Vector<S, R>; C]) -> Self

Build from C column vectors, each an R-vector.

Source

pub fn row(&self, r: usize) -> Vector<S, C>

Source

pub fn col(&self, c: usize) -> Vector<S, R>

Source

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

Source

pub fn add(&self, other: &Self) -> Self

Source

pub fn sub(&self, other: &Self) -> Self

Source

pub fn mul_vec(&self, v: &Vector<S, C>) -> Vector<S, R>

self · v.

Source

pub fn mul_mat<const K: usize>( &self, other: &Matrix<S, C, K>, ) -> Matrix<S, R, K>

self · other.

Source§

impl<S: Scalar, const N: usize> Matrix<S, N, N>

Source

pub fn identity() -> Self

Trait Implementations§

Source§

impl<S: Clone, const R: usize, const C: usize> Clone for Matrix<S, R, C>

Source§

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

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<S: Copy, const R: usize, const C: usize> Copy for Matrix<S, R, C>

Source§

impl<S: Debug, const R: usize, const C: usize> Debug for Matrix<S, R, C>

Source§

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

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

impl<S, const R: usize, const C: usize> Index<(usize, usize)> for Matrix<S, R, C>

Source§

type Output = S

The returned type after indexing.
Source§

fn index(&self, (r, c): (usize, usize)) -> &S

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

impl<S, const R: usize, const C: usize> IndexMut<(usize, usize)> for Matrix<S, R, C>

Source§

fn index_mut(&mut self, (r, c): (usize, usize)) -> &mut S

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<S, const R: usize, const C: usize> UnsafeUnpin for Matrix<S, R, C>
where S: UnsafeUnpin,

§

impl<S, const R: usize, const C: usize> UnwindSafe for Matrix<S, R, C>
where S: 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, 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.