OriginIR-ext 后端

oracq.infrastructure.backends.originir

Directly emit modular OriginIR-ext, with controls expressed via inline controlled_by.

class oracq.infrastructure.backends.originir.OriginIRArtifact(text, registers, resources, workspace_qubits=())[源代码]

基类:object

Text result of a modular OriginIR-ext export, with companion mapping information.

变量:
  • text (str) -- The complete OriginIR-ext source text, including QRAMDECL, all DEF definitions and the entry call.

  • registers (dict[str, tuple[int, ...]]) -- Mapping from entry register names to their tuples of occupied global qubit indices.

  • resources (dict[str, str]) -- Mapping from RIR resource names to QRAM names in the exported text.

  • workspace_qubits (tuple[int, ...]) -- Tuple of global qubit indices occupied by the entry's private workspace, empty by default.

text
registers
resources
workspace_qubits = ()
oracq.infrastructure.backends.originir.export_originir(program)[源代码]

Export a closed program as modular OriginIR-ext text.

Pure text export, requiring no quantum backend installation. Module calls and Repeats are kept as reusable DEF definitions and calls, not expanded at export time; controls are expressed via per-gate controlled_by and additional control formal parameters.

参数:

program -- The closed program to export.

返回:

The exported text plus register, resource and workspace mapping information.

返回类型:

OriginIRArtifact

抛出:

ValidationError -- The program structure is illegal, or an unbound oracle exists.

oracq.infrastructure.backends.originir.run_originir(program, memory=None, *, max_qubits=24, max_steps=1000000)[源代码]

Execute a small instance through a real UnifiedQuantum backend; the dependency is an optional install.

参数:
  • program -- The closed RIR program to execute; it must not contain runtime QRAM writes via Store.

  • memory -- Binding from resource names to QRAM contents; sequences give data words by index, mappings by address.

  • max_qubits -- The qubit budget cap for state-vector simulation, workspace included.

  • max_steps -- The instruction-step budget cap after expansion.

返回:

The final-state amplitudes over the entry's public register space, ordered from least to most significant bit.

返回类型:

list[complex]