cirq.google.XmonDevice

A device with qubits placed in a grid. Neighboring qubits can interact.

Inherits From: Device

measurement_duration The maximum duration of a measurement.
exp_w_duration The maximum duration of an ExpW operation.
exp_11_duration The maximum duration of an ExpZ operation.
qubits Qubits on the device, identified by their x, y location.

Methods

at

View source

Returns the qubit at the given position, if there is one, else None.

can_add_operation_into_moment

View source

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.

col

View source

Returns the qubits in the given column, in ascending order.

decompose_operation

View source

Returns a device-valid decomposition for the given operation.

This method is used when adding operations into circuits with a device specified, to avoid spurious failures due to e.g. using a Hadamard gate that must be decomposed into native gates.

duration_of

View source

is_supported_gate

View source

Returns true if the gate is allowed.

neighbors_of

View source

Returns the qubits that the given qubit can interact with.

qubit_set

View source

Returns a set or frozenset of qubits on the device, if possible.

Returns
If the device has a finite set of qubits, then a set or frozen set of all qubits 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.

row

View source

Returns the qubits in the given row, in ascending order.

validate_circuit

View source

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_gate

View source

Raises an error if the given gate isn't allowed.

Raises
ValueError Unsupported gate.

validate_moment

View source

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

View source

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.

__eq__

View source

__ne__

View source