Problem
I’m checking if all k-qubit subsets of a n-qubit stabilizer state are maximally mixed.
Approach that works, but is slow
The following approach works. But it's numerically painful, so I'm looking stim tricks or some lin alg result that may help me.
- List the stabilizer states generators in their binary symplectic representation.
- Pick n-k qubits to trace out. Remove the columns corresponding to those n-k qubits.
- Calculate the rank of the remaining matrix. From the rank the entanglement entropy follows. Check if the EE is maximized.
- Repeat for all choices of n-k qubits.
This works, but scales as O(n choose k) O(n^3). Here's my simple stim code:
tab = stim.TableauSimulator()
## (Add gates here)
tableau = tab.current_inverse_tableau()**-1
==============================================================================
Get binary symplectic rep. of the generators (i.e. tableau's z_output)
==============================================================================
gens = np.array([tableau.z_output(m) for m in range(len(tableau))])
N = len(gens)
BSR = np.zeros((N, 2*N), dtype=int)
BSR[:, :N] = (gens == 1) | (gens == 2) # Fill first N columns with 1 if gens = 1 or 2 (i.e. X part)
BSR[:, N:] = (gens == 2) | (gens == 3) # Fill next N columns with 1 if gens = 2 or 3 (i.e. Z part)
==============================================================================
Find smallest rank for all possible k
==============================================================================
ranks = []
comb_array = np.array(list(combinations(range(N), k)))
for columns_to_keep in comb_array:
RM = BSR[:, np.concatenate([columns_to_keep, N + columns_to_keep])].astype(int)
ranks.append(np.linalg.matrix_rank(RM))
rank = min(ranks)
I was thinking there might be a more clever way to use stim to get the answer.
Stated as a purely lin alg problem
I have an n by 2n binary matrix. For example:
[[1 0 1 0 1 0 1 0 0 0 0 0 0 0]
[0 1 1 0 0 1 1 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 1 1 1 0 0 0 0]
[0 0 0 1 1 1 1 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 1 0 0 1 1 0 0]
[0 0 0 0 0 0 0 0 1 0 1 0 1 0]
[0 0 0 0 0 0 0 1 1 0 1 0 0 1]]
I pick a number between 0 and n, which I call k. I find the combination of 2k columns of the matrix which have the minimum rank. In this case it be, for k =3:
[[1 0 1 0 0 0]
[0 1 1 0 0 0]
[0 0 0 1 1 1]
[0 0 0 0 0 0]
[0 0 0 1 0 0]
[0 0 0 0 1 0]
[0 0 0 1 1 0]]
My only restriction is that if I choose column j I need to also include column j + n.