OriginIR-ext backend

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=())[source]

Bases: object

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

Variables:
  • 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)[source]

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.

Parameters:

program – The closed program to export.

Returns:

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

Return type:

OriginIRArtifact

Raises:

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)[source]

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

Parameters:
  • 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.

Returns:

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

Return type:

list[complex]