PairContraction

Struct PairContraction 

Source
pub struct PairContraction<A> {
    lhs_simplification: Option<SimplificationMethodAndOutput<A>>,
    rhs_simplification: Option<SimplificationMethodAndOutput<A>>,
    method: PairMethod,
    op: Box<dyn PairContractor<A>>,
    simplified_einsum_string: String,
}
Expand description

Holds a Boxed PairContractor trait object and two Option<Box>ed simplifications for the LHS and RHS tensors.

For example, the contraction ijk,kj->jk will currently be performed as follows:

  1. Simplify the LHS with the contraction ijk->jk
  2. Don’t simplify the RHS
  3. Use HadamardProductGeneral to compute jk,kj->jk

A second example is the contraction iij,jkk->ik:

  1. Simplify the LHS with the contraction iij->ij
  2. Simplify the RHS with the contraction jkk->jk
  3. Use TensordotGeneral to compute ij,jk->ik

Since the axis lengths aren’t known until runtime, and the actual einsum string may not be either, it is generally not possible to know at compile time which specific PairContractor will be used to perform a given contraction, or even which contractions will be performed; the optimizer could choose a different order.

Fields§

§lhs_simplification: Option<SimplificationMethodAndOutput<A>>§rhs_simplification: Option<SimplificationMethodAndOutput<A>>§method: PairMethod§op: Box<dyn PairContractor<A>>§simplified_einsum_string: String

Implementations§

Source§

impl<A> PairContraction<A>

Source

pub fn new(sc: &SizedContraction) -> Self

Trait Implementations§

Source§

impl<A> Debug for PairContraction<A>

Source§

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

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

impl<A> PairContractor<A> for PairContraction<A>

Source§

fn contract_pair<'a, 'b, 'c, 'd>( &self, lhs: &'b ArrayViewD<'a, A>, rhs: &'d ArrayViewD<'c, A>, ) -> ArrayD<A>
where A: Clone + LinalgScalar, 'a: 'b, 'c: 'd,

Source§

fn contract_and_assign_pair<'a, 'b, 'c, 'd, 'e, 'f>( &self, lhs: &'b ArrayViewD<'a, A>, rhs: &'d ArrayViewD<'c, A>, out: &'f mut ArrayViewMutD<'e, A>, )
where A: Clone + LinalgScalar, 'a: 'b, 'c: 'd, 'e: 'f,

Auto Trait Implementations§

§

impl<A> Freeze for PairContraction<A>

§

impl<A> !RefUnwindSafe for PairContraction<A>

§

impl<A> !Send for PairContraction<A>

§

impl<A> !Sync for PairContraction<A>

§

impl<A> Unpin for PairContraction<A>

§

impl<A> !UnwindSafe for PairContraction<A>

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> 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, 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.