IQMDevice#
Module: iqm.cirq_iqm.devices.iqm_device
- class iqm.cirq_iqm.devices.iqm_device.IQMDevice(metadata: IQMDeviceMetadata)#
Bases:
DeviceABC for the properties of a specific IQM quantum architecture.
Adds extra functionality on top of the basic
cirq.Deviceclass for decomposing gates, optimizing circuits and mapping qubits.- Parameters:
metadata (IQMDeviceMetadata) – device metadata which contains the qubits, their connectivity, and the native gateset
Attributes
Returns metadata for the device.
Methods
Raises a ValueError if operation acts on qubits that are not connected.
Decomposes the given circuit to the native gate set of the device.
Decompose a single quantum operation into the native operation set.
The device qubit corresponding to the given numeric index.
The numeric index of the given qubit on the device.
Predicate, True iff the given operation is native and its targets are valid.
Predicate, True iff the given operation is considered native for the architecture.
Decomposes operations into the native operation set.
Routes the given circuit to the device connectivity and qubit names.
Raise an error if
circuitis not compatible with this device.Validate whether the IQMMoveGate is between qubit and resonator registers.
Validate whether the IQMMoveGates are correctly applied in the circuit.
Raise an error if
operationis not supported on this device.- property metadata: IQMDeviceMetadata#
Returns metadata for the device.
- classmethod get_qubit_index(qubit: NamedQubit) int#
The numeric index of the given qubit on the device.
- Parameters:
qubit (NamedQubit)
- Return type:
- get_qubit(index: int) Qid#
The device qubit corresponding to the given numeric index.
- Parameters:
index (int)
- Return type:
Qid
- check_qubit_connectivity(operation: Operation) None#
Raises a ValueError if operation acts on qubits that are not connected.
- Parameters:
operation (Operation)
- Return type:
None
- is_native_operation(op: Operation) bool#
Predicate, True iff the given operation is considered native for the architecture.
- Parameters:
op (Operation)
- Return type:
- has_valid_operation_targets(op: Operation) bool#
Predicate, True iff the given operation is native and its targets are valid.
- Parameters:
op (Operation)
- Return type:
- operation_decomposer(op: Operation) list[Operation] | None#
Decomposes operations into the native operation set.
All the decompositions below keep track of global phase (required for decomposing controlled gates).
- Parameters:
op (Operation) – operation to decompose
- Returns:
decomposition, or None to pass
opto the Cirq native decomposition machinery instead- Return type:
list[Operation] | None
- decompose_operation(operation: cirq.Operation) cirq.OP_TREE#
Decompose a single quantum operation into the native operation set.
- Parameters:
operation (cirq.Operation)
- Return type:
cirq.OP_TREE
- route_circuit(circuit: Circuit, *, initial_mapper: AbstractInitialMapper | None = None, qubit_subset: Sequence[Qid] | None = None) tuple[Circuit, dict[Qid, Qid], dict[Qid, Qid]]#
Routes the given circuit to the device connectivity and qubit names.
The routed circuit uses the device qubits, and may have additional SWAP gates inserted to perform the qubit routing. The transformer
cirq.RouterCQCis used for routing. Note that only gates of one or two qubits, and measurement operations of arbitrary size are supported.Adds the attribute
iqm_calibration_set_idto the routed circuit, with value taken fromself.metadata.architecture.calibration_set_idif available, otherwise None.- Parameters:
circuit (Circuit) – Circuit to route.
initial_mapper (AbstractInitialMapper | None) – Initial mapping from
circuitqubits to device qubits, to serve as the starting point of the routing.Nonemeans it will be generated automatically.qubit_subset (Sequence[Qid] | None) – Restrict the routing to this subset of the device qubits. If
None, use the entire device.
- Returns:
routed circuit, initial mapping before inserting SWAP gates (see
cirq.RouterCQC.route_circuit()), final mapping from physical qubits to physical qubits (seecirq.RouterCQC.route_circuit())- Raises:
ValueError – routing is impossible
- Return type:
- decompose_circuit(circuit: Circuit) Circuit#
Decomposes the given circuit to the native gate set of the device.
Adds the attribute
iqm_calibration_set_idto the decomposed circuit, with value taken fromself.metadata.architecture.calibration_set_idif available, otherwise None.- Parameters:
circuit (Circuit) – circuit to decompose
- Returns:
decomposed circuit
- Return type:
Circuit
- validate_circuit(circuit: AbstractCircuit) None#
Raise an error if
circuitis not compatible with this device.- Parameters:
circuit (AbstractCircuit)
- Return type:
None
- validate_operation(operation: Operation) None#
Raise an error if
operationis not supported on this device.- Parameters:
operation (Operation)
- Return type:
None
- validate_move(operation: Operation) None#
Validate whether the IQMMoveGate is between qubit and resonator registers.
- Parameters:
operation (cirq.Operation) – Operation to check
- Raises:
ValueError – In case the the first argument of the IQMMoveGate is not a qubit, or if the second argument is not a resonator on this device.
- Returns:
None when the IQMMoveGate is used correctly.
- Return type:
None
- validate_moves(circuit: AbstractCircuit) None#
Validate whether the IQMMoveGates are correctly applied in the circuit.
- Parameters:
circuit (cirq.AbstractCircuit) – The circuit to validate.
- Raises:
ValueError – If the IQMMoveGate is applied incorrectly.
- Returns:
None if the IQMMoveGates are applied correctly.
- Return type:
None
Inheritance
