dqcnac.parser.dag_to_qoala module

QuantumCircuit to QoalaPrograms parser call module.

class dqcnac.parser.dag_to_qoala.InstrToBlock(compiled_circuit: qiskit.QuantumCircuit, network_to_local: dict, network_config: Network)[source]

Bases: object

The QuantumCircuit to QoalaPrograms parser class.

__init__(compiled_circuit: qiskit.QuantumCircuit, network_to_local: dict, network_config: Network)[source]

Initialize the parser

Parameters:
  • compiled_circuit – a distributed circuit

  • network_to_local – a mapping from the circuit virtual qubits to physical qubits on network nodes

  • network_config – the network configuration

static bsm_subroutine(routine_name: str, qubit0: int, qubit1: int) → qoala.lang.routine.LocalRoutine[source]

Create the bell state measurement routine

Parameters:
  • routine_name – the routine name

  • qubit0 – the first qubit

  • qubit1 – the second qubit

Returns:

the qoala local routine

static catdisent_routine_receiver(routine_name: str, qubit: int) → qoala.lang.routine.LocalRoutine[source]

Create the cat-disent routine for the receiver node, i.e. the sender node of a previous cat-ent routine

Parameters:
  • routine_name – the routine name

  • qubit – the qubit used

Returns:

the qoala local routine

static catdisent_routine_sender(routine_name: str, ebit: int) → qoala.lang.routine.LocalRoutine[source]

Create the cat-disent routine for the sender node, i.e. the receiver node of a previous cat-ent routine

Parameters:
  • routine_name – the routine name

  • ebit – the ebit used

Returns:

the qoala local routine

static catent_routine_receiver(routine_name: str, ebit: int) → qoala.lang.routine.LocalRoutine[source]

Create the cat-ent routine for the receiver node

Parameters:
  • routine_name – the routine name

  • ebit – the ebit used

Returns:

the qoala local routine

static catent_routine_sender(routine_name: str, qubit: int, ebit: int) → qoala.lang.routine.LocalRoutine[source]

Create the cat-ent routine for the sender node

Parameters:
  • routine_name – the routine name

  • qubit – the qubit used

  • ebit – the ebit used

Returns:

the qoala local routine

static cx_subroutine(routine_name: str, control: int, target: int) → qoala.lang.routine.LocalRoutine[source]

Create the cx gate local routine

Parameters:
  • routine_name – the routine name

  • control – the control qubit

  • target – the target qubit

Returns:

the qoala local routine

static cz_subroutine(routine_name: str, qubit0: int, qubit1: int) → qoala.lang.routine.LocalRoutine[source]

Create the cz gate routine

Parameters:
  • routine_name – the routine name

  • qubit0 – the first qubit

  • qubit1 – the second qubit

Returns:

the qoala local routine

ent_swap(nodes: list[str], ebits: list[int])[source]

Add entanglement swapping to the list of operation in a Qoala program

Parameters:
  • nodes – the list of nodes involved

  • ebits – the list of ebits involved

from_instr_to_qoala() → tuple[dict[str, qoala.lang.program.QoalaProgram], list[tuple[str, int]]][source]

Creates QoalaPrograms, one for each node, starting from a distributed circuit

Returns:

the QoalaPrograms and a mapping of the measured qubits

generic_epr(id_sender: str, id_receiver: str, ebit_sender: int, ebit_receiver: int) → tuple[qoala.lang.request.RequestRoutine, qoala.lang.request.RequestRoutine][source]

Create the epr pair generation requests

Parameters:
  • id_sender – the sender id

  • id_receiver – the receiver id

  • ebit_sender – the sender bit

  • ebit_receiver – the receiver ebit

Returns:

the qoala request routines

static h_subroutine(routine_name: str, qubit: int) → qoala.lang.routine.LocalRoutine[source]

Create the h gate routine :param routine_name: the routine name :param qubit: the qubit used

Returns:

the qoala local routine

static measure_subroutine(routine_name: str, qubit: int) → qoala.lang.routine.LocalRoutine[source]

Create the measurement routine

Parameters:
  • routine_name – the routine name

  • qubit – the qubit measured

Returns:

the qoala local routine

run() → tuple[dict[str, qoala.lang.program.QoalaProgram], list[tuple[str, int]]][source]

Run the paser to parse a distributed DAGCircuit into QoalaPrograms

Returns:

the QoalaPrograms and a mapping of the measured qubits

static rx_subroutine(routine_name: str, qubit: int, n: int, d: int) → qoala.lang.routine.LocalRoutine[source]

Create the rx gate routine

Parameters:
  • routine_name – the routine name

  • qubit – the qubit used

  • n – the exponent of pi

  • d – the denominator of the pi fraction

Returns:

the qoala local routine

static ry_subroutine(routine_name: str, qubit: int, n: int, d: int) → qoala.lang.routine.LocalRoutine[source]

Create the ry gate routine

Parameters:
  • routine_name – the routine name

  • qubit – the qubit used

  • n – the exponent of pi

  • d – the denominator of the pi fraction

Returns:

the qoala local routine

static rz_subroutine(routine_name: str, qubit: int, n: int, d: int) → qoala.lang.routine.LocalRoutine[source]

Create the rz gate routine

Parameters:
  • routine_name – the routine name

  • qubit – the qubit used

  • n – the exponent of pi

  • d – the denominator of the pi fraction

Returns:

the qoala local routine

static swap_subroutine(routine_name: str, qubit0: int, qubit1: int) → qoala.lang.routine.LocalRoutine[source]

Create the swap routine

Parameters:
  • routine_name – the routine name

  • qubit0 – the first qubit

  • qubit1 – the second qubit

Returns:

the qoala local routine

static teledata_routine_receiver(routine_name: str, ebit: int, qubit: int) → qoala.lang.routine.LocalRoutine[source]

Create the teledata routine for the receiver node

Parameters:
  • routine_name – the routine name

  • ebit – the ebit sued

  • qubit – the qubit used

Returns:

the qoala local routine

static teledata_routine_sender(routine_name: str, qubit: int, ebit: int) → qoala.lang.routine.LocalRoutine[source]

Create the teledata routine for the sender node

Parameters:
  • routine_name – the routine name

  • qubit – the qubit used

  • ebit – the ebit used

Returns:

the qoala local routine

static x_subroutine(routine_name: str, qubit: int) → qoala.lang.routine.LocalRoutine[source]

Create the x gate routine

Parameters:
  • routine_name – the routine name

  • qubit – the qubit used

Returns:

the qoala local routine

static y_subroutine(routine_name: str, qubit: int) → qoala.lang.routine.LocalRoutine[source]

Create the y gate routine

Parameters:
  • routine_name – the routine name

  • qubit – the qubit used

Returns:

the qoala local routine

static z_subroutine(routine_name: str, qubit: int) → qoala.lang.routine.LocalRoutine[source]

Create the z gate routine

Parameters:
  • routine_name – the routine name

  • qubit – the qubit used

Returns:

the qoala local routine