Skip to main content

NumericAL

A pure, header-only C++20 numerical computing library — a leaf of the SciLang ecosystem (a sibling of REAL), generic over its scalar type and depending on nothing but the C++ standard library.

NumericAL is agnostic of expressions and of any symbolic layer: it computes with concrete numeric structures — vectors, matrices, tensors — and the algorithms over them. SciLang consumes it as a numeric backend through its module seam; the symbolic↔numeric reconciliation stays in SciLang.

Capabilities

Small and complete, grown measured, honest about what is not yet here:

  • numerical::vector<T> — a dense, value-semantic vector: element-wise arithmetic, scalar multiplication, dot product, tolerance comparison, shape checks.
  • numerical::matrix<T> — a dense, row-major, value-semantic matrix: element-wise arithmetic, scalar / matrix–vector / matrix–matrix products, transpose, tolerance comparison, shape checks.
  • numerical::lu_decomposition<T> — an LU factorisation (partial pivoting) computed once and reused: solve (any number of right-hand sides), determinant, and inverse. Free solve / determinant / inverse are one-shot conveniences.
  • numerical::cholesky_decomposition<T> — A = L Lᴴ for a Hermitian positive-definite matrix (about twice as cheap as LU): the factor lower(), solve, and determinant; throws not_positive_definite_error otherwise.
  • numerical::qr_decomposition<T> — A = Q R (modified Gram–Schmidt) for an m × n matrix with m ≥ n: the factors q() / r() and a least-squares solve of A x ≈ b; throws singular_matrix_error if the columns are dependent.
  • numerical::symmetric_eigen — eigenvalues (ascending) and eigenvectors of a real symmetric matrix by cyclic Jacobi rotations (A = V Λ Vᵀ).
  • numerical::svd_decomposition — the singular value decomposition A = U Σ Vᵀ of a real m × n matrix (m ≥ n), via the eigendecomposition of Aᵀ A: singular_values() (descending), u(), v().
  • numerical::tensor<T> — a dense, row-major, N-dimensional tensor (rank-1 is a vector, rank-2 a matrix, rank-0 a scalar; built directly or from a vector / matrix), with einsum — Einstein-summation index notation for contractions and general products, as in NumPy / PyTorch. einsum is the unifying primitive of the algebra: "ij,jk->ik" is the matrix product, "i,i->" the dot product, "ij->ji" the transpose, "ii->" the trace, "i,j->ij" the outer product, "ij->i" a row reduction. It takes one or more operands and sums over every label absent from the output, in a deterministic order.

Grows in as measured: sparse storage, complex Hermitian eigen/SVD, non-symmetric eigenvalues, FFT, numeric autodiff, iterative solvers, numerical integration, arbitrary precision.

Build

make test        # build and run the test suite
make coverage    # line-coverage summary + HTML report
make sanitize    # tests under AddressSanitizer + UndefinedBehaviorSanitizer
make lint        # clang-tidy
make format      # uncrustify, in place
make doc         # API reference (Doxygen) with embedded coverage

Override the compiler with make test CXX=g++-14.

numerical::numerical is the CMake target — add_subdirectory, FetchContent, or an installed config package:

# After `cmake --install <build> --prefix <prefix>`:
find_package(numerical CONFIG REQUIRED)
target_link_libraries(app PRIVATE numerical::numerical)

Releasing

make release computes the next calendar version YYYY.M.PATCH — the patch resets each month, the first release of a month is .0 (PEP 440 drops leading zeros, so 2026.6.1, never 2026.06.001) — bumps it in pyproject.toml and python/numerical/__init__.py, then commits, tags and pushes from a clean main. Pushing the tag drives release.yml, which checks the tag matches the version, builds the abi3 wheels (Linux x86-64/aarch64, macOS universal, Windows) and the sdist, and publishes to PyPI via Trusted Publishing (OIDC, no stored secret).

