Swaps

Swaps#

class pennylane_calculquebec.processing.steps.routing.Swaps(machine_name: str, use_benchmark=True, q1_acceptance=0.5, q2_acceptance=0.5, excluded_qubits=[], excluded_couplers=[])#

Bases: Routing

a routing algorithm that uses swaps

constructor for usual routing algorithms

Parameters:
  • use_benchmark (bool, optional) – should we use benchmarks during placement? Defaults to True.

  • q1_acceptance (float, optional) – what is the level of acceptance for state 1 readout? Defaults to 0.5.

  • q2_acceptance (float, optional) – what is the level of acceptance for cz fidelity? Defaults to 0.5.

  • excluded_qubits (list, optional) – what qubits should we exclude from the mapping? Defaults to [].

  • excluded_couplers (list, optional) – what couplers should we exclude from the mapping? Defaults to [].

execute(tape)

uses swap to permute wires when 2 qubits operation appear which are not directly mapped to a coupler in the machine

execute(tape)#

uses swap to permute wires when 2 qubits operation appear which are not directly mapped to a coupler in the machine

ie. cnot(0, 1), qubit 0 and 1 are not directly connected in the machine’s graph. the shortest path from 0 to 1 is [0, 4, 1] the new circuit will be : swap(4, 1), cnot(0, 4), swap(4, 1)

Parameters:

tape (QuantumTape) – the tape to transform

Raises:

RoutingException – raised when there is no solution for the routing problem

Returns:

the transformed tape

Return type:

QuantumTape