qubiter.device_specific.QbitPlanarLattice module¶
-
class
qubiter.device_specific.QbitPlanarLattice.
QbitPlanarLattice
(ascii_pic)[source]¶ Bases:
object
This class translates between int and int pair coordinates for qubits on a planar lattice. From a rectangular ascii picture of the planar chip ( for instance, device_specific.chip_couplings_google._BRISTLECONE_GRID), the class finds neighbors of each qubit. Two qubits are neighbors iff they are adjacent and have the same column or row. Two qubits are neighbors also iff a CNOT is physically allowed with either one of the qubits as target and the other as control.
Variables: - num_qbits (int) –
- qbit_2d_coords (list[tuple[int, int]]) – List of 2d coords for each qubit
References
- cirq/google/xmon_device.py
- cirq/devices/grid_qubit.py
- cirq/google/known_devices.py
-
__init__
(ascii_pic)[source]¶ Constructor
Parameters: ascii_pic (str) – rectangular ascii picture of planar chip. For instance, device_specific.chip_couplings_google._BRISTLECONE_GRID
-
are_neighbors
(ind1, ind2)[source]¶ Returns True iff qubits with int coords ind1 and ind2 are neighbors.
Parameters: - ind1 (int) –
- ind2 (int) –
Returns: Return type: bool
-
get_c_to_tars
()[source]¶ Returns a dictionary mapping each qubit j to a list of all physically allowed target qubits, assuming j is a control of a CNOT. All qubits are specified by their int coords.
Returns: Return type: dict[int, list[int]]
-
is_empty
(pair)[source]¶ True iff pair=(row, col) position on grid has no qubit.
Parameters: pair (tuple[int, int]) – Returns: Return type: bool
-
neighbors_of
(ind)[source]¶ Returns list of ints that are int coords of qubits that are neighbors of qubit with int coord ind.
Parameters: ind (int) – Returns: Return type: list[int]