app.transformation_manager.merge.connections

Connect input/output by modifying the AST based on IOInfo.

Module Contents

class app.transformation_manager.merge.connections.SingleQubit

Give a qubit a unique ID in the whole graph.

Parameters:
  • section_id – The UUID of the section the qubit occurred in.

  • id_in_section – The Qubit ID based on the declaration order in the section.

class app.transformation_manager.merge.connections.ApplyConnectionsTransformer(section_id: uuid.UUID, io_info: app.transformation_manager.graph.IOInfo, qubit_info: app.transformation_manager.graph.QubitInfo, global_reg_name: str, qubit_to_index: dict[SingleQubit, int], classical_input_to_output: dict[str, str])

Replace qubit declarations and classical inputs with aliases.

Parameters:
id_to_qubit(id: int) SingleQubit

Create a SingleQubit for the encountered ID.

Parameters:

id (int)

Return type:

SingleQubit

visit_QubitDeclaration(node: openqasm3.ast.QubitDeclaration) openqasm3.ast.QASMNode

Replace qubit declaration with alias to leqo_reg.

Parameters:

node (openqasm3.ast.QubitDeclaration)

Return type:

openqasm3.ast.QASMNode

visit_ClassicalDeclaration(node: openqasm3.ast.ClassicalDeclaration) openqasm3.ast.QASMNode

Replace classical declaration with alias to output if it is an input.

Parameters:

node (openqasm3.ast.ClassicalDeclaration)

Return type:

openqasm3.ast.QASMNode

app.transformation_manager.merge.connections.connect_qubits(graph: app.transformation_manager.graph.ProgramGraph, global_reg_name: str, input: app.transformation_manager.graph.ProcessedProgramNode | None = None) int

Apply connections to the graph.

Parameters:
Returns:

The size of the global qubit register.

Return type:

int