View source on GitHub |
A grid lattice rotated 45-degrees.
Inherits From: NamedTopology
cirq.TiltedSquareLattice(
width: int, height: int
)
Used in the notebooks
Used in the tutorials |
---|
This topology is based on Google devices where plaquettes consist of four qubits in a square connected to a central qubit:
x x
x
x x
The corner nodes are not connected to each other. width
and height
refer to the rectangle
formed by rotating the lattice 45 degrees. width
and height
are measured in half-unit
cells, or equivalently half the number of central nodes.
An example diagram of this topology is shown below. It is a
"tilted-square-lattice-6-4" with width 6 and height 4.
x
│
x────X────x
│ │ │
x────X────x────X────x │ │ │ │ x────X────x────X───x │ │ │ x────X────x │ x
Nodes are 2-tuples of integers which may be negative. Please see get_placements
for
mapping this topology to a GridQubit Device.
Attributes | |
---|---|
width
|
Dataclass field |
height
|
Dataclass field |
Methods
draw
draw(
ax=None, tilted=True, **kwargs
)
Draw this graph using Matplotlib.
Args | |
---|---|
ax
|
Optional matplotlib axis to use for drawing. |
tilted
|
If True, directly position as (row, column); otherwise, rotate 45 degrees to accommodate the diagonal nature of this topology. |
**kwargs
|
Additional arguments to pass to nx.draw_networkx .
|
nodes_as_gridqubits
nodes_as_gridqubits() -> List['cirq.GridQubit']
Get the graph nodes as cirq.GridQubit
nodes_to_gridqubits
nodes_to_gridqubits(
offset=(0, 0)
) -> Dict[Tuple[int, int], 'cirq.GridQubit']
Return a mapping from graph nodes to cirq.GridQubit
Args | |
---|---|
offset
|
Offset row and column indices of the resultant GridQubits by this amount.
The offset positions the top-left node in the draw(tilted=False) frame.
|
__eq__
__eq__(
other
)
Return self==value.
Class Variables | |
---|---|
graph |
Instance of NotImplementedType
|
n_nodes |
Instance of NotImplementedType
|
name |
Instance of NotImplementedType
|