One-time PyPI setup (before the first release): create a Trusted Publisher for the project numeric-al — owner RECHE23, repository NumericAL, workflow release.yml, environment pypi — and create the matching GitHub Environment named pypi. Until that exists the build/sdist jobs still run, but the publish step fails; the pushed tag remains a valid versioned snapshot regardless.

Python binding

pip install numeric-al        # the distribution is numeric-al; the module is numerical

A CPython binding (stable ABI, one cp310 abi3 wheel serves 3.10+) exposes the unifying object numerical.Tensor (rank-1 a vector, rank-2 a matrix, rank-0 a scalar; float64 or complex128) and the algebra over it:

import numerical
a = numerical.Tensor([1, 2, 3, 4], shape=(2, 2))
b = numerical.Tensor([5, 6, 7, 8], shape=(2, 2))
numerical.einsum("ij,jk->ik", a, b)             # matrix product
numerical.einsum("i,i->", numerical.Tensor([1, 2, 3]), numerical.Tensor([1, 2, 3]))  # dot
numerical.solve(a, numerical.Tensor([1.0, 1.0]))   # a @ x = b

The decomposition layer is exposed too (a numpy.linalg-style surface): determinant(a), inverse(a), lstsq(a, b), cholesky(a), qr(a) → (Q, R), eigh(a) → (values, vectors), svd(a) → (U, S, V). determinant / inverse / lstsq / cholesky / qr accept float64 and complex128; eigh / svd are float64 only (matching the C++ layer).

A Tensor is a citizen of the scientific Python stack, zero-copy:

import numpy as np, torch
np.asarray(t)          # via __array_interface__ (a read-only view)
np.from_dlpack(t)      # via __dlpack__
torch.from_dlpack(t)   # the same DLPack capsule — JAX / CuPy consume it too
numerical.asarray(np.eye(3))   # the other direction (a contiguous-array copy)

numerical.get_include() returns the header directory, so the C++ library can be located through its Python install. make python builds the extension in place; make python-test runs the binding suite — including a seeded differential fuzzer that checks hundreds of random einsum specifications and linear-algebra problems against NumPy within tolerance (when NumPy is importable, as in CI). PETSc (petsc4py) has no such exchange protocol — bridging it would require an explicit copy into a PETSc object.

Benchmarks

NumericAL is validated against NumPy for both result and speed — make bench-python checks every operation matches NumPy within a tolerance, then times it; make python-test runs the correctness parity suite alone (also in CI). The results and methodology, with an honest reading of the gap, are in BENCHMARKS.md: NumericAL is a portable, dependency-free reference implementation: correct within tolerance, and competitive with NumPy's own einsum/linalg (it beats np.einsum's non-BLAS path and the decompositions land within ~1–4×). Against hand-tuned BLAS (np.matmul) its cache-blocked, std::thread-parallel GEMM is ~10× slower but steady (no cache cliff) — that gap is BLAS's per-architecture SIMD micro-kernel, which a header-only library does not chase. See BENCHMARKS.md for the honest details.

Numerical discipline

Floating-point accuracy is documented, never claimed exact where it cannot be; results are deterministic given inputs and any tolerance/seed; differential tests compare against references within a documented tolerance. Same gate bar as the rest of the ecosystem: 100% coverage, clang and g++-14, lint, format, and sanitizers green.

License

MIT — see LICENSE.

Author

René Chenard

Metadata

Release files for numeric-al 2026.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for numeric-al 2026.10.0
File Size Uploaded
numeric_al-2026.10.0.tar.gz 17.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for numeric-al 2026.10.0
File
numeric_al-2026.10.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
numeric_al-2026.10.0-cp310-abi3-win32.whl CPython 3.10 abi3 Windows x86-32 Details
numeric_al-2026.10.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
numeric_al-2026.10.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
numeric_al-2026.10.0-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
numeric_al-2026.10.0-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.24+ ARM64, Linux glibc 2.28+ ARM64 Details
numeric_al-2026.10.0-cp310-abi3-macosx_11_0_x86_64.whl CPython 3.10 abi3 macOS 11.0+ x86-64 Details
numeric_al-2026.10.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details

