Tensor-network contraction order
The sequence of tensor combinations that determines intermediate sizes and computational cost in a network calculation.
On this page
Definition, purpose and input assumptions
A tensor network can describe one mathematical quantity while admitting many contraction orders. These orders can differ dramatically in peak memory and arithmetic work. Choosing an order is therefore central to classical simulation performance, separate from the quantum circuit's physical execution order.
Mathematical mechanism
Contracting two tensors sums over shared indices and creates a tensor over the remaining indices. A poor choice can form a large intermediate that a better sequence avoids. The optimal strategy depends on graph structure and index dimensions; finding it can itself be computationally difficult.
Fully solved reference example
Consider ordinary matrices A of size 100 by 2, B of size 2 by 100 and C of size 100 by 2. Computing(AB)C first forms a100 by 100 intermediate. The two multiplications require approximately 20,000 and 20,000 scalar multiply-accumulate terms, totaling40,000. Computing A(BC) first forms a2 by 2 intermediate, with about 400 operations for BC and 400 for A times that result, totaling800.
Both orders yield the same100 by 2 matrix in exact arithmetic. The factor 50 difference comes entirely from contraction order. Floating-point summation order can additionally change small numerical errors, so algebraic equality does not imply bitwise identical output.
Limitations and classical comparison
This matrix example is not a quantum advantage benchmark. In circuit networks, the same principle applies to many indices, but complexity can still grow exponentially for difficult structures. Report contraction strategy, approximation, hardware and target output when comparing simulator performance.
Scientific relationships
Contraction order is a computational component of tensor-network simulation and differs from circuit depth. It interacts with bond dimension and numerical precision rather than changing the simulated physics.
A closed tensor loop with two very different schedules
Consider the scalar contraction Σijkl Aij Bjk Ckl Dli, with dimensions i=8,j=2,k=9,l=3. The matrices have shapes A:8×2, B:2×9, C:9×3, D:3×8. There are no open indices, so the final result is one scalar, but intermediate sizes depend strongly on how the loop is contracted.
One schedule forms AB with shape 8×9, requiring 8·2·9=144 scalar multiplications, and CD with shape 9×8, requiring 9·3·8=216. Contracting these two intermediates over their seventy-two paired entries takes another seventy-two multiplications. The total is 432, and both intermediates together contain 144 scalar entries if retained simultaneously. The final scalar output does not prevent this much larger temporary storage.
A different schedule forms DA with shape 3×2 and BC with shape 2×3. Their multiplication counts are 3·8·2=48 and 2·9·3=54. The final scalar is Σlj(DA)lj(BC)jl, requiring six more multiplications. The total is 108, with only twelve entries in the two retained intermediates. These are exact dense multiplication counts for the stated schedules, excluding input storage and scalar additions.
The corresponding addition counts also differ. The smaller schedule uses forty-two additions for DA, forty-eight for BC, and five for the final sum, totaling ninety-five. The larger schedule uses seventy-two, 144, and seventy-one, totaling 287. A multiply-accumulate convention would report different numerical totals, so a resource table should identify what it counts. Neither schedule is asserted to be a globally optimal contraction algorithm for every representation of these tensors.
Why quantum time order does not constrain this algebraic order
The network scalar can represent a quantum amplitude, overlap, or expectation after its tensors and boundaries are specified. Its contraction order is a classical evaluation schedule for a fixed sum. It does not physically move quantum gates past noncommuting gates. The operator ordering is already encoded in the tensor connections and index labels, which remain unchanged while sums are regrouped.
A complex-valued tensor contraction also does not insert conjugation automatically. If the intended quantity contains a bra, its tensors must already be conjugated and wired accordingly. The scalar expression above is an ordinary product contraction. Replacing one factor by its conjugate because it resembles an inner product would change the mathematical network, even though the dimensions still match.
For an expectation value, a doubled circuit network can contain cancellations between a gate and its adjoint outside the observable's relevant causal region. Recognizing those cancellations can reduce the network before choosing a contraction path. Such simplification depends on the actual circuit, observable, and channel structure; it is not justified merely because the final output is scalar.
Slicing the loop and separating memory from arithmetic
Another schedule fixes i to each of its eight values. For each slice, contract the length-two row A_i with B, obtaining a length-nine vector at cost eighteen multiplications. Contract C with the length-three column D_i, obtaining another length-nine vector at cost twenty-seven. Their dot product takes nine multiplications. Summing the eight slice results therefore uses 432 multiplications, the same as the larger unsliced schedule, plus the final accumulation additions.
The two live slice vectors contain eighteen entries rather than 144. Slicing has reduced temporary memory without reducing that schedule's arithmetic count. The earlier DA/BC schedule is still better for this particular loop, using 108 multiplications and twelve intermediate entries. This comparison prevents treating slicing as an automatic overall optimum; it is one tool for a memory-work tradeoff.
Different slices can be evaluated independently in exact arithmetic, but numerical accumulation and any approximate tensor truncation remain separate issues. If a common subnetwork is reused across slices, caching can change the arithmetic count and memory requirement. A complete estimate should state which intermediates are retained, recomputed, or shared.
Graph structure, outputs, and numerical accuracy
In a general network, eliminating an index can connect several surviving indices through a new intermediate tensor. This fill-in may create large dimension products even when the initial graph is sparse. Graph width measures can help organize the analysis, but nonuniform bond dimensions require weighted costs, and different graph representations can encode different elimination problems. Counting only vertices or original qubits can miss the dominant intermediate.
The requested output also changes the problem. Leaving all final qubit indices open produces a statevector whose storage is already exponential in qubit count. Fixing one bitstring gives an amplitude scalar; computing an expectation introduces an observable and usually a conjugate network. Efficient evaluation of one selected amplitude is not automatically efficient exact sampling from the full distribution, which can require additional conditional computations.
All schedules are equal in exact arithmetic, but floating-point summation order changes rounding. Truncating a singular-value decomposition introduces a further approximation, unlike exact reshaping, gauge transformation, or slicing. A numerical comparison should distinguish contraction-path error from deliberate rank truncation and verify the requested observable or amplitude within the stated tolerance.
Sources
Verification scope
Selected source text checked ·
Efficient simulation relies on controlled entanglement or bond dimensions; no universal small-memory guarantee.
Verification scope
Full-text source check ·
ArXiv metadata verifies authors, first submission, revision, journal volume and DOI. Contraction-tree and slicing framework inspected; finite examples here independently derived. Publisher page independently confirms publication on 2021-03-15; slicing section 4.7.1 inspected.
No published benchmark is reproduced or extrapolated to the reference examples. PDF text date March 12 differs from arXiv revision March 11 and journal publication date March 15; these date types are kept separate.