pub struct MatrixOperator<Input, Output> {
pub mat: CsrMatrix<f64>,
/* private fields */
}Expand description
A general sparse matrix operator, parameterized with the cochain types it consumes and produces.
This can be a composition of one or more MatrixOperators and DiagonalOperators.
Composition can be done using multiplication syntax:
let op: MatrixOperator<_, _> = mesh.star() * mesh.d::<1, Primal>();A free function compose is also provided for the same purpose.
There is also a DiagonalOperator type for operators
which are specifically diagonal matrices,
which stores them in a somewhat more efficient format.
When you don’t need the efficiency and prefer notational convenience,
these can also be converted into a MatrixOperator using the std From trait.
This enables writing all your operator types as MatrixOperator<Input, Output>,
a convenient pattern which can be written more concisely with the type alias Op.
See the crate-level docs and examples for details.
Fields§
§mat: CsrMatrix<f64>The underlying matrix, exposed for potential use cases that need to modify or read matrix values directly.
Modifying the dimensions of this matrix will result in runtime errors.
Implementations§
Source§impl<Input, Output> MatrixOperator<Input, Output>
impl<Input, Output> MatrixOperator<Input, Output>
Sourcepub fn exclude_subset(
self,
set: &SubsetImpl<<Output as Operand>::Dimension, <Output as Operand>::Primality>,
) -> Self
pub fn exclude_subset( self, set: &SubsetImpl<<Output as Operand>::Dimension, <Output as Operand>::Primality>, ) -> Self
Set a subset of elements in the output cochain to zero when this operator is applied (i.e. set a subset of rows in the operator matrix to zero).
Trait Implementations§
Source§impl<Input: Clone, Output: Clone> Clone for MatrixOperator<Input, Output>
impl<Input: Clone, Output: Clone> Clone for MatrixOperator<Input, Output>
Source§fn clone(&self) -> MatrixOperator<Input, Output>
fn clone(&self) -> MatrixOperator<Input, Output>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Input, Output> From<DiagonalOperator<Input, Output>> for MatrixOperator<Input, Output>where
DiagonalOperator<Input, Output>: Operator,
impl<Input, Output> From<DiagonalOperator<Input, Output>> for MatrixOperator<Input, Output>where
DiagonalOperator<Input, Output>: Operator,
Source§fn from(s: DiagonalOperator<Input, Output>) -> Self
fn from(s: DiagonalOperator<Input, Output>) -> Self
Source§impl<O, D, P> Mul<&CochainImpl<D, P>> for &MatrixOperator<CochainImpl<D, P>, O>where
O: Operand,
impl<O, D, P> Mul<&CochainImpl<D, P>> for &MatrixOperator<CochainImpl<D, P>, O>where
O: Operand,
Source§impl<O, D, P> Mul<&CochainImpl<D, P>> for MatrixOperator<CochainImpl<D, P>, O>where
O: Operand,
impl<O, D, P> Mul<&CochainImpl<D, P>> for MatrixOperator<CochainImpl<D, P>, O>where
O: Operand,
Source§type Output = <MatrixOperator<CochainImpl<D, P>, O> as Operator>::Output
type Output = <MatrixOperator<CochainImpl<D, P>, O> as Operator>::Output
* operator.Source§impl<L, R> Mul<MatrixOperator<L, R>> for f64
impl<L, R> Mul<MatrixOperator<L, R>> for f64
Source§type Output = MatrixOperator<L, R>
type Output = MatrixOperator<L, R>
* operator.Source§impl<In, Out, OtherIn> Mul<MatrixOperator<OtherIn, In>> for DiagonalOperator<In, Out>
impl<In, Out, OtherIn> Mul<MatrixOperator<OtherIn, In>> for DiagonalOperator<In, Out>
Source§type Output = MatrixOperator<OtherIn, Out>
type Output = MatrixOperator<OtherIn, Out>
* operator.Source§impl<In, Out, Op> Mul<Op> for MatrixOperator<In, Out>
impl<In, Out, Op> Mul<Op> for MatrixOperator<In, Out>
Source§impl<Input, Output> Neg for MatrixOperator<Input, Output>
impl<Input, Output> Neg for MatrixOperator<Input, Output>
Source§impl<Input, Output> Operator for MatrixOperator<Input, Output>
impl<Input, Output> Operator for MatrixOperator<Input, Output>
Source§impl<L, R> PartialEq for MatrixOperator<L, R>
impl<L, R> PartialEq for MatrixOperator<L, R>
Auto Trait Implementations§
impl<Input, Output> Freeze for MatrixOperator<Input, Output>
impl<Input, Output> RefUnwindSafe for MatrixOperator<Input, Output>where
Input: RefUnwindSafe,
Output: RefUnwindSafe,
impl<Input, Output> Send for MatrixOperator<Input, Output>
impl<Input, Output> Sync for MatrixOperator<Input, Output>
impl<Input, Output> Unpin for MatrixOperator<Input, Output>
impl<Input, Output> UnsafeUnpin for MatrixOperator<Input, Output>
impl<Input, Output> UnwindSafe for MatrixOperator<Input, Output>where
Input: UnwindSafe,
Output: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.