Trait MatrixOperations

Source
pub trait MatrixOperations {
    // Provided methods
    fn multiply_left<Othr, RingOperator, OrderOperator>(
        self,
        other: Othr,
        ring_operator: RingOperator,
        order_operator: OrderOperator,
    ) -> ProductMatrix<Self, Othr, RingOperator, OrderOperator>
       where Self: ViewRowAscend + IndicesAndCoefficients + Sized,
             Othr: ViewRowAscend + IndicesAndCoefficients<Coefficient = Self::Coefficient, RowIndex = Self::ColIndex>,
             Self::ViewMajorAscend: IntoIterator,
             Othr::ViewMajorAscend: IntoIterator,
             Self::EntryMajor: KeyValGet<Self::ColIndex, Self::Coefficient>,
             Othr::EntryMajor: KeyValGet<Othr::ColIndex, Othr::Coefficient>,
             Othr::ColIndex: Clone,
             Othr::Coefficient: Clone,
             RingOperator: Clone + Semiring<Self::Coefficient>,
             OrderOperator: Clone + JudgePartialOrder<Othr::EntryMajor> { ... }
    fn multiply_right<Othr, RingOperator, OrderOperator>(
        self,
        other: Othr,
        ring_operator: RingOperator,
        order_operator: OrderOperator,
    ) -> ProductMatrix<Othr, Self, RingOperator, OrderOperator>
       where Self: ViewRowAscend + IndicesAndCoefficients + Sized,
             Othr: ViewRowAscend + IndicesAndCoefficients<Coefficient = Self::Coefficient, ColIndex = Self::RowIndex>,
             Self::ViewMajorAscend: IntoIterator,
             Othr::ViewMajorAscend: IntoIterator,
             Self::EntryMajor: KeyValGet<Self::ColIndex, Self::Coefficient>,
             Othr::EntryMajor: KeyValGet<Othr::ColIndex, Othr::Coefficient>,
             Self::ColIndex: Clone,
             Self::Coefficient: Clone,
             RingOperator: Clone + Semiring<Self::Coefficient>,
             OrderOperator: Clone + JudgePartialOrder<Self::EntryMajor> { ... }
    fn multiply_left_packet<Othr, RingOperator, OrderOperatorRowEntries, OrderOperatorColEntries>(
        self,
        other: MatrixAlgebraPacket<Othr, RingOperator, OrderOperatorRowEntries, OrderOperatorColEntries>,
    ) -> ProductMatrix<Self, Othr, RingOperator, OrderOperatorRowEntries>
       where Self: ViewRowAscend + IndicesAndCoefficients + Sized,
             Othr: ViewRowAscend + IndicesAndCoefficients<Coefficient = Self::Coefficient, RowIndex = Self::ColIndex>,
             Self::ViewMajorAscend: IntoIterator,
             Othr::ViewMajorAscend: IntoIterator,
             Self::EntryMajor: KeyValGet<Self::ColIndex, Self::Coefficient>,
             Othr::EntryMajor: KeyValGet<Othr::ColIndex, Othr::Coefficient>,
             Othr::ColIndex: Clone,
             Othr::Coefficient: Clone,
             RingOperator: Clone + Semiring<Self::Coefficient>,
             OrderOperatorRowEntries: Clone + JudgePartialOrder<Othr::EntryMajor> { ... }
    fn umatch<Other, RingOperator, OrderOperatorRowIndex, OrderOperatorColIndex, IterRowIndex>(
        self,
        iter_keymaj: IterRowIndex,
        ring_operator: RingOperator,
        order_operator_RowIndex: OrderOperatorRowIndex,
        order_operator_ColIndex: OrderOperatorColIndex,
    ) -> Umatch<Self, RingOperator, OrderOperatorByKeyCutsom<Self::ColIndex, Self::Coefficient, Self::EntryMajor, OrderOperatorColIndex>, OrderOperatorByKeyCutsom<Self::RowIndex, Self::Coefficient, Self::EntryMinor, OrderOperatorRowIndex>>
       where Self: Sized + ViewRowAscend + IndicesAndCoefficients,
             IterRowIndex: Iterator<Item = Self::RowIndex>,
             Self::ColIndex: Clone + Hash + Eq + Debug,
             Self::RowIndex: Clone + Hash + Eq + Debug,
             Self::Coefficient: Clone + Debug,
             RingOperator: Clone + Semiring<Self::Coefficient> + Ring<Self::Coefficient> + DivisionRing<Self::Coefficient>,
             Self::ViewMajorAscend: Clone,
             Self::ViewMajorAscendIntoIter: Clone,
             Self::EntryMajor: KeyValSet<Self::ColIndex, Self::Coefficient> + Debug + Clone,
             OrderOperatorColIndex: Clone + JudgePartialOrder<Self::ColIndex>,
             OrderOperatorRowIndex: Clone + JudgePartialOrder<Self::RowIndex> { ... }
    fn transpose(self) -> Transpose<Self>
       where Self: Sized { ... }
    fn transpose_ref(&self) -> Transpose<&Self> { ... }
    fn antitranspose(self) -> AntiTranspose<Self>
       where Self: Sized { ... }
    fn antitranspose_ref(&self) -> AntiTranspose<&Self>
       where Self: Sized { ... }
    fn reverse(self) -> Reverse<Self>
       where Self: Sized { ... }
    fn reverse_ref(&self) -> Reverse<&Self> { ... }
}
Expand description

