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:
- Simplify the LHS with the contraction
ijk->jk - Don’t simplify the RHS
- Use HadamardProductGeneral to compute
jk,kj->jk
A second example is the contraction iij,jkk->ik:
- Simplify the LHS with the contraction
iij->ij - Simplify the RHS with the contraction
jkk->jk - 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: StringImplementations§
Source§impl<A> PairContraction<A>
impl<A> PairContraction<A>
pub fn new(sc: &SizedContraction) -> Self
Trait Implementations§
Source§impl<A> Debug for PairContraction<A>
impl<A> Debug for PairContraction<A>
Source§impl<A> PairContractor<A> for PairContraction<A>
impl<A> PairContractor<A> for PairContraction<A>
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,
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> 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
Mutably borrows from an owned value. Read more