![]() |
A device that uses the gates exposed by the IonQ API.
cirq_ionq.ionq_devices.IonQAPIDevice(
qubits: Union[Sequence[cirq.LineQubit], int], atol=1e-08
)
When using this device in constructing a circuit, it will convert one and two qubit gates that are not supported by the API into those supported by the API if they have a unitary matrix (support the unitary protocol).
Note that this device does not do any compression of the resulting circuit, i.e. it may result in a series of single qubit gates that could be executed using far fewer elements.
The gates supported by the API are
* <a href="https://quantumai.google/reference/python/cirq/ops/XPowGate"><code>cirq.XPowGate</code></a>, <a href="https://quantumai.google/reference/python/cirq/ops/YPowGate"><code>cirq.YPowGate</code></a>, <a href="https://quantumai.google/reference/python/cirq/ops/ZPowGate"><code>cirq.ZPowGate</code></a>
* <a href="https://quantumai.google/reference/python/cirq/ops/XXPowGate"><code>cirq.XXPowGate</code></a>, <a href="https://quantumai.google/reference/python/cirq/ops/YYPowGate"><code>cirq.YYPowGate</code></a>, <a href="https://quantumai.google/reference/python/cirq/ops/ZZPowGate"><code>cirq.ZZPowGate</code></a>
* <a href="https://quantumai.google/reference/python/cirq/ops/CNOT"><code>cirq.CNOT</code></a>, <a href="https://quantumai.google/reference/python/cirq/ops/H"><code>cirq.H</code></a>, <a href="https://quantumai.google/reference/python/cirq/ops/SWAP"><code>cirq.SWAP</code></a>
* <a href="https://quantumai.google/reference/python/cirq/ops/MeasurementGate"><code>cirq.MeasurementGate</code></a>
Args | |
---|---|
qubits
|
The qubits upon which this device acts or the number of qubits. If the number
of qubits, then the qubits will be cirq.LineQubit s from 0 to this number minus
one.
|
atol
|
The absolute tolerance used for gate calculations and decompositions. |
Attributes | |
---|---|
metadata
|
Returns the associated Metadata with the device if applicable. |
Methods
can_add_operation_into_moment
can_add_operation_into_moment(
operation: 'cirq.Operation', moment: 'cirq.Moment'
) -> bool
THIS FUNCTION IS DEPRECATED.
IT WILL BE REMOVED IN cirq v0.15
.
can_add_operation_into_moment will be removed in the future. Consider using device.validate_circuit instead.
Determines if it's possible to add an operation into a moment.
For example, on the XmonDevice two CZs shouldn't be placed in the same
moment if they are on adjacent qubits.
Args:
operation: The operation being added.
moment: The moment being transformed.
Returns:
Whether or not the moment will validate after adding the operation.
decompose_operation
decompose_operation(
operation: cirq.Operation
) -> cirq.OP_TREE
THIS FUNCTION IS DEPRECATED.
IT WILL BE REMOVED IN cirq v0.15
.
Use cirq_ionq.decompose_to_device operation instead.
is_api_gate
is_api_gate(
operation: cirq.Operation
) -> bool
qid_pairs
qid_pairs() -> Optional[FrozenSet['cirq.SymmetricalQidPair']]
THIS FUNCTION IS DEPRECATED.
IT WILL BE REMOVED IN cirq v0.15
.
qubit coupling data can now be found in device.metadata if provided.
Returns a set of qubit edges on the device, if possible.
This property can be overridden in child classes for special handling.
The default handling is: GridQids and LineQids will have neighbors as
edges, and others will be fully connected.
Returns:
If the device has a finite set of qubits, then a set of all edges
on the device is returned.
If the device has no well defined finite set of qubits (e.g.
`cirq.UnconstrainedDevice` has this property), then `None` is
returned.
qubit_set
qubit_set() -> AbstractSet['cirq.Qid']
THIS FUNCTION IS DEPRECATED.
IT WILL BE REMOVED IN cirq v0.15
.
Use metadata.qubit_set if applicable.
validate_circuit
validate_circuit(
circuit: 'cirq.AbstractCircuit'
) -> None
Raises an exception if a circuit is not valid.
Args | |
---|---|
circuit
|
The circuit to validate. |
Raises | |
---|---|
ValueError
|
The circuit isn't valid for this device. |
validate_moment
validate_moment(
moment: 'cirq.Moment'
) -> None
Raises an exception if a moment is not valid.
Args | |
---|---|
moment
|
The moment to validate. |
Raises | |
---|---|
ValueError
|
The moment isn't valid for this device. |
validate_operation
validate_operation(
operation: cirq.Operation
)
Raises an exception if an operation is not valid.
Args | |
---|---|
operation
|
The operation to validate. |
Raises | |
---|---|
ValueError
|
The operation isn't valid for this device. |