@@ -69,8 +69,8 @@ def get_binary_matrix(z_stabilizers):
69
69
70
70
def get_cut_binary_matrix (binary_matrix , cut ):
71
71
N = len (binary_matrix )
72
- new_indices = [i for i in range (N ) if i not in set (cut )] + [
73
- i + N for i in range (N ) if i not in set (cut )
72
+ new_indices = [i for i in range (N ) if i in set (cut )] + [
73
+ i + N for i in range (N ) if i in set (cut )
74
74
]
75
75
return binary_matrix [:, new_indices ]
76
76
@@ -117,11 +117,11 @@ def simulate_stim_circuit_with_mid_measurement(stim_circuit):
117
117
118
118
if __name__ == "__main__" :
119
119
# Number of qubits
120
- num_qubits = 8
120
+ num_qubits = 10
121
121
# Depth of the circuit
122
- depth = 10
122
+ depth = 30
123
123
# index list that is traced out to calculate the entanglement entropy
124
- cut = [i for i in range (num_qubits // 2 )]
124
+ cut = [i for i in range (num_qubits // 3 )]
125
125
126
126
tc_circuit , op_list = random_clifford_circuit_with_mid_measurement (
127
127
num_qubits , depth
@@ -134,8 +134,8 @@ def simulate_stim_circuit_with_mid_measurement(stim_circuit):
134
134
stabilizer_tableau = simulate_stim_circuit_with_mid_measurement (stim_circuit )
135
135
zs = [stabilizer_tableau .z_output (k ) for k in range (len (stabilizer_tableau ))]
136
136
binary_matrix = get_binary_matrix (zs )
137
- bipartite_matrix = get_cut_binary_matrix (binary_matrix , cut )
138
- stim_entropy = (gf2_rank (bipartite_matrix .tolist ()) - len (cut )) * np .log (2 )
137
+ cur_matrix = get_cut_binary_matrix (binary_matrix , cut )
138
+ stim_entropy = (gf2_rank (cur_matrix .tolist ()) - len (cut )) * np .log (2 )
139
139
print ("Stim Entanglement Entropy:" , stim_entropy )
140
140
141
141
# Entanglement entropy calculation using TensorCircuit
0 commit comments