cirq.GridQubit

class cirq.GridQubit(row: int, col: int)[source]

A qubit on a 2d square lattice.

GridQubits use row-major ordering:

GridQubit(0, 0) < GridQubit(0, 1) < GridQubit(1, 0) < GridQubit(1, 1)

New GridQubits can be constructed by adding or subtracting tuples

>>> cirq.GridQubit(2, 3) + (3, 1)
cirq.GridQubit(5, 4)

>>> cirq.GridQubit(2, 3) - (1, 2)
cirq.GridQubit(1, 1)
__init__(row: int, col: int)

Initialize self. See help(type(self)) for accurate signature.

Methods

from_diagram(diagram)

Parse ASCII art device layout into info about qubits and

is_adjacent(other)

Determines if two qubits are adjacent qubits.

neighbors([qids])

Returns qubits that are potential neighbors to this GridQid

rect(rows, cols[, top, left])

Returns a rectangle of GridQubits.

square(diameter[, top, left])

Returns a square of GridQubits.

validate_dimension(dimension)

Raises an exception if dimension is not positive.

with_dimension(dimension)

Returns a new qid with a different dimension.

Attributes

col

dimension

Returns the dimension or the number of quantum levels this qid has.

row