From 6c0744161bbe121975a260f921267ba764bb59c7 Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Mon, 24 Jun 2024 16:09:03 +0200 Subject: [PATCH] Remove dependency to deprecated Cirq internal function --- mitiq/benchmarks/randomized_benchmarking.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/mitiq/benchmarks/randomized_benchmarking.py b/mitiq/benchmarks/randomized_benchmarking.py index 8c5360c39..d0a42c15c 100644 --- a/mitiq/benchmarks/randomized_benchmarking.py +++ b/mitiq/benchmarks/randomized_benchmarking.py @@ -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, @@ -60,9 +60,6 @@ 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): @@ -70,10 +67,7 @@ def generate_rb_circuits( 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) )