A cirq.Qid supporting Octagonal indexing.
Inherits From: OctagonalQubit
cirq_rigetti.aspen_device.AspenQubit(
octagon: int, octagon_position: int
)
Args |
octagon_position
|
Position within octagon, indexed as pictured above.
|
Raises |
ValueError
|
If the position specified is greater than 7.
|
Attributes |
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
distance(
other: cirq.Qid
) -> float
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
@staticmethod
from_aspen_index(
index: int
) -> 'AspenQubit'
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
@staticmethod
from_grid_qubit(
grid_qubit: cirq.GridQubit
) -> 'AspenQubit'
Converts cirq.GridQubit
to AspenQubit
.
Returns |
The equivalent AspenQubit.
|
Raises |
ValueError
|
GridQubit cannot be converted to AspenQubit.
|
from_named_qubit
View source
@staticmethod
from_named_qubit(
qubit: cirq.NamedQubit
) -> 'AspenQubit'
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
to_grid_qubit() -> cirq.GridQubit
Converts AspenQubit
to cirq.GridQubit
.
Returns |
The equivalent GridQubit.
|
Raises |
ValueError
|
AspenQubit cannot be converted to GridQubit.
|
to_named_qubit
View source
to_named_qubit() -> cirq.NamedQubit
Converts AspenQubit
to cirq.NamedQubit
.
Returns |
The equivalent NamedQubit.
|
validate_dimension
@staticmethod
validate_dimension(
dimension: int
) -> None
Raises an exception if dimension
is not positive.
Raises |
ValueError
|
dimension is not positive.
|
with_dimension
with_dimension(
dimension: int
) -> 'Qid'
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__
__eq__(
other
)
Return self==value.
__ge__
__ge__(
other
)
Return self>=value.
__gt__
__gt__(
other
)
Return self>value.
__le__
__le__(
other
)
Return self<=value.
__lt__
__lt__(
other
)
Return self<value.
__ne__
__ne__(
other
)
Return self!=value.