Skip to content

Commit 6251328

Browse files
Avoid edge case (trivial to handle ad hoc)
1 parent ac8338f commit 6251328

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

scripts/otoc_validation.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,16 @@ def main():
193193
for cycle in range(cycles):
194194
otoc &= ising
195195
# Add the out-of-time-order perturbation
196-
string = []
197-
for q in range(n_qubits):
198-
if np.random.random() < butterfly_fraction:
199-
string += np.random.choice(ops)
200-
else:
201-
string += ['I']
202-
pauli_strings.append("".join(string))
196+
string = 'I' * n_qubits
197+
while string == ('I' * n_qubits):
198+
string_list = []
199+
for q in range(n_qubits):
200+
if np.random.random() < butterfly_fraction:
201+
string_list += np.random.choice(ops)
202+
else:
203+
string_list += ['I']
204+
string = "".join(string_list)
205+
pauli_strings.append(string)
203206
act_string(otoc, string)
204207
# Add the time-reversal of the Trotterization
205208
otoc &= ising_dag

0 commit comments

Comments
 (0)