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!
-
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.
-
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.
-
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.
-
Sweep a truncation cutoff and extrapolate to zero to estimate the untruncated expectation value.
-
The same idea applied to the damping rate, recovering the noiseless expectation value from a sweep of noisy runs.
-
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.
-
Build every C plugin under
examples/plugins/c/, load each throughNativeNoiseModel/NativeTruncator, and check it against its built-in equivalent. -
The Rust counterpart: each plugin is a standalone
cdylibcrate. -
Julia plugins AOT-compiled with
PackageCompiler.jl, loaded by propaq as plain C ABI libraries. -
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.