|
15 | 15 | """Attempt to tabulate single qubit gates required to generate a target 2Q gate
|
16 | 16 | with a product A k A."""
|
17 | 17 | from functools import reduce
|
18 |
| -from typing import Tuple, Sequence, List, NamedTuple |
| 18 | +from typing import List, NamedTuple, Sequence, Tuple |
19 | 19 |
|
20 | 20 | from dataclasses import dataclass
|
21 | 21 | import numpy as np
|
@@ -100,7 +100,7 @@ def compile_two_qubit_gate(self, unitary: np.ndarray) -> TwoQubitGateTabulationR
|
100 | 100 | unitary = np.asarray(unitary)
|
101 | 101 | kak_vec = cirq.kak_vector(unitary, check_preconditions=False)
|
102 | 102 | infidelities = kak_vector_infidelity(kak_vec, self.kak_vecs, ignore_equivalent_vectors=True)
|
103 |
| - nearest_ind = infidelities.argmin() |
| 103 | + nearest_ind = int(infidelities.argmin()) |
104 | 104 |
|
105 | 105 | success = infidelities[nearest_ind] < self.max_expected_infidelity
|
106 | 106 |
|
@@ -483,13 +483,13 @@ def two_qubit_gate_product_tabulation(
|
483 | 483 | else:
|
484 | 484 | missed_points.append(missing_vec)
|
485 | 485 |
|
486 |
| - kak_vecs = np.array(kak_vecs) |
| 486 | + kak_vecs_arr = np.array(kak_vecs) |
487 | 487 | summary += (
|
488 | 488 | f'\nFraction of Weyl chamber reached with 2 gates and 3 gates '
|
489 | 489 | f'(after patchup)'
|
490 |
| - f': {(len(kak_vecs) - 1) / num_mesh_points :.3f}' |
| 490 | + f': {(len(kak_vecs_arr) - 1) / num_mesh_points :.3f}' |
491 | 491 | )
|
492 | 492 |
|
493 | 493 | return TwoQubitGateTabulation(
|
494 |
| - base_gate, kak_vecs, sq_cycles, max_infidelity, summary, tuple(missed_points) |
| 494 | + base_gate, kak_vecs_arr, sq_cycles, max_infidelity, summary, tuple(missed_points) |
495 | 495 | )
|
0 commit comments