Skip to content

Commit

Permalink
Remove dependency to deprecated Cirq internal function
Browse files Browse the repository at this point in the history
  • Loading branch information
cosenal authored and natestemen committed Jun 27, 2024
1 parent be16b7b commit 6c07441
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions mitiq/benchmarks/randomized_benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import numpy as np
from cirq.experiments.qubit_characterizations import (
_find_inv_matrix,
_gate_seq_to_mats,
_reduce_gate_seq,
_single_qubit_cliffords,
_two_qubit_clifford,
_two_qubit_clifford_matrices,
Expand Down Expand Up @@ -60,20 +60,14 @@ def generate_rb_circuits(
rng = np.random.RandomState(seed)
if n_qubits == 1:
c1 = cliffords.c1_in_xy
cfd_mat_1q = np.array(
[_gate_seq_to_mats(gates) for gates in c1], dtype=np.complex64
)
circuits = []
clifford_group_size = 24
for _ in range(trials):
gate_ids = list(rng.choice(clifford_group_size, num_cliffords))
gate_sequence = [
gate for gate_id in gate_ids for gate in c1[gate_id]
]
idx = _find_inv_matrix(
_gate_seq_to_mats(gate_sequence), cfd_mat_1q
)
gate_sequence.extend(c1[idx])
gate_sequence.append(_reduce_gate_seq(gate_sequence) ** -1)
circuits.append(
cirq.Circuit(gate(qubits[0]) for gate in gate_sequence)
)
Expand Down

0 comments on commit 6c07441

Please sign in to comment.