Convenient methods for matrix operations

Provided Methods§

Source

fn multiply_left<Othr, RingOperator, OrderOperator>( self, other: Othr, ring_operator: RingOperator, order_operator: OrderOperator, ) -> ProductMatrix<Self, Othr, RingOperator, OrderOperator>
where Self: ViewRowAscend + IndicesAndCoefficients + Sized, Othr: ViewRowAscend + IndicesAndCoefficients<Coefficient = Self::Coefficient, RowIndex = Self::ColIndex>, Self::ViewMajorAscend: IntoIterator, Othr::ViewMajorAscend: IntoIterator, Self::EntryMajor: KeyValGet<Self::ColIndex, Self::Coefficient>, Othr::EntryMajor: KeyValGet<Othr::ColIndex, Othr::Coefficient>, Othr::ColIndex: Clone, Othr::Coefficient: Clone, RingOperator: Clone + Semiring<Self::Coefficient>, OrderOperator: Clone + JudgePartialOrder<Othr::EntryMajor>,

Lefthand matrix multiplication

Returns self * other

Source

fn multiply_right<Othr, RingOperator, OrderOperator>( self, other: Othr, ring_operator: RingOperator, order_operator: OrderOperator, ) -> ProductMatrix<Othr, Self, RingOperator, OrderOperator>
where Self: ViewRowAscend + IndicesAndCoefficients + Sized, Othr: ViewRowAscend + IndicesAndCoefficients<Coefficient = Self::Coefficient, ColIndex = Self::RowIndex>, Self::ViewMajorAscend: IntoIterator, Othr::ViewMajorAscend: IntoIterator, Self::EntryMajor: KeyValGet<Self::ColIndex, Self::Coefficient>, Othr::EntryMajor: KeyValGet<Othr::ColIndex, Othr::Coefficient>, Self::ColIndex: Clone, Self::Coefficient: Clone, RingOperator: Clone + Semiring<Self::Coefficient>, OrderOperator: Clone + JudgePartialOrder<Self::EntryMajor>,

Righthand matrix multiplication

Returns other * self

Source

