Problem 331375 · medium · Quantum Computing · Level 03 Entanglement

Cutting the Register in Two

Schmidt decomposition · singular values · entanglement entropy · bipartition · numpy

Cut an n-qubit register into two parts: part A is qubits 0, \dots, m-1 and part B is qubits m, \dots, n-1. How entangled are the two parts?

A state is a list state of 2^n complex amplitudes; basis state |b_0 b_1 \dots b_{n-1}\rangle has index int("b0b1...", 2), so qubit 0 is the leftmost bit (in 3 qubits, |011\rangle is index 3). Every index is then the bits of part A followed by the bits of part B. Write it as the 2^m \times 2^{n-m} matrix

M[x][y] = \texttt{state}[x \cdot 2^{n-m} + y],

where row x is the basis state of part A and column y that of part B. The Schmidt coefficients of the cut are the singular values of M that are greater than 1e-9 (an absolute tolerance), largest first; how many there are is the Schmidt rank. Rank 1 means the two parts are a product state, |\psi_A\rangle \otimes |\psi_B\rangle; a larger rank means they are entangled. For a normalised state the squared coefficients \lambda_k = s_k^2 add up to 1, and the entanglement entropy

E = -\sum_k \lambda_k \log_2 \lambda_k

is 0 for a product and 1 for a maximally entangled pair of qubits.

This problem is the one where numpy is the tool: np.linalg.svd(M, compute_uv=False) returns the singular values of a matrix, largest first.

Write cut_report(state, m) that returns a pair (coeffs, entropy): the list of Schmidt coefficients and the entanglement entropy (a sum over those coefficients only).

Examples

Input:  state = [0.7071067811865476, 0, 0, 0.7071067811865476], m = 1
Output: ([0.7071067811865476, 0.7071067811865476], 1.0)

Input:  state = [0.7071067811865476, 0.7071067811865476, 0, 0], m = 1
Output: ([1.0], 0.0)
Explanation: this is |0> times (|0> + |1>) / sqrt(2): a product.

Input:  state = [0.7071067811865476, 0, 0, 0, 0, 0, 0.7071067811865476, 0], m = 1
Output: ([0.7071067811865476, 0.7071067811865476], 1.0)
Explanation: (|000> + |110>) / sqrt(2): qubits 0 and 1 are entangled with each other,
qubit 2 is |0> by itself. Cutting after qubit 0 separates an entangled pair;
cutting after qubit 1 (m = 2) gives ([1.0], 0.0).

Constraints

  • the state has 2 to 10 qubits; 1 <= m <= n - 1
  • answers are compared with a tolerance of 1e-6 (an entropy of -6e-16 counts as 0.0)

Goals

  • Reshape an n-qubit state into the matrix of a cut: first m qubits against the rest
  • Read the Schmidt coefficients off the singular values with np.linalg.svd
  • Measure how entangled the two halves are with the entanglement entropy
Starting Python…