cirq.LineQid

class cirq.LineQid(x: int, dimension: int)[source]

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

LineQids have a single attribute, and integer coordinate ‘x’, which
identifies the qids location on the line. LineQids are ordered by
this integer.

One can construct new LineQids by adding or subtracting integers:

>>> cirq.LineQid(1, dimension=2) + 3
cirq.LineQid(4, dimension=2)

>>> cirq.LineQid(2, dimension=3) - 1
cirq.LineQid(1, dimension=3)
__init__(x: int, dimension: int) → None[source]

Initializes a line qid at the given x coordinate.

Parameters
  • x – The x coordinate.

  • dimension – The dimension of the qid, e.g. the number of quantum levels.

Methods

for_gate(val[, start, step])

Returns a range of line qids with the same qid shape as the gate.

for_qid_shape(qid_shape[, start, step])

Returns a range of line qids for each entry in qid_shape with

is_adjacent(other)

Determines if two qubits are adjacent line qubits.

neighbors([qids])

Returns qubits that are potential neighbors to this LineQubit

range(*range_args, dimension)

Returns a range of line qids.

validate_dimension(dimension)

Raises an exception if dimension is not positive.

with_dimension(dimension)

Returns a new qid with a different dimension.

Attributes

dimension

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

x