Skip to content

Commit

Permalink
move function
Browse files Browse the repository at this point in the history
  • Loading branch information
eliottrosenberg authored Dec 14, 2023
1 parent e9f2d67 commit cd9b50d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions cirq-core/cirq/experiments/qubit_characterizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,6 @@ def single_qubit_randomized_benchmarking(
return RandomizedBenchMarkResult(num_clifford_range, gnd_probs)


def _create_parallel_rb_circuit(
qubits: tuple[cirq.GridQubit], num_cfds: int, c1: list, cfd_mats: np.array
) -> cirq.Circuit:
circuits_to_zip = [_random_single_q_clifford(qubit, num_cfds, c1, cfd_mats) for qubit in qubits]
circuit = cirq.Circuit.zip(*circuits_to_zip)
measure_moment = cirq.Moment(
cirq.measure_each(*qubits, key_func=lambda q: "q{}_{}".format(q.row, q.col))
)
circuit_with_meas = cirq.Circuit.from_moments(*(circuit.moments + [measure_moment]))
return circuit_with_meas


def parallel_single_qubit_randomized_benchmarking(
sampler: cirq.Sampler,
use_xy_basis: bool = True,
Expand Down Expand Up @@ -541,6 +529,18 @@ def _measurement(two_qubit_circuit: circuits.Circuit) -> np.ndarray:
return TomographyResult(rho)


def _create_parallel_rb_circuit(
qubits: tuple[cirq.GridQubit], num_cfds: int, c1: list, cfd_mats: np.array
) -> cirq.Circuit:
circuits_to_zip = [_random_single_q_clifford(qubit, num_cfds, c1, cfd_mats) for qubit in qubits]
circuit = cirq.Circuit.zip(*circuits_to_zip)
measure_moment = cirq.Moment(
cirq.measure_each(*qubits, key_func=lambda q: "q{}_{}".format(q.row, q.col))
)
circuit_with_meas = cirq.Circuit.from_moments(*(circuit.moments + [measure_moment]))
return circuit_with_meas


def _indices_after_basis_rot(i: int, j: int) -> Tuple[int, Sequence[int], Sequence[int]]:
mat_idx = 3 * (3 * i + j)
q_0_i = 3 - i
Expand Down

0 comments on commit cd9b50d

Please sign in to comment.