cirq_rigetti.aspen_device.AspenQubit

A cirq.Qid supporting Octagonal indexing.

Inherits From: OctagonalQubit

octagon_position Position within octagon, indexed as pictured above.

ValueError If the position specified is greater than 7.

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

octagon_position

x Returns the horizontal position of the qubit, assuming each side of the octagon has length 1.
y Returns the vertical position of the qubit, assuming each side of the octagon has length 1. The y-axis is oriented downwards.
z Because this is a 2-dimensional qubit, this will always be 0.

Methods

distance

View source

Returns the distance between two qubits.

Args
other An AspenQubit to which we are measuring distance.

Returns
The distance between two qubits.

Raises
TypeError other qubit must be AspenQubit.

from_aspen_index

View source

Initializes an AspenQubit at the given index. See OctagonalQubit to understand OctagonalQubit indexing.

Args
index The index at which to initialize the AspenQubit.

Returns
The AspenQubit with requested index.

Raises
ValueError index is not a valid octagon position.

from_grid_qubit

View source

Converts cirq.GridQubit to AspenQubit.

Returns
The equivalent AspenQubit.

Raises
ValueError GridQubit cannot be converted to AspenQubit.

from_named_qubit

View source

Converts cirq.NamedQubit to AspenQubit.

Returns
The equivalent AspenQubit.

Raises
ValueError NamedQubit cannot be converted to AspenQubit.
UnsupportedQubit If the supplied qubit is not a named qubit with an octagonal index.

to_grid_qubit

View source

Converts AspenQubit to cirq.GridQubit.

Returns
The equivalent GridQubit.

Raises
ValueError AspenQubit cannot be converted to GridQubit.

to_named_qubit

View source

Converts AspenQubit to cirq.NamedQubit.

Returns
The equivalent NamedQubit.

validate_dimension

Raises an exception if dimension is not positive.

Raises
ValueError dimension is not positive.

with_dimension

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.

__eq__

Return self==value.

__ge__

Return self>=value.

__gt__

Return self>value.

__le__

Return self<=value.

__lt__

Return self<value.

__ne__

Return self!=value.