@@ -31,14 +31,15 @@ def random_clifford_circuit_with_mid_measurement(num_qubits, depth):
31
31
gate_name = np .random .choice (clifford_one_qubit_gates )
32
32
getattr (c , gate_name )(j )
33
33
operation_list .append ((gate_name , (j ,)))
34
- measured_qubit = np .random .randint (0 , num_qubits - 1 )
35
- sample , p = c .measure_reference (measured_qubit , with_prob = True )
36
- # Check if there is a non-zero probability to measure "0" for post-selection
37
- if (sample == "0" and not np .isclose (p , 0.0 )) or (
38
- sample == "1" and not np .isclose (p , 1.0 )
39
- ):
40
- c .mid_measurement (measured_qubit , keep = 0 )
41
- operation_list .append (("M" , (measured_qubit ,)))
34
+ if np .random .uniform () < 0.2 :
35
+ measured_qubit = np .random .randint (0 , num_qubits - 1 )
36
+ sample , p = c .measure_reference (measured_qubit , with_prob = True )
37
+ # Check if there is a non-zero probability to measure "0" for post-selection
38
+ if (sample == "0" and not np .isclose (p , 0.0 )) or (
39
+ sample == "1" and not np .isclose (p , 1.0 )
40
+ ):
41
+ c .mid_measurement (measured_qubit , keep = 0 )
42
+ operation_list .append (("M" , (measured_qubit ,)))
42
43
return c , operation_list
43
44
44
45
@@ -117,9 +118,9 @@ def simulate_stim_circuit_with_mid_measurement(stim_circuit):
117
118
118
119
if __name__ == "__main__" :
119
120
# Number of qubits
120
- num_qubits = 10
121
+ num_qubits = 12
121
122
# Depth of the circuit
122
- depth = 30
123
+ depth = 24
123
124
# index list that is traced out to calculate the entanglement entropy
124
125
cut = [i for i in range (num_qubits // 3 )]
125
126
0 commit comments