13.20 Tensor Contraction Verification Procedure
Tensor Contraction Verification Procedure ensures accurate calculation of tensor invariants by systematically validating contraction operations within algebraic structures.
Tensor Contraction Verification Procedure is the systematic set of checks applied to a completed tensor contraction, or to an entire sequence of contractions, to confirm that the operation has been carried out correctly, covering index consistency, type correctness, and numerical or symbolic agreement with an independently computed reference value.
Definition
Given a claimed result produced by contracting one or more tensors, the verification procedure is a finite ordered set of tests , each returning pass or fail, such that is accepted as correct only if every test in the set passes:
Core Checks in the Procedure
Index Consistency Check
Confirm that every free index in the original expression appears exactly once, with the correct variance, among the indices of , and that every dummy index used in intermediate steps has been fully summed away and does not appear in .
Type Correctness Check
Verify that the type pair of matches the value predicted by the type pair update rule applied to the original tensors' types and the number of contractions performed:
for a sequence of contractions starting from an original type .
Component-Level Spot Check
Select a small number of specific index value assignments for the free indices of , compute the corresponding component by direct summation from the original tensors, and confirm agreement with the claimed value at those spot-checked positions.
Alternative Grouping Cross-Check
Recompute the same contraction using a different, independently valid grouping or ordering, relying on result preservation to guarantee agreement, and confirm that the two independently obtained results match exactly.
Procedure Flow
Interpreting Failures
Localizing an Error
If the type correctness check fails, the error most likely lies in miscounting how many contractions were performed or in the recorded type of the original tensors. If the alternative grouping cross-check fails while the type check passes, the error most likely lies in the specific arithmetic of one grouping rather than in the overall structure of the expression.
Distinguishing Structural From Numerical Errors
The index consistency and type correctness checks catch structural errors, such as an incorrectly placed or omitted index, while the spot check and cross-check catch numerical errors that could arise even when the structure of the expression is entirely correct.
Purpose
The verification procedure provides a disciplined method for establishing confidence in a contraction result independent of the specific method used to compute it, complementing the simplification procedure and cost analysis by ensuring that any performance or notational optimization applied along the way has not introduced an error into the final tensor.