MatrixOperator

Struct MatrixOperator 

Source
pub struct MatrixOperator<const P: usize, const Q: usize, const R: usize> { /* private fields */ }
Expand description

A linear operator represented as a matrix.

The matrix is stored in row-major order.

Implementations§

Source§

impl<const P: usize, const Q: usize, const R: usize> MatrixOperator<P, Q, R>

Source

pub const DIM: usize

The dimension of the Clifford algebra.

Source

pub fn new(entries: Vec<f64>, rows: usize, cols: usize) -> Result<Self>

Create a new matrix operator from entries.

Entries should be in row-major order.

Source

pub fn identity() -> Self

Create an identity matrix.

Source

pub fn zeros() -> Self

Create a zero matrix.

Source

pub fn diagonal(diag: &[f64]) -> Result<Self>

Create a diagonal matrix from diagonal entries.

Source

pub fn get(&self, row: usize, col: usize) -> f64

Get a matrix entry.

Source

pub fn set(&mut self, row: usize, col: usize, value: f64)

Set a matrix entry.

Source

pub fn rows(&self) -> usize

Get the number of rows.

Source

pub fn cols(&self) -> usize

Get the number of columns.

Source

pub fn transpose(&self) -> Self

Compute the transpose of the matrix.

Source

pub fn trace(&self) -> f64

Compute the trace of the matrix.

Source

pub fn multiply(&self, other: &Self) -> Result<Self>

Multiply this matrix by another.

Source

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

Add another matrix.

Source

pub fn scale(&self, scalar: f64) -> Self

Scale the matrix by a scalar.

Source

pub fn is_symmetric(&self, tolerance: f64) -> bool

Check if the matrix is symmetric.

Trait Implementations§

Source§

impl<const P: usize, const Q: usize, const R: usize> AdjointableOperator<Multivector<P, Q, R>> for MatrixOperator<P, Q, R>

Source§

type Adjoint = MatrixOperator<P, Q, R>

The type of the adjoint operator.
Source§

fn adjoint(&self) -> Self::Adjoint

Compute the adjoint operator.
Source§

fn is_self_adjoint(&self) -> bool

Check if this operator is self-adjoint (T = T*).
Source§

fn is_normal(&self) -> bool

Check if this operator is normal (TT* = T*T).
Source§

impl<const P: usize, const Q: usize, const R: usize> BoundedOperator<Multivector<P, Q, R>> for MatrixOperator<P, Q, R>

Source§

fn operator_norm(&self) -> f64

Compute or estimate the operator norm ||T||.
Source§

fn is_bounded_by(&self, bound: f64) -> bool

Check if the operator is bounded by a given constant.
Source§

impl<const P: usize, const Q: usize, const R: usize> Clone for MatrixOperator<P, Q, R>

Source§

fn clone(&self) -> MatrixOperator<P, Q, R>

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<const P: usize, const Q: usize, const R: usize> Debug for MatrixOperator<P, Q, R>

Source§

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

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

impl<const P: usize, const Q: usize, const R: usize> LinearOperator<Multivector<P, Q, R>> for MatrixOperator<P, Q, R>

Source§

fn apply(&self, x: &Multivector<P, Q, R>) -> Result<Multivector<P, Q, R>>

Apply the operator to an element.
Source§

fn domain_dimension(&self) -> Option<usize>

Get the domain dimension (None if infinite).
Source§

fn codomain_dimension(&self) -> Option<usize>

Get the codomain dimension (None if infinite).
Source§

impl<const P: usize, const Q: usize, const R: usize> OperatorNorm for MatrixOperator<P, Q, R>

Source§

fn norm(&self) -> f64

Compute the operator norm.
Source§

fn frobenius_norm(&self) -> Option<f64>

Compute the Frobenius norm (for matrix operators).

Auto Trait Implementations§

§

impl<const P: usize, const Q: usize, const R: usize> Freeze for MatrixOperator<P, Q, R>

§

impl<const P: usize, const Q: usize, const R: usize> RefUnwindSafe for MatrixOperator<P, Q, R>

§

impl<const P: usize, const Q: usize, const R: usize> Send for MatrixOperator<P, Q, R>

§

impl<const P: usize, const Q: usize, const R: usize> Sync for MatrixOperator<P, Q, R>

§

impl<const P: usize, const Q: usize, const R: usize> Unpin for MatrixOperator<P, Q, R>

§

impl<const P: usize, const Q: usize, const R: usize> UnwindSafe for MatrixOperator<P, Q, R>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V