Total release size: 6.6 MB

Release files / numeric_al-2026.10.0.tar.gz

Download URL numeric_al-2026.10.0.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0a41a9461832da843d12d0abfcc6371a906181e233aeae7779697b412faccdc9
BLAKE2b-256 checksum
How to use checksums
416b61a5149e7cb762ce0c366debbcb802b2c7dc82649aa41978e2ec34a20a56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / numeric_al-2026.10.0-cp310-abi3-win_amd64.whl

Download URL numeric_al-2026.10.0-cp310-abi3-win_amd64.whl
Size 287.5 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b3dc21320d7adde24a71e6ede2ea6055e0da7db2a3fac7eaee7bec2982320cce
BLAKE2b-256 checksum
How to use checksums
5e64abb2d0ae170865975b10e439b1ad03851cbc584e328c81e74dfce2e3fac5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / numeric_al-2026.10.0-cp310-abi3-win32.whl

Download URL numeric_al-2026.10.0-cp310-abi3-win32.whl
Size 282.6 kB
Tags CPython 3.10 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
ac7df47ed0e1d6078c0c96ee1370ce678c56f91eb5d650577076c1d55c5e947e
BLAKE2b-256 checksum
How to use checksums
f97a09e84c6d0fe9a730ea1246be27322dce3dfe9fb52f96cda1dfb7134f10c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / numeric_al-2026.10.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL numeric_al-2026.10.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 2.0 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
7d321f42735340288696cde9d67d71b1f38a96d062b62a903470e40289c59d06
BLAKE2b-256 checksum
How to use checksums
0d7a486ba0c874cdfd1370b4c24806c4579c108de22111ec56b1015e364c8990
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / numeric_al-2026.10.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL numeric_al-2026.10.0-cp310-abi3-musllinux_1_2_aarch64.whl
Size 1.9 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
8b2c0e0addb1da528fa9329c102b3ca07d5a1e071897b52a518021d2aab39a54
BLAKE2b-256 checksum
How to use checksums
719c18ef9a83a6a7cd7ab5e7c2779f708b9b6bb622664e94e4986e01c4433818
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / numeric_al-2026.10.0-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL numeric_al-2026.10.0-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 960.7 kB
Tags CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
0eca52ce70b1598ca3187a014d4809c3444eb3a11a72bdd68ca60b4ea6b9de1c
BLAKE2b-256 checksum
How to use checksums
89c9bed45d98d8c5396beeee441fb720a137209aad4b01f5ef2aa6a1a7e4a74f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / numeric_al-2026.10.0-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL numeric_al-2026.10.0-cp310-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 931.0 kB
Tags CPython 3.10 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
f31350e10d40903f8de72b904b5c936471ea76c54d95bb7664b502bbc32ac5a3
BLAKE2b-256 checksum
How to use checksums
33fb7c2dfec01139041afe757f6f0a2d1f58f8a69555124bba6c3cfd4d0cf81a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / numeric_al-2026.10.0-cp310-abi3-macosx_11_0_x86_64.whl

Download URL numeric_al-2026.10.0-cp310-abi3-macosx_11_0_x86_64.whl
Size 110.8 kB
Tags CPython 3.10 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
9a962c710a5cb59eabad3199fe9f546aa15ca528e7eec30f766237c96abbe194
BLAKE2b-256 checksum
How to use checksums
018e94cc5f950d56389388129467a958c3188411758efd65cb031b5418f7c25b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / numeric_al-2026.10.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL numeric_al-2026.10.0-cp310-abi3-macosx_11_0_arm64.whl
Size 103.8 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c1a5de9d711aeed410ef91715f7a2c4c9261b2809f9b11574df4a18e52620580
BLAKE2b-256 checksum
How to use checksums
614ddfd372cc1291902ec3fab152d6a1659a1a382aacba27fad94808e1478c6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.10.0 This release

9 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page