[−][src]Module ndarray_einsum_beta::contractors
Implementations of the base-case singleton and pair contractors for different types of contractions.
This module defines the SingletonViewer
, SingletonContractor
, and PairContractor
traits as well
as the generic "container" objects EinsumPath
, SingletonContraction
, and PairContraction
that
hold Box
ed trait objects of the specific cases determined at runtime to be most appropriate
for the requested contraction.
The specific singleton and pair contractors defined in the singleton_contractors
and
pair_contractors
submodules implement the relevant traits defined here. The six specific singleton
contractors defined in singleton_contractors
perform some combination of permutation of the input
axes (e.g. ijk->jki
), diagonalization across repeated but un-summed axes (e.g. ii->i
), and
summation across axes not present in the output index list (e.g. ijk->j
). Not all of the nine
pair contractors defined in pair_contractors
are currently used as some appear to be slower than others.
Each struct implementing one of the *Contractor
traits performs all the "setup work"
required to perform the actual contraction. For example, HadamardProductGeneral
permutes
the input and output tensors and then computes the element-wise product of the two tensors.
Given a SizedContraction
(but no actual tensors), HadamardProductGeneral::new()
figures out
the permutation orders that will be needed so that contract_pair
can simply execute the two
permutations and then produce the element-wise product. This can be thought of as a way of
compiling the einsum
string into a set of instructions and the EinsumPath
object
can be thought of as an AST that is ready to compute a contraction when supplied with an
actual set of operands to contract.
Re-exports
pub use pair_contractors::TensordotGeneral; |
Modules
pair_contractors | Contains the specific implementations of |
singleton_contractors | Contains the specific implementations of |
strategies | This module contains the "strategy choice" logic for which specific contractor should be used for a given mini-contraction. |
Structs
EinsumPath | An |
PairContraction | Holds a |
SimplificationMethodAndOutput | Holds an |
SingletonContraction | Holds a |
Enums
EinsumPathSteps | Either a singleton contraction, in the case of a single input operand, or a list of pair contractions, given two or more input operands |
Traits
PairContractor |
|
SingletonContractor |
|
SingletonViewer |
|