Mat

Struct Mat 

Source
pub struct Mat<T> { /* private fields */ }

Implementations§

Source§

impl<T> Mat<T>

Source

pub fn new(rows: usize, cols: usize, values: Vec<T>, col_major: bool) -> Self

Source

pub fn from_fn( rows: usize, cols: usize, f: impl Fn(usize, usize) -> T, col_major: bool, ) -> Self

Source

pub fn zeros(rows: usize, cols: usize, col_major: bool) -> Self
where T: Clone + Zero,

Source

pub fn ones(rows: usize, cols: usize, col_major: bool) -> Self
where T: Clone + One,

Source

pub fn identity(n: usize, col_major: bool) -> Self
where T: Clone + Zero + One,

Source

pub fn with_diagonal(diag: &[T], col_major: bool) -> Self
where T: Copy + Clone + Zero + One,

Source

pub fn rows(&self) -> usize

Source

pub fn cols(&self) -> usize

Source

pub fn shape(&self) -> (usize, usize)

Source

pub fn values(&self) -> &[T]

Source

pub fn values_mut(&mut self) -> &mut [T]

Source

pub fn col_major(&self) -> bool

Source

pub fn values_vec(self) -> Vec<T>

Source

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

Source

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

Source

pub fn row(&self, row: usize) -> impl Iterator<Item = &T>

Source

pub fn col(&self, col: usize) -> impl Iterator<Item = &T>

Source

pub fn row_slice(&self, row: usize) -> &[T]

Panics if not in row-major order.

Source

pub fn col_slice(&self, col: usize) -> &[T]

Panics if not in column-major order.

Source

pub fn row_slice_mut(&mut self, row: usize) -> &mut [T]

Panics if not in row-major order.

Source

pub fn col_slice_mut(&mut self, col: usize) -> &mut [T]

Panics if not in column-major order.

Source

pub fn row_iter(&self) -> impl Iterator<Item = &[T]>

Panics if not in row-major order.

Source

pub fn col_iter(&self) -> impl Iterator<Item = &[T]>

Panics if not in column-major order.

Source

pub fn row_iter_mut(&mut self) -> impl Iterator<Item = &mut [T]>

Panics if not in row-major order.

Source

pub fn col_iter_mut(&mut self) -> impl Iterator<Item = &mut [T]>

Panics if not in column-major order.

Source

pub fn select_rows(&self, rows: &[usize], col_major: bool) -> Self
where T: Clone,

Source

pub fn select_cols(&self, cols: &[usize]) -> Self
where T: Clone + Copy,

Source

pub fn diagonal(&self) -> impl Iterator<Item = &T>

Source

pub fn mat_vec(&self, b: &[T]) -> Vec<T>
where T: Mul<Output = T> + Add<Output = T> + Zero + Copy,

Source

pub fn mat_mat(&self, b: &Self) -> Self
where T: Mul<Output = T> + AddAssign + Zero + Copy,

Trait Implementations§

Source§

impl<T> Add<T> for Mat<T>
where T: Add<T, Output = T> + Copy,

Source§

type Output = Mat<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T> Add for Mat<T>
where T: Add<T, Output = T> + Copy,

Source§

type Output = Mat<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T> AddAssign<T> for Mat<T>
where T: AddAssign<T> + Copy,

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
Source§

impl<T> AddAssign for Mat<T>
where T: AddAssign<T> + Copy,

Source§

fn add_assign(&mut self, rhs: Mat<T>)

Performs the += operation. Read more
Source§

impl<C> CMat<C, f64> for Mat<C>
where C: Complex<f64>,

Source§

fn real(&self) -> Mat<f64>

Source§

fn imag(&self) -> Mat<f64>

Source§

fn conj(&self) -> Mat<C>

Source§

impl<T: Clone> Clone for Mat<T>

Source§

fn clone(&self) -> Mat<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<T> Display for Mat<T>
where T: Copy + Display,

Source§

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

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

impl<T> Div<T> for Mat<T>
where T: Div<T, Output = T> + Copy,

Source§

type Output = Mat<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div for Mat<T>
where T: Div<T, Output = T> + Copy,

Source§

type Output = Mat<T>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<T> DivAssign<T> for Mat<T>
where T: DivAssign<T> + Copy,

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl<T> DivAssign for Mat<T>
where T: DivAssign<T> + Copy,

Source§

fn div_assign(&mut self, rhs: Mat<T>)

Performs the /= operation. Read more
Source§

impl<T> Index<(usize, usize)> for Mat<T>

Source§

type Output = T

The returned type after indexing.
Source§

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

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

impl<T> IndexMut<(usize, usize)> for Mat<T>

Source§

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

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

impl<T> Mul<T> for Mat<T>
where T: Mul<T, Output = T> + Copy,

Source§

type Output = Mat<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T> Mul for Mat<T>
where T: Mul<T, Output = T> + Copy,

Source§

type Output = Mat<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T> MulAssign<T> for Mat<T>
where T: MulAssign<T> + Copy,

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<T> MulAssign for Mat<T>
where T: MulAssign<T> + Copy,

Source§

fn mul_assign(&mut self, rhs: Mat<T>)

Performs the *= operation. Read more
Source§

impl<T> Neg for Mat<T>
where T: Neg<Output = T>,

Source§

type Output = Mat<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T> Sub<T> for Mat<T>
where T: Sub<T, Output = T> + Copy,

Source§

type Output = Mat<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T> Sub for Mat<T>
where T: Sub<T, Output = T> + Copy,

Source§

type Output = Mat<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T> SubAssign<T> for Mat<T>
where T: SubAssign<T> + Copy,

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
Source§

impl<T> SubAssign for Mat<T>
where T: SubAssign<T> + Copy,

Source§

fn sub_assign(&mut self, rhs: Mat<T>)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Mat<T>

§

impl<T> RefUnwindSafe for Mat<T>
where T: RefUnwindSafe,

§

impl<T> Send for Mat<T>
where T: Send,

§

impl<T> Sync for Mat<T>
where T: Sync,

§

impl<T> Unpin for Mat<T>
where T: Unpin,

§

impl<T> UnwindSafe for Mat<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> 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.