Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
oracq documentation
oracq documentation

Manuals

  • Complete documentation
    • Installation and environment
    • Operations, registers, and the generation process
    • Source code structure
    • Oracles and operator representations
    • QRAM data structures: pointers, offsets, and random writes
    • Quantum data structures and the KP recommendation system
    • Conventions owned by algorithms: starting from one gate
    • Implementing QPDE/QODE: multiple input paradigms, replaceable oracles, and protocols
    • Automatically generating reversible quantum modules from ordinary math functions
    • QFVM input models and solver replacement
    • General QHAM automatic generation: PDE → HAM → QCL → QODE
    • QCNN line-by-line implementation walkthrough
    • Export and execution backends
    • Resource estimation (Toffoli+Clifford+T+QRAM)
    • Command line
    • Import path migration
    • Applicability boundaries and validation status
  • Algorithm catalog
    • Data Loading and Input Models
      • State Preparation
      • Alias Sampling Preparation
      • XOR Database
      • Adjacency Oracle
      • Select-Swap QROM
      • QROM Lookup
      • Block Encoding Algebra
      • Sparse Access
      • Sparse Matrix Block Encoding
      • PREPARE–SELECT Decomposition
      • Purification Access
      • Gibbs State Preparation
      • Double Factorization
      • Tensor Hypercontraction
    • Basic Query Algorithms
      • Deutsch–Jozsa
      • Bernstein–Vazirani
      • Simon Sampling
    • Query and Search
      • Grover Search
      • Amplitude Amplification
      • Oblivious Amplitude Amplification
      • Fixed-Point Search
      • Amplitude Estimation
      • Quantum Counting
    • Fourier and Arithmetic
      • Quantum Fourier Transform
      • Fourier Addition
      • Order Finding
      • Modular Multiplication
      • Fixed-Point Arithmetic
      • Boolean Networks
    • Estimation and Testing
      • Quantum Phase Estimation
      • Hadamard Test
      • Swap Test
      • Heinrich Quantum Summation
      • Heinrich Quantum Integration
    • Hamiltonian Evolution and QSVT
      • Trotter Product-Formula Simulation
      • Hamiltonian Simulation Protocol
      • QSP Phase Synthesis
      • QSVT Phase Sequence
      • QSVT Matrix Inversion
      • QSVT Hamiltonian Simulation
      • Qubitization Walk
      • Truncated Taylor Block Encoding
      • Eigenstate Filtering
    • Quantum Linear Systems
      • Costa Walk QLSS
      • CKS Chebyshev QLSS
      • VTAA-CKS QLSS
    • Differential Equations
      • QODE Problem and Protocol
      • Linear Combination of Hamiltonian Simulations
      • Schrödingerization
      • CBMD
      • Fokker–Planck Input Model
      • Carleman Linearization
    • Variational and Optimization
      • Hardware-Efficient Ansatz
      • VQE Pauli Measurements
      • QAOA for MaxCut
      • Decoded Quantum Interferometry
      • Jordan Quantum Gradient Estimation
    • Quantum Walks
      • Coined Cycle Walk
      • Szegedy Walk
      • MNRS Quantum Walk Search
    • Quantum Machine Learning
      • Quantum Principal Component Analysis
      • QCNN
      • Density Matrix Exponentiation
    • Quantum Error Correction
      • Repetition Codes
    • Applications and Infrastructure
      • Quantum Finite Volume Method, QFVM
      • General QHAM
      • Math Function Compilation
  • Specification reference
    • Language and algorithm library conventions
    • RIR: the modular register-level intermediate representation
    • QRAM memory definition (qram YAML)
    • Open declarations, capabilities, and binding
    • MIR 0.1: the pure mathematical function graph
    • General QHAM: derivation from PDEs to quantum-adapted linear systems
    • Replacing the QLSS inside QFVM: a review of input models, QRAM data structures, and output contracts
    • OriginIR-ext and PySparQ review
  • API Reference
    • oracq package overview
    • Infrastructure API
      • Toffoli / U3 / CZ lowering
      • OriginIR-ext backend
      • PySparQ backend
      • Quantikz circuit export
      • Strict netlist export
      • Module builder
      • Resource estimation
      • Register reference executor
      • RIR objects
      • Register layout
      • Binding and capability analysis
      • Math-function compilation entry
      • Python math-function frontend
      • MIR objects
      • Math-function lowering
      • Math kernel generation
      • Native implementation registry
      • QRAM pointer-style read/write
      • QRAM YAML memory format
      • Host readout
      • RIR serialization
      • Structural validation
    • Algorithms API
      • Modular multiplication and order finding
      • Oracle query algorithms
      • Reversible arithmetic
      • Phase, amplitude, and overlap estimation
      • Fourier transforms and arithmetic
      • Hamiltonian evolution
      • Quantum summation and integration
      • PREPARE-SELECT decomposition
      • qsp_pyqsp
      • QSVT standard transforms
      • Search and amplitude amplification
      • solve
      • Operator-level synthesis optimization of spectral circuits
      • State-preparation composition
      • Matrix transform sequences
      • Quantum walks
      • Block-encoding composition
      • Algorithm contracts and reports
      • Select-Swap QROM data loading
      • Density-matrix input models and Gibbs states
      • Graph-walk search
      • initial
      • Algorithm structure protocols
      • Chemistry low-rank decomposition block encodings
      • QODE assembly interface
      • Operator wrappers and basic composition
      • Oracle declarations and implementations
      • PDE models and adapters
      • Quantum data structures (qsample and sample-and-query)
      • QHAM
      • Sparse-access adapters
      • Spectral input/output primitives and operator-level optimization
      • DQI decoding quantum interference optimization
      • Quantum gradient estimation
      • Variational algorithm circuits
      • Repetition codes and error recovery
      • Quantum linear systems
      • VTAA-CKS variable-time linear-system solver
      • Quantum convolutional neural networks
      • Quantum building blocks of QCNNs
      • QPCA quantum principal component analysis
      • Quantum semidefinite programming framework
      • KP quantum recommendation system
      • Carleman linearization
      • Quantum Newton method
      • CBMD
      • LCHS
      • Legacy compatibility entry points
      • QODE assembly interface
      • Linear ODE input models
      • Schrödingerization
      • SDE/Fokker–Planck input models
      • solver
      • PDE models and adapters
      • solver
    • Domain Applications API
      • Reference workload catalog
      • Flow fields and QRAM data
      • Algorithm gallery
      • Legacy compatibility entry points
      • oracle_study
      • QFVM application
      • QFVM direct QMem data path
      • QHAM PDE examples
      • QHAM finite closure
      • PDE models and adapters
      • Spatial discretization and classical reference
      • QHAM derivation report
      • Structured finite-difference ports
      • Roe matrix-element generation
      • Roe classical math formulas

