iqm.iqm_client.transpile.ResonatorStateTracker#
- class iqm.iqm_client.transpile.ResonatorStateTracker(available_moves: dict[str, list[str]])#
Bases:
object
Class for tracking the location of the \(|0\rangle\) 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\rangle\) state. This is equivalent to tracking which qubit state has been moved into which resonator.
- Parameters:
available_moves (dict[str, list[str]]) – A dictionary describing between which qubits a MOVE gate is available, for each resonator, i.e.
available_moves[resonator] = [qubit]
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.
Constructor to make the ResonatorStateTracker from a DynamicQuantumArchitecture.
from_instructions
(instructions)Constructor to make the ResonatorStateTracker from a sequence of instructions.
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_dynamic_architecture(arch: DynamicQuantumArchitecture) ResonatorStateTracker #
Constructor to make the ResonatorStateTracker from a DynamicQuantumArchitecture.
- Parameters:
arch (DynamicQuantumArchitecture) – The architecture to track the resonator state on.
- Return type:
- static from_circuit(circuit: Circuit) ResonatorStateTracker #
Constructor to make the ResonatorStateTracker from a circuit.
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: Iterable[Instruction]) ResonatorStateTracker #
Constructor to make the ResonatorStateTracker from a sequence of instructions.
Infers the resonator connectivity from the MOVE gates.
- Parameters:
instructions (Iterable[Instruction]) – The instructions to track the resonator state on.
- Return type:
- apply_move(qubit: str, resonator: str) None #
Apply the logical changes of the resonator state location when a MOVE gate between qubit and resonator is applied.
- Parameters:
- Raises:
CircuitTranspilationError – MOVE is not allowed, either because the resonator does not exist, the MOVE gate is not available between this qubit-resonator pair, or the resonator state is currently in a different qubit register.
- Return type:
None
- create_move_instructions(qubit: str, resonator: str, apply_move: bool | None = True, alt_qubit_names: dict[str, str] | None = None) Iterable[Instruction] #
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: Iterable[str] | None = None, apply_move: bool | None = True, alt_qubit_names: dict[str, str] | None = None) list[Instruction] #
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: Iterable[str]) dict[str, list[str]] #
Generates a dictionary with which resonators a qubit can be moved to, for each qubit.
- resonators_holding_qubits(qubits: Iterable[str]) list[str] #
Returns the resonators that are currently holding one of the given qubit states.
- choose_move_pair(qubits: list[str], remaining_instructions: list[list[str]]) list[tuple[str, str, list[list[str]]]] #
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:
CircuitTranspilationError – 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: