einsums::compute_graph::contribution_symmetry#
Note
Generated from the C++ headers by apiary --emit-cpp-docs-json.
Defined in header Einsums/ComputeGraph/SymmetryRules.hpp.
-
std::optional<SymmetryOp> contribution_symmetry(const EscapeAnalysis &escape, NodeId writer, const SymmetryOp &sigma, std::vector<std::pair<TensorId, SymmetryDescriptor>> *relied_on)#
Is what
writeradds to its output unchanged, up to a sign, when its output’s axes are permuted bysigma?The question a pass asks before computing half of a contraction and permuting the rest from it. It is asked of the CONTRIBUTION, the term
writeradds, not of the output tensor, which may hold anything else as well.An operand of
writerthat exactly one einsum writes, by overwriting it, is replaced by that einsum’s own operands, and so on down, so a chain of contractions is judged as the one expression it computes. The density-fitted particle ladder,H= B tau thenR+= H B, is judged asR+= B tau B. The remaining factors are then matched against their own images: the contribution is unchanged when some relabeling of the summed letters, together withsigmaon the output letters, carries every factor onto a factor of the same tensor, up to an element of that tensor’s symmetry group as it stands where it is read (symmetry_at). On the ladder the relabeling exchanges e and f, the two B factors trade places, and tau’s (i,a)-(j,b) exchange absorbs the rest.Proof, not evidence: every step is an identity the operands satisfy, so a positive answer holds for all values. A negative one may be conservative: the search takes generators as declared and gives up on anything conjugated.
- Parameters:
escape – The analysis of the graph
writerbelongs to.writer – An einsum node.
sigma – The permutation of the output’s positions, in the convention of
SymmetryOp: positionptakes the letter atsigma.permutation[p]. Its sign and conjugate fields are ignored.relied_on – When given, receives the declared symmetries the proof rests on, as
symmetry_atreports them, each tensor once.
- Returns:
sigmawith the sign the contribution picks up (+1 symmetric, -1 antisymmetric), or nothing when no proof was found.