Tutorials

  • Tutorials
    • Your first register program
    • Replacing an algorithm’s oracle
    • From a paper’s access model to implementation comparison
    • Search for an element and estimate the success probability
    • Supplying your own Hamiltonian decomposition
    • Swapping QODE methods for the same linear problem
    • Generating QHAM input from a PDE expression
    • Composing PDE inputs and solve instances
    • Composing linear ODE inputs and solve instances
    • Scientific computing workflows: input models, solvers, and reproduction
    • Running and modifying the algorithm gallery

Development

  • Development
    • Development and acceptance
    • Architecture paradigm and interface conventions
    • Framework survey notes (stage 1)
    • Writing documentation
    • Translation Glossary (Chinese → English)
    • Repository reorganization and the algorithm expansion panel
    • Algorithm research workflow improvements
    • Acceptance record for this version
    • Quantum algorithm implementation validation plan (review draft)
    • Validation coverage matrix
    • Quantum algorithm coverage workboard
Back to top
View this page

Running and modifying the algorithm gallery¶

English · 简体中文

The gallery places algorithms from different families into one unified run pipeline, making it easy to compare their inputs, registers, and readout. All cases are constructed uniformly by algorithm_gallery.

uv run python examples/algorithm_gallery.py

Each subdirectory contains closed.rir.yaml, modular.originir, and toffoli_u3_cz.originir. Bernstein–Vazirani additionally saves the open description from before binding. index.json records the family, the module count, and the readout instructions.

Choosing which results to check¶

Do not use the same readout for every algorithm. BV reads the secret string; QPE and amplitude estimation read the phase; the Hadamard test estimates the Z expectation of the probe; repetition-code recovery checks the logical state and keeps the syndrome.

Use the following code to find the cases:

from oracq.applications.gallery import algorithm_gallery

# Build every gallery case and index them by name for easy lookup.
cases = {case.name: case for case in algorithm_gallery()}
# Print all case names currently covered by the gallery.
print("\n".join(sorted(cases)))
# Confirm the QAOA max-cut case exists (the gallery covers the variational family).
assert "qaoa_maxcut" in cases
# Every case carries a family label: order finding belongs to the number_theory family.
assert cases["order_finding"].family == "number_theory"
# The gallery holds 22 cases; adding or removing one trips this assertion as a reminder to update in sync.
assert len(cases) == 22
amplitude_amplification
amplitude_estimation
ansatz
bernstein_vazirani
cycle_walk
deutsch_jozsa
fourier_add
grover
hadamard_imag
hadamard_real
hamiltonian_trotter
modular_multiply
order_finding
phase_estimation
qaoa_maxcut
qft
quantum_counting
repetition_bit
repetition_phase
simon
swap_test
vqe_pauli_measurement

The 22 printed names are all the cases currently covered by the gallery, spanning search, estimation, arithmetic, walks, error correction, and the variational family; when cases are added or removed, this output must be updated together with the len(cases) == 22 assertion.

To add application examples, call the corresponding algorithm file from your own script. To extend the public gallery, provide GalleryCase with an operation and concrete readout instructions, and add an independent mathematical witness.

Cross-checking against a real backend¶

PYTHONPATH=src /path/to/backend/python examples/algorithm_gallery.py --native

The script compares the complex amplitudes of the reference executor, PySparQ, and OriginIR case by case and exits immediately when a tolerance is exceeded. It verifies that the same circuit is semantically consistent across the backends; whether a given parameter suits a real problem still requires application-level analysis.

Related pages¶

  • Manual: Algorithm catalog (most algorithms covered by the gallery have entry pages), Export and execution backends

  • API reference: Algorithm gallery

  • Continue with: Search for an element and estimate the success probability, Supplying your own Hamiltonian decomposition

Next
Development
Previous
Scientific computing workflows: input models, solvers, and reproduction
Copyright © 2026, oracq developers
Made with Sphinx and @pradyunsg's Furo
On this page
  • Running and modifying the algorithm gallery
    • Choosing which results to check
    • Cross-checking against a real backend
    • Related pages