iqm.iqm_client.transpile.ResonatorStateTracker#
- class iqm.iqm_client.transpile.ResonatorStateTracker(available_moves)#
Bases:
object
Class for tracking the location of the |0> state of the resonators on the quantum computer as they are moved with the MOVE gates because the MOVE gate is not defined when acting on a |11> state. This is equivalent to tracking the which qubit state has been MOVEd into which resonator.
- Parameters:
Attributes
move_gate
Getter for the resonator registers that are being tracked.
Bool whether any move gate is allowed.
Methods
_score_choice_heuristic
(args)A simple look ahead heuristic for choosing which qubit to move where.
apply_move
(qubit, resonator)Apply the logical changes of the resonator state location when a move gate between qubit and resonator is applied.
available_resonators_to_move
(qubits)Generates a dictionary with which resonators a qubit can be moved to, for each qubit.
choose_move_pair
(qubits, remaining_instructions)Chooses which qubit of the given qubits to move into which resonator, given a sequence of instructions to be executed later for looking ahead.
create_move_instructions
(qubit, resonator[, ...])Create the move instructions needed to move the given resonator state into the resonator if needed and then move resonator state to the given qubit.
from_circuit
(circuit)Constructor to make the ResonatorStateTracker from a circuit.
from_instructions
(instructions)Constructor to make the ResonatorStateTracker from a sequence of instructions.
Constructor to make the ResonatorStateTracker from a QuantumArchitectureSpecification.
reset_as_move_instructions
([resonators, ...])Creates the move instructions needed to move all resonator states to their original state.
resonators_holding_qubits
(qubits)Returns the resonators that are currently holding one of the given qubit states.
update_qubits_in_resonator
(qubits)Applies the resonator to qubit map in the state of the resonator state tracker to the given qubits.
- static from_quantum_architecture_specification(arch)#
Constructor to make the ResonatorStateTracker from a QuantumArchitectureSpecification.
- Parameters:
arch (QuantumArchitectureSpecification) – The architecture to track the resonator state on.
- Return type:
- static from_circuit(circuit)#
Constructor to make the ResonatorStateTracker from a circuit. It infers the resonator connectivity from the move gates in the circuit.
- Parameters:
circuit (Circuit) – The circuit to track the resonator state on.
- Return type:
- static from_instructions(instructions)#
Constructor to make the ResonatorStateTracker from a sequence of instructions. It infers the resonator connectivity from the move instructions.
- Parameters:
instructions (Iterable[Instruction]) – The instructions to track the resonator state on.
- Return type:
- apply_move(qubit, resonator)#
Apply the logical changes of the resonator state location when a move gate between qubit and resonator is applied.
- Parameters:
- Raises:
CircuitExecutionError – When the move is not allowed, either because the resonator does not exist, the move
gate is not valid between this qubit-resonator pair, or the resonator state is currently in a different –
qubit register. –
- Return type:
None
- create_move_instructions(qubit, resonator, apply_move=True, alt_qubit_names=None)#
Create the move instructions needed to move the given resonator state into the resonator if needed and then move resonator state to the given qubit.
- Parameters:
- Yields:
The one or two move instructions needed.
- Return type:
- reset_as_move_instructions(resonators=None, apply_move=True, alt_qubit_names=None)#
Creates the move instructions needed to move all resonator states to their original state.
- Parameters:
- Returns:
The instructions needed to move all qubit states out of the resonators.
- Return type:
- available_resonators_to_move(qubits)#
Generates a dictionary with which resonators a qubit can be moved to, for each qubit.
- resonators_holding_qubits(qubits)#
Returns the resonators that are currently holding one of the given qubit states.
- choose_move_pair(qubits, remaining_instructions)#
Chooses which qubit of the given qubits to move into which resonator, given a sequence of instructions to be executed later for looking ahead.
- Parameters:
- Raises:
CircuitExecutionError – When no move pair is available, most likely because the circuit was not routed.
- Returns:
A sorted preference list of resonator and qubit chosen to apply the move on.
- Return type: