Skip to content

Examples

General Usage

The examples in this section are rendered notebooks. To see the interactive versions, check out these examples/!

Run pip install "propaq[examples]" to get everything the notebooks need (cirq, ffsim, hybrid, matplotlib, qiskit-nature, jupyter, ipywidgets), then run them locally.

Start at the top, the notebooks build on each other!

  • 1. Getting started


    The basics end to end: build a circuit, choose an observable, propagate, read off an expectation value.

  • 2. Pauli vs Majorana propagation


    The same unitary cluster Jastrow (UCJ) ansatz for \(\text{H}_2\) propagated in the Pauli and Majorana bases.

  • 3. Truncation pipelines


    Merging versus truncation, and how to compose weight, coefficient and budget truncators to keep branching under control.

  • 4. Variational quantum circuits


    Compile a parameterized ansatz into a surrogate model once, then drive it with a SciPy optimiser as a cost function.

  • 5. Surrogate model persistence


    Save a compiled surrogate to disk and reload it in another process, paying the build cost only once.

  • 6. Term streaming


    Write a propagated term sum to disk and read it back lazily, one term at a time, when it is too large to hold in memory.

  • 7. Zero cutoff extrapolation


    Sweep a truncation cutoff and extrapolate to zero to estimate the untruncated expectation value.

  • 8. Zero noise extrapolation


    The same idea applied to the damping rate, recovering the noiseless expectation value from a sweep of noisy runs.

  • 9. Custom gate registration


    Replace the transpile-based fallback for a gate with a hand-written generator decomposition, and let propaq validate it.

  • 10. Hybrid Schrödinger–Heisenberg


    Split a circuit in two, propagate one half and build the other as an MPS, then contract them in one native call.

  • 11. Propagating in a custom basis


    Implement the qudit Weyl–Heisenberg basis from scratch against propaq's abstract interfaces, and check it against exact dense simulation, a closed-form solution, and propaq's own Pauli propagator.

Native plugins

Writing noise models and truncation policies against the plugin ABI, in each supported language.

  • C plugins


    Build every C plugin under examples/plugins/c/, load each through NativeNoiseModel / NativeTruncator, and check it against its built-in equivalent.

  • Rust plugins


    The Rust counterpart: each plugin is a standalone cdylib crate.

  • Julia AOT plugins


    Julia plugins AOT-compiled with PackageCompiler.jl, loaded by propaq as plain C ABI libraries.

  • Batch ABI benchmark


    Measures the benefit of amortizing FFI overhead by batching calls to a plugin.

These notebooks are not executed at build time

The documentation renders each notebook's committed outputs rather than re-running it.