RectMatrix

Struct RectMatrix 

Source
pub struct RectMatrix<T: MatElement, const R: usize, const C: usize> { /* private fields */ }

Implementations§

Source§

impl<T: MatElement, const R: usize, const C: usize> RectMatrix<T, R, C>

Source

pub fn mat_from_vec(data: [[T; C]; R]) -> RectMatrix<T, R, C>

Create a new vector from data.

Source

pub fn value(&self, row: usize, col: usize) -> T

Returns the value.

Source

pub fn set_value(&mut self, row: usize, col: usize, value: T)

Sets a value.

Source

pub fn rows(&self) -> usize

Returns the number of rows.

Source

pub fn row(&self, i: usize) -> RowVector<T, C>

Returns the i-th row.

Source

pub fn row_to_vec(&self, i: usize) -> [T; C]

Returns the i-th row to an array.

Source

pub fn col_to_vec(&self, j: usize) -> [T; R]

Returns the j-th column as an array.

Source

pub fn cols(&self) -> usize

Returns the number of columns.

Source

pub fn col(&self, j: usize) -> ColVector<T, R>

Returns the i-th column.

Source

pub fn max_col(&self, j: usize) -> T

Returns the max value in column.

Source

pub fn print(&self)

Prints the matrix.

Source

pub fn rect<const R2: usize, const C2: usize>( &self, top: usize, left: usize, ) -> RectMatrix<T, R2, C2>

Crops the matrix.

Source

pub fn size(&self) -> Size

Returns the size of the matrix.

Source

pub fn transposed(&self) -> RectMatrix<T, C, R>

Transpose this matrix and returns a new transposed instance.

Source

pub fn assign_col( &mut self, col: usize, v: ColVector<T, R>, ) -> &RectMatrix<T, R, C>

Assigns a column.

Source

pub fn is_lower_triangular(&self) -> bool

Returns true iif the matrix is lower triangular.

Source

pub fn is_upper_triangular(&self) -> bool

Returns true iif the matrix is upper triangular.

Source

pub fn is_square(&self) -> bool

Returns true iif the matrix is square.

Source

pub fn is_row(&self) -> bool

Returns true iif this is a row.

Source

pub fn is_col(&self) -> bool

Returns true iif this a col.

Source

pub fn zeros() -> Self

Creates a matrix filled with zeros.

Source

pub fn reset(&mut self)

Reset all values to zero.

Source

pub fn identity() -> Self

Creates an identity matrix.

Source§

impl<const R: usize, const C: usize> RectMatrix<f64, R, C>

Source

pub fn round(&mut self, decimals: i32) -> &RectMatrix<f64, R, C>

Rounds all the values in the matrix.

Source§

impl<T: MatElement, const L: usize> RectMatrix<T, 1, L>

Source

pub fn row_from_vec(data: &[T]) -> RowVector<T, L>

Builds a RowVector from a vector.

Source

pub fn evenly_spaced(a: &f64, b: &f64) -> RowVector<f64, L>

Creates a evenly spaced sequence of numbers.

Source§

impl<T: MatElement, const L: usize> RectMatrix<T, L, 1>

Source

pub fn col_from_vec(data: &[T]) -> ColVector<T, L>

Builds a ColVector from a vector.

Trait Implementations§

Source§

impl<T: MatElement, const R: usize, const C: usize> Add for RectMatrix<T, R, C>

Source§

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

Adds another matrix.

Source§

type Output = RectMatrix<T, R, C>

The resulting type after applying the + operator.
Source§

impl<T: MatElement, const R: usize, const C: usize> AddAssign for RectMatrix<T, R, C>

Source§

fn add_assign(&mut self, rhs: RectMatrix<T, R, C>)

Performs the += operation. Read more
Source§

impl<M: Copy + Default, F: MatElement + ApproxEq<Margin = M>, const R: usize, const C: usize> ApproxEq for RectMatrix<F, R, C>

Source§

type Margin = M

This type type defines a margin within which two values are to be considered approximately equal. It must implement Default so that approx_eq() can be called on unknown types.
Source§

fn approx_eq<T: Into<Self::Margin>>(self, other: Self, margin: T) -> bool

This method tests that the self and other values are equal within margin of each other.
Source§

fn approx_ne<M>(self, other: Self, margin: M) -> bool
where M: Into<Self::Margin>,

This method tests that the self and other values are not within margin of each other.
Source§

impl<T: MatElement, const R: usize, const C: usize> Clone for RectMatrix<T, R, C>

Source§

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

Clones this matrix.

1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + MatElement, const R: usize, const C: usize> Debug for RectMatrix<T, R, C>

Source§

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

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

impl<T: MatElement, const R1: usize, const C1: usize, const C2: usize> Mul<RectMatrix<T, C1, C2>> for RectMatrix<T, R1, C1>

Source§

fn mul(self, other: RectMatrix<T, C1, C2>) -> RectMatrix<T, R1, C2>

Multiplication by another matrix.

Source§

type Output = RectMatrix<T, R1, C2>

The resulting type after applying the * operator.
Source§

impl<T: MatElement, const R: usize, const C: usize> Mul<T> for RectMatrix<T, R, C>

Source§

fn mul(self, scalar: T) -> Self::Output

Multiplication by a scalar.

Source§

type Output = RectMatrix<T, R, C>

The resulting type after applying the * operator.
Source§

impl<T: MatElement, const R: usize, const C: usize> MulAssign<T> for RectMatrix<T, R, C>

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<T: MatElement, const R: usize, const C: usize> PartialEq for RectMatrix<T, R, C>

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: MatElement, const R: usize, const C: usize> Sub for RectMatrix<T, R, C>

Source§

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

Subtracts another matrix.

Source§

type Output = RectMatrix<T, R, C>

The resulting type after applying the - operator.
Source§

impl<T: MatElement, const R: usize, const C: usize> SubAssign for RectMatrix<T, R, C>

Source§

fn sub_assign(&mut self, rhs: RectMatrix<T, R, C>)

Performs the -= operation. Read more
Source§

impl<T: Copy + MatElement, const R: usize, const C: usize> Copy for RectMatrix<T, R, C>

Source§

impl<T: Eq + MatElement, const R: usize, const C: usize> Eq for RectMatrix<T, R, C>

Auto Trait Implementations§

§

impl<T, const R: usize, const C: usize> Freeze for RectMatrix<T, R, C>
where T: Freeze,

§

impl<T, const R: usize, const C: usize> RefUnwindSafe for RectMatrix<T, R, C>
where T: RefUnwindSafe,

§

impl<T, const R: usize, const C: usize> Send for RectMatrix<T, R, C>
where T: Send,

§

impl<T, const R: usize, const C: usize> Sync for RectMatrix<T, R, C>
where T: Sync,

§

impl<T, const R: usize, const C: usize> Unpin for RectMatrix<T, R, C>
where T: Unpin,

§

impl<T, const R: usize, const C: usize> UnwindSafe for RectMatrix<T, R, C>
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, 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.