fn multiply_left_packet<Othr, RingOperator, OrderOperatorRowEntries, OrderOperatorColEntries>( self, other: MatrixAlgebraPacket<Othr, RingOperator, OrderOperatorRowEntries, OrderOperatorColEntries>, ) -> ProductMatrix<Self, Othr, RingOperator, OrderOperatorRowEntries>
where Self: ViewRowAscend + IndicesAndCoefficients + Sized, Othr: ViewRowAscend + IndicesAndCoefficients<Coefficient = Self::Coefficient, RowIndex = Self::ColIndex>, Self::ViewMajorAscend: IntoIterator, Othr::ViewMajorAscend: IntoIterator, Self::EntryMajor: KeyValGet<Self::ColIndex, Self::Coefficient>, Othr::EntryMajor: KeyValGet<Othr::ColIndex, Othr::Coefficient>, Othr::ColIndex: Clone, Othr::Coefficient: Clone, RingOperator: Clone + Semiring<Self::Coefficient>, OrderOperatorRowEntries: Clone + JudgePartialOrder<Othr::EntryMajor>,

Lefthand matrix multiplication

Returns self * other, where other is a matrix “packet,” containing a matrix, a ring operator, and order operators for row and column entries.

Note There is no corresponding function multiply_right_packet, because we need an order operator from the packet to combine entries

Source

fn umatch<Other, RingOperator, OrderOperatorRowIndex, OrderOperatorColIndex, IterRowIndex>( self, iter_keymaj: IterRowIndex, ring_operator: RingOperator, order_operator_RowIndex: OrderOperatorRowIndex, order_operator_ColIndex: OrderOperatorColIndex, ) -> Umatch<Self, RingOperator, OrderOperatorByKeyCutsom<Self::ColIndex, Self::Coefficient, Self::EntryMajor, OrderOperatorColIndex>, OrderOperatorByKeyCutsom<Self::RowIndex, Self::Coefficient, Self::EntryMinor, OrderOperatorRowIndex>>
where Self: Sized + ViewRowAscend + IndicesAndCoefficients, IterRowIndex: Iterator<Item = Self::RowIndex>, Self::ColIndex: Clone + Hash + Eq + Debug, Self::RowIndex: Clone + Hash + Eq + Debug, Self::Coefficient: Clone + Debug, RingOperator: Clone + Semiring<Self::Coefficient> + Ring<Self::Coefficient> + DivisionRing<Self::Coefficient>, Self::ViewMajorAscend: Clone, Self::ViewMajorAscendIntoIter: Clone, Self::EntryMajor: KeyValSet<Self::ColIndex, Self::Coefficient> + Debug + Clone, OrderOperatorColIndex: Clone + JudgePartialOrder<Self::ColIndex>, OrderOperatorRowIndex: Clone + JudgePartialOrder<Self::RowIndex>,

Returns a U-match factorization

The argument iter_keymaj must run over row indices in strictly descending order, as determined by order_operator_RowIndex.

Source

fn transpose(self) -> Transpose<Self>
where Self: Sized,

Source

fn transpose_ref(&self) -> Transpose<&Self>

Source

fn antitranspose(self) -> AntiTranspose<Self>
where Self: Sized,

Wraps self in a crate::algebra::matrices::types::transpose::Transpose struct.

§Caution

There are three important differences between AntiTranspose and the matrix returned by antitranspose_deep:

  • AntiTranspose is a lazy object that does not generate new data
  • The set of (key,val) pairs that appear in a major (respectively, minor) view of AntiTranspose::new(matrix) are the same as the entries in a minor (respectively, major) view of matrix; only the sequence in which those entries appear is different. By contrast, the keys in the (key,val) pairs of matrix.antitranspose_deep() are different; they are obtained by subtracting the original keys from (# rows in the antitransposed matrix - 1).
  • For this reason, matrix.antitranspose_deep() is only available for very specific types of matrices; AntiTranspose is available for a much broader class.
Source

fn antitranspose_ref(&self) -> AntiTranspose<&Self>
where Self: Sized,

Source

fn reverse(self) -> Reverse<Self>
where Self: Sized,

Source

fn reverse_ref(&self) -> Reverse<&Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Matrix> MatrixOperations for Matrix