Backend API Matrix

May 22, 2026 ยท View on GitHub

PyRecEst has two related backend contracts:

  1. the facade-level contract for functions exposed through pyrecest.backend;
  2. the public API contract for distributions, filters, trackers, and utilities.

The machine-readable source for both contracts is src/pyrecest/_backend/capabilities.py.

To inspect the current matrix from a checkout or installed environment, run:

pyrecest backends --format markdown
python scripts/render_backend_api_matrix.py
python scripts/check_backend_api_matrix.py

The documentation table is checked against src/pyrecest/_backend/capabilities.py in CI so the user-facing matrix cannot silently drift from the executable metadata.

Support Levels

LevelMeaning
supportedIntended to preserve backend semantics for the listed API.
bridgedWorks by crossing into another numerical stack, usually NumPy/SciPy; do not assume device, dtype, or gradient preservation.
partialNumerically useful, but with documented limitations such as SciPy bridges, CPU copies, or missing gradient/device guarantees.
unsupportedShould raise a clear NotImplementedError or be documented as unavailable for the backend.

Public API Rows

APINumPyPyTorchJAXNotes
BackendFacadesupportedpartialpartialFacade names are importable across backends, but some functions are bridged or explicitly unsupported.
DiscreteStateUtilitiessupportedbridgedbridgedFinite-state HMM and IMM utilities operate on NumPy arrays and SciPy sparse matrices; non-NumPy inputs are coerced.
DistributionConversionsupportedpartialpartialEuclidean particle/Gaussian conversions are portable; grid, Fourier, and manifold routes are route-specific.
EuclideanParticleFiltersupportedpartialpartialParticle operations are portable where sampling and resampling helpers preserve backend semantics.
EvaluationUtilitiessupportedbridgedbridgedSome plotting, assignment, and summary operations remain NumPy/SciPy oriented and may not preserve device or gradient semantics.
GaussianDistributionsupportedsupportedsupportedBasic construction, moment access, and portable operations should remain backend portable.
KalmanFiltersupportedsupportedsupportedLinear Gaussian operations are part of the portable baseline.
LinearDiracDistributionsupportedsupportedsupportedUsed by representation conversion and particle-style workflows.
MultiBernoulliTrackersupportedpartialunsupportedTracking workflows rely on assignment and measurement-set utilities that are currently NumPy-oriented.
PointSetRegistrationsupportedpartialunsupportedRegistration utilities may copy through NumPy/SciPy and should not be assumed differentiable.
SphericalHarmonicsEOTTrackersupportedunsupportedunsupportedDepends on spherical harmonics and SciPy-adjacent functionality.
UKFOnManifoldssupportedpartialunsupportedThe current implementation documents explicit JAX exclusions for predict/update.
UnscentedKalmanFiltersupportedpartialpartialPortable for backend-compatible model functions; advanced paths may still bridge through NumPy/SciPy.

When adding a new public API, add a row to the matrix, update docs if the row is user-facing, add or update the generated table, and add a focused backend test if the API is expected to be portable. CI checks that this table still reflects src/pyrecest/_backend/capabilities.py.

Runtime Access

Use the public helper when examples or downstream packages need to inspect backend support without duplicating the table:

from pyrecest import get_backend_support

assert get_backend_support("KalmanFilter", backend="jax") == "supported"

The CLI can also render the matrix:

pyrecest backends --format markdown