cirq.LineQubit

A qubit on a 1d lattice with nearest-neighbor connectivity.

Inherits From: Qid

Used in the notebooks

Used in the guide Used in the tutorials

LineQubits have a single attribute, and integer coordinate 'x', which identifies the qubits location on the line. LineQubits are ordered by this integer.

One can construct new cirq.LineQubits by adding or subtracting integers:

cirq.LineQubit(1) + 3
cirq.LineQubit(4)
cirq.LineQubit(2) - 1
cirq.LineQubit(1)

x The x coordinate.

dimension Returns the dimension or the number of quantum levels this qid has. E.g. 2 for a qubit, 3 for a qutrit, etc.
x

Methods

is_adjacent

View source

Determines if two qubits are adjacent line qubits.

Args
other cirq.Qid to test for adjacency.

Returns: True iff other and self are adjacent.

neighbors

View source

Returns qubits that are potential neighbors to this LineQubit

Args
qids optional Iterable of qubits to constrain neighbors to.

range

View source

Returns a range of line qubits.

Args
*range_args Same arguments as python's built-in range method.

Returns
A list of line qubits.

validate_dimension

View source

Raises an exception if dimension is not positive.

Raises
ValueError dimension is not positive.

with_dimension

View source

Returns a new qid with a different dimension.

Child classes can override. Wraps the qubit object by default.

Args
dimension The new dimension or number of levels.

__add__

View source

__eq__

View source

Return self==value.

__ge__

View source

Return self>=value.

__gt__

View source

Return self>value.

__le__

View source

Return self<=value.

__lt__

View source

Return self<value.

__ne__

View source

Return self!=value.

__neg__

View source

__radd__

View source

__rsub__

View source

__sub__

View source