|q⟩ Bad Qubits

advanced · Programming · Tensor Networks & Simulation Methods

Simulating Circuits with MPS

A matrix product state is not just a static snapshot — you can evolve it by applying gates directly to its tensors, never forming the 2n2^n state vector. This is the basis of MPS circuit simulation (Vidal's TEBD algorithm), and it lets a laptop simulate hundreds of qubits as long as the entanglement stays bounded.

Single-qubit gates are local and free

A single-qubit gate GG acting on site kk touches only that site's tensor. You contract the gate's 2×22\times 2 matrix with the physical index of A[k]A^{[k]}:

A~αkαk+1[k]sk=skGskskAαkαk+1[k]sk.\tilde{A}^{[k]\,s_k}_{\alpha_k \alpha_{k+1}} = \sum_{s_k'} G_{s_k s_k'}\, A^{[k]\,s_k'}_{\alpha_k \alpha_{k+1}} .

Only one tensor changes, the bond dimensions are untouched, and a single-qubit gate cannot create entanglement. Applying nn single-qubit gates costs O(nχ2)O(n\chi^2) — cheap, and the bond dimension never grows. This matches physical intuition: local rotations do not correlate distant qubits.

Two-qubit gates can grow the bond — and SVD trims it

A gate on neighbouring sites k,k+1k, k+1 is where the action is. The standard recipe has three steps:

  1. Merge. Contract the two site tensors over their shared bond into one four-index block Θ\Theta, then apply the two-qubit gate to its two physical indices.
  2. Split. Reshape Θ\Theta into a matrix grouping (left bond, site kk) against (site k+1k+1, right bond) and take its SVD, Θ=USV\Theta = U S V^\dagger. The new middle bond carries the singular values SS, and its size is the Schmidt rank of the updated state across that cut.
  3. Truncate. If that rank exceeds your bond-dimension budget χmax\chi_{\max}, keep only the χmax\chi_{\max} largest singular values and discard the rest, then renormalise.

A two-qubit gate can double the local bond dimension, because it can entangle the two sites further. Left unchecked, repeated entangling gates push χ\chi up exponentially — which is exactly the regime where MPS stops being efficient.

Non-adjacent gates need SWAPs

The merge-split recipe assumes the two qubits are neighbours on the chain. A gate between distant qubits is handled by SWAP gates that walk one qubit along the chain until it is adjacent to its partner, applying the gate, then swapping back. Each SWAP is itself a two-qubit gate and can raise the bond dimension of the bonds it crosses, so long-range gates are more expensive than nearest-neighbour ones. This is one reason MPS favours circuits with local, low-depth structure.

Reading out results

Once the circuit is applied, observables come from contractions of the final MPS:

When MPS matches the exact simulator

For the small, weakly entangled circuits in this course an MPS simulation with a large enough χ\chi reproduces the state-vector simulator exactly — every amplitude agrees to machine precision because no singular values had to be truncated. The power of the method appears at larger nn, where the state vector is unaffordable but a bounded-χ\chi MPS still fits in memory. Knowing when the required χ\chi stays bounded is the judgement call we sharpen in the rest of the module.

Sign in on the full site to ask questions and join the discussion.