app.model.CompileRequest ======================== .. py:module:: app.model.CompileRequest .. autoapi-nested-parse:: This module defines the data models for compile requests. It provides classes to model metadata, node data, and the complete compile request. Module Contents --------------- .. py:class:: OptimizeSettings Abstract base class providing optimization settings. .. py:attribute:: optimizeWidth :type: int | None If set, enables circuit width optimization with a user-defined priority. .. py:attribute:: optimizeDepth :type: int | None If set, enables circuit depth optimization with a user-defined priority. .. py:class:: MetaData(/, **data: Any) Contains metadata for a compile request, including versioning and optimization preferences. .. py:attribute:: version :type: str Version identifier of the project or model. .. py:attribute:: name :type: str Name of the quantum circuit or model. .. py:attribute:: description :type: str Human-readable description of the model. .. py:attribute:: author :type: str Author of the model. .. py:attribute:: optimizeWidth :type: Annotated[int, Field(gt=0)] | None :value: None Optimization setting for reducing circuit width (optional). .. py:attribute:: optimizeDepth :type: Annotated[int, Field(gt=0)] | None :value: None Optimization setting for reducing circuit depth (optional). .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: BaseNode(/, **data: Any) Abstract base class for all node types used in a compile request. .. py:attribute:: id :type: str Unique identifier for the node. .. py:attribute:: label :type: str | None :value: None Optional label for the node used for display purposes. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: ImplementationNode(/, **data: Any) Node containing a user-defined OpenQASM implementation. .. py:attribute:: implementation :type: str Raw OpenQASM code associated with the node. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: EncodeValueNode(/, **data: Any) Node representing quantum state encoding from classical values. .. py:attribute:: encoding :type: Literal['amplitude', 'angle', 'basis', 'custom', 'matrix', 'schmidt'] Encoding scheme used (e.g. "amplitude", "basis", etc.). .. py:attribute:: bounds :type: int :value: None Indicates whether values are clamped (0 or 1). .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: PrepareStateNode(/, **data: Any) Node for preparing known quantum states like Bell or GHZ. .. py:attribute:: quantumState :type: Literal['ϕ+', 'ϕ-', 'ψ+', 'ψ-', 'custom', 'ghz', 'uniform', 'w'] Type of quantum state to prepare (e.g. "ψ+", "ghz"). .. py:attribute:: size :type: int :value: None Number of qubits involved in state preparation. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: SplitterNode(/, **data: Any) Node that splits qubits into multiple branches. .. py:attribute:: numberOutputs :type: int :value: None Number of output branches created. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: MergerNode(/, **data: Any) Node that merges multiple input branches into a single stream. .. py:attribute:: numberInputs :type: int :value: None Number of input branches merged. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: MeasurementNode(/, **data: Any) Node performing quantum measurement on specified qubit indices. .. py:attribute:: indices :type: list[Annotated[int, Field(ge=0)]] List of qubit indices to measure. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: QubitNode(/, **data: Any) Node representing qubit allocation. .. py:attribute:: size :type: int :value: None Number of qubits to allocate. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: GateNode(/, **data: Any) Node representing application of a quantum gate. .. py:attribute:: gate :type: app.openqasm3.stdgates.OneQubitGate | app.openqasm3.stdgates.TwoQubitGate | app.openqasm3.stdgates.ThreeQubitGate | Literal['cnot', 'toffoli'] The gate to apply (e.g., "x", "cnot", etc.). .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: ParameterizedGateNode(/, **data: Any) Node representing a gate that requires a parameter (e.g., angle rotation). .. py:attribute:: gate :type: app.openqasm3.stdgates.OneQubitGateWithAngle | app.openqasm3.stdgates.TwoQubitGateWithParam | app.openqasm3.stdgates.TwoQubitGateWithAngle The parameterized gate to apply. .. py:attribute:: parameter :type: float Value of the gate's parameter. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: BitLiteralNode(/, **data: Any) Node representing a fixed classical bit value (0 or 1). .. py:attribute:: value :type: Literal[0, 1] Bit value. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: BoolLiteralNode(/, **data: Any) Node representing a boolean literal. .. py:attribute:: value :type: bool Boolean value. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: IntLiteralNode(/, **data: Any) Node representing an integer literal. .. py:attribute:: bitSize :type: int :value: None "Bit size of the integer (optional). .. py:attribute:: value :type: int Integer value. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: FloatLiteralNode(/, **data: Any) Node representing a floating-point literal. .. py:attribute:: bitSize :type: int :value: None Bit size of the float (optional). .. py:attribute:: value :type: float Float value. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: AncillaNode(/, **data: Any) Node allocating ancillary qubits for temporary computation. .. py:attribute:: size :type: int :value: None Number of ancilla qubits allocated. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: NestedBlock(/, **data: Any) Represents a subgraph or code block used inside control flow nodes. .. py:attribute:: nodes :type: list[NestableNode] List of nodes within the block. .. py:attribute:: edges :type: list[Edge] Connections between the nodes. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: IfThenElseNode(/, **data: Any) Node representing conditional execution. .. py:attribute:: condition :type: str Condition expression used to branch execution. .. py:attribute:: thenBlock :type: NestedBlock Code block executed if the condition is true. .. py:attribute:: elseBlock :type: NestedBlock Code block executed if the condition is false. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: RepeatNode(/, **data: Any) Node representing a repeat loop structure. .. py:attribute:: iterations :type: int :value: None Number of loop iterations. .. py:attribute:: block :type: NestedBlock Code block to repeat. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: OperatorNode(/, **data: Any) Node representing a classical operation (arithmetic, bitwise, comparison). .. py:attribute:: operator :type: Literal['+', '-', '*', '/', '**', '|', '&', '~', '^', '<', '<=', '>', '>=', '==', '!=', 'min', 'max'] Type of operator (e.g., "+", "&", "=="). .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: Edge(/, **data: Any) Represents a connection between two ports of nodes. .. py:attribute:: source :type: tuple[Annotated[str, Field(description='Source node Id')], Annotated[int, Field(ge=0, description='Output index of source node')]] Tuple of (node_id, output_index). .. py:attribute:: target :type: tuple[Annotated[str, Field(description='Target node id')], Annotated[int, Field(ge=0, description='Input index of target node')]] Tuple of (node_id, input_index). .. py:attribute:: size :type: int | None :value: None Optional size override for the edge .. py:attribute:: identifier :type: str | None :value: None Optional name or alias of the connection. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: CompileRequest(/, **data: Any) Top-level object representing a full graph-based quantum compile request. .. py:attribute:: metadata :type: MetaData General information and optimization preferences. .. py:attribute:: nodes :type: list[Annotated[Node, Field(discriminator='type')]] List of all nodes forming the program graph. .. py:attribute:: edges :type: list[Edge] Directed edges defining input-output relationships between nodes. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: SingleInsertMetaData(/, **data: Any) Models the metadata of a single insert. .. py:class:: SingleInsert(/, **data: Any) Single insertion of an implementation for the enricher. .. py:class:: InsertRequest(/, **data: Any) Models a request for an implementation insert into the enricher.