app.processing.merge.connections ================================ .. py:module:: app.processing.merge.connections .. autoapi-nested-parse:: Connect input/output by modifying the AST based on :class:`~app.processing.graph.IOInfo`. Module Contents --------------- .. py:class:: SingleQubit Give a qubit a unique ID in the whole graph. :param section_id: The UUID of the section the qubit occurred in. :param id_in_section: The Qubit ID based on the declaration order in the section. .. py:class:: ApplyConnectionsTransformer(section_id: uuid.UUID, io_info: app.processing.graph.IOInfo, qubit_info: app.processing.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. :param section_id: The UUID of the currently visited section. :param io_info: The IOInfo for the current section. :param qubit_info: The QubitInfo for the current section. :param global_reg_name: The name to use for the global qubit register. :param qubit_to_index: Map qubits to the indexes in the global reg. :param classical_input_to_output: Map classical declaration names to aliases to use. .. py:method:: id_to_qubit(id: int) -> SingleQubit Create a :class:`~app.processing.merging.connections.SingleQubit` for the encountered ID. .. py:method:: visit_QubitDeclaration(node: openqasm3.ast.QubitDeclaration) -> openqasm3.ast.QASMNode Replace qubit declaration with alias to leqo_reg. .. py:method:: visit_ClassicalDeclaration(node: openqasm3.ast.ClassicalDeclaration) -> openqasm3.ast.QASMNode Replace classical declaration with alias to output if it is an input. .. py:function:: connect_qubits(graph: app.processing.graph.ProgramGraph, global_reg_name: str, input: app.processing.graph.ProcessedProgramNode | None = None) -> int Apply connections to the graph. :param graph: The graph to modify in place. :param global_reg_name: The name of the qubit reg to use in aliases. :param input: Optional input node: don't modify it + IDs in the order of the declarations in this node. :return: The size of the global qubit register.