Struct faer_core::Mat

source ·
#[repr(C)]
pub struct Mat<E: Entity> { /* private fields */ }

Implementations§

source§

impl<E: Entity> Mat<E>

source

pub fn new() -> Self

source

pub fn with_capacity(row_capacity: usize, col_capacity: usize) -> Self

Returns a new matrix with dimensions (0, 0), with enough capacity to hold a maximum of row_capacity rows and col_capacity columns without reallocating. If either is 0, the matrix will not allocate.

Panics

Panics if the total capacity in bytes exceeds isize::MAX.

source

pub fn with_dims( nrows: usize, ncols: usize, f: impl FnMut(usize, usize) -> E ) -> Self

Returns a new matrix with dimensions (nrows, ncols), filled with the provided function.

Panics

Panics if the total capacity in bytes exceeds isize::MAX.

source

pub fn zeros(nrows: usize, ncols: usize) -> Selfwhere E: ComplexField,

Returns a new matrix with dimensions (nrows, ncols), filled with zeros.

Panics

Panics if the total capacity in bytes exceeds isize::MAX.

source

pub unsafe fn set_dims(&mut self, nrows: usize, ncols: usize)

Set the dimensions of the matrix.

Safety
  • nrows must be less than self.row_capacity().
  • ncols must be less than self.col_capacity().
  • The elements that were previously out of bounds but are now in bounds must be initialized.
source

pub fn as_ptr(&self) -> E::Group<*const E::Unit>

Returns a pointer to the data of the matrix.

source

pub fn as_mut_ptr(&mut self) -> E::Group<*mut E::Unit>

Returns a mutable pointer to the data of the matrix.

source

pub fn nrows(&self) -> usize

Returns the number of rows of the matrix.

source

pub fn ncols(&self) -> usize

Returns the number of columns of the matrix.

source

pub fn row_capacity(&self) -> usize

Returns the row capacity, that is, the number of rows that the matrix is able to hold without needing to reallocate, excluding column insertions.

source

pub fn col_capacity(&self) -> usize

Returns the column capacity, that is, the number of columns that the matrix is able to hold without needing to reallocate, excluding row insertions.

source

pub fn row_stride(&self) -> isize

Returns the offset between the first elements of two successive rows in the matrix. Always returns 1 since the matrix is column major.

source

pub fn col_stride(&self) -> isize

Returns the offset between the first elements of two successive columns in the matrix.

source

pub fn reserve_exact(&mut self, row_capacity: usize, col_capacity: usize)

Reserves the minimum capacity for row_capacity rows and col_capacity columns without reallocating. Does nothing if the capacity is already sufficient.

Panics

Panics if the new total capacity in bytes exceeds isize::MAX.

source

pub fn resize_with( &mut self, new_nrows: usize, new_ncols: usize, f: impl FnMut(usize, usize) -> E )

Resizes the matrix in-place so that the new dimensions are (new_nrows, new_ncols). Elements that are now out of bounds are dropped, while new elements are created with the given function f, so that elements at position (i, j) are created by calling f(i, j).

source

pub fn as_ref(&self) -> MatRef<'_, E>

Returns a view over the matrix.

source

pub fn as_mut(&mut self) -> MatMut<'_, E>

Returns a mutable view over the matrix.

source

pub unsafe fn read_unchecked(&self, row: usize, col: usize) -> E

source

pub fn read(&self, row: usize, col: usize) -> E

source

pub unsafe fn write_unchecked(&mut self, row: usize, col: usize, value: E)

source

pub fn write(&mut self, row: usize, col: usize, value: E)

source

pub fn transpose(&self) -> MatRef<'_, E>

Returns the transpose of self.

source

pub fn conjugate(&self) -> MatRef<'_, E::Conj>where E: Conjugate,

Returns the conjugate of self.

source

pub fn adjoint(&self) -> MatRef<'_, E::Conj>where E: Conjugate,

Returns the conjugate transpose of self.

source

pub fn to_owned(&self) -> Mat<E::Canonical>where E: Conjugate,

Returns an owning Mat of the data

Trait Implementations§

source§

impl<E: Entity> Clone for Mat<E>

source§

fn clone(&self) -> Self

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<E: Entity> Debug for Mat<E>

source§

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

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

impl<LhsE: Conjugate, RhsE: Conjugate<Canonical = LhsE::Canonical>> Mul<&Mat<RhsE>> for &Mat<LhsE>where LhsE::Canonical: ComplexField,

§

type Output = Mat<<LhsE as Conjugate>::Canonical>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Mat<RhsE>) -> Self::Output

Performs the * operation. Read more
source§

impl<LhsE: Conjugate, RhsE: Conjugate<Canonical = LhsE::Canonical>> Mul<&Mat<RhsE>> for Mat<LhsE>where LhsE::Canonical: ComplexField,

§

type Output = Mat<<LhsE as Conjugate>::Canonical>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Mat<RhsE>) -> Self::Output

Performs the * operation. Read more
source§

impl<LhsE: Conjugate, RhsE: Conjugate<Canonical = LhsE::Canonical>> Mul<Mat<RhsE>> for &Mat<LhsE>where LhsE::Canonical: ComplexField,

§

type Output = Mat<<LhsE as Conjugate>::Canonical>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<LhsE: Conjugate, RhsE: Conjugate<Canonical = LhsE::Canonical>> Mul<Mat<RhsE>> for Mat<LhsE>where LhsE::Canonical: ComplexField,

§

type Output = Mat<<LhsE as Conjugate>::Canonical>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<LhsE: Conjugate, RhsE: Conjugate<Canonical = LhsE::Canonical>> Mul<Mat<RhsE>> for MatRef<'_, LhsE>where LhsE::Canonical: ComplexField,

§

type Output = Mat<<LhsE as Conjugate>::Canonical>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<LhsE: Conjugate, RhsE: Conjugate<Canonical = LhsE::Canonical>> Mul<MatRef<'_, RhsE>> for Mat<LhsE>where LhsE::Canonical: ComplexField,

§

type Output = Mat<<LhsE as Conjugate>::Canonical>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: MatRef<'_, RhsE>) -> Self::Output

Performs the * operation. Read more
source§

impl<U: Conjugate, T: Conjugate<Canonical = U::Canonical>> PartialEq<Mat<U>> for Mat<T>where T::Canonical: ComplexField,

source§

fn eq(&self, other: &Mat<U>) -> 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<E: Entity> Send for Mat<E>

source§

impl<E: Entity> Sync for Mat<E>

Auto Trait Implementations§

§

impl<E> RefUnwindSafe for Mat<E>where <E as Entity>::GroupCopy<NonNull<<E as Entity>::Unit>>: RefUnwindSafe,

§

impl<E> Unpin for Mat<E>where <E as Entity>::GroupCopy<NonNull<<E as Entity>::Unit>>: Unpin,

§

impl<E> UnwindSafe for Mat<E>where <E as Entity>::GroupCopy<NonNull<<E as Entity>::Unit>>: UnwindSafe,

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, 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.