A portable, scientific-grade numerical computing library in pure C99 for resource-constrained embedded systems.
Most numerical libraries assume a heap, an OS, and a math coprocessor. numx assumes none of those things. It targets the processors where computation is hardest: ESP32, ARM Cortex-M/A, AVR, RISC-V — and it brings algorithms previously considered out of reach (automatic differentiation, compressed sensing, post-quantum NTT) to those platforms.
Every function is reentrant, allocation-free, and returns a typed status code. The entire precision of the library — float32 or float64 — is switchable with a single compile flag.
| Module | Functions | Status |
|---|---|---|
| linalg | dot, norm, cross, mat_mul, transpose, det, LU | ✅ complete |
| stats | mean, variance, median, percentile | ✅ complete |
| roots | bisect, newton, brent | ✅ complete |
| integrate | trap, simpson, gauss | ✅ complete |
| differentiate | forward, central, richardson | ✅ complete |
| interpolate | linear, cubic spline, chebyshev | ✅ complete |
| poly | eval (Horner), roots (Newton + deflation) | ✅ complete |
| ode | rk4, rk45 (adaptive) | ✅ complete |
| signal | windows, FIR, IIR, convolve, correlate, peaks, EMA | ✅ complete |
| fft | Cooley-Tukey f32, Q15, IFFT, magnitude | ✅ complete |
| autodiff | forward-mode (dual numbers), reverse-mode (static tape) | ✅ complete |
| compressed_sensing | OMP, ISTA | ✅ complete |
| sketch | randomized SVD (Halko-Martinsson-Tropp) | ✅ complete |
| ntt | Number Theoretic Transform (constant-time, Kyber/Dilithium params) | 🔧 planned |
All results are device-run, per-formula values with measured error margins — not simulation. Full tables: validation/results/.
| Platform | Toolchain | Modules | Tests |
|---|---|---|---|
| x86-64 — Intel i7-13700H / Ubuntu 22.04 | gcc 11.4.0 -O2 / float32 | 13 / 13 | 300 / 300 ✅ |
| ARM64 — Apple M4 Pro / macOS 26.2 | Apple clang 21.0.0 -O2 / float32 | 13 / 13 | 300 / 300 ✅ |
| ARM64 — Apple M1 Pro / macOS 26.2 | Apple clang 17.0.0 -O2 / float32 | 13 / 13 | 300 / 300 ✅ |
| Windows x64 — MSVC 14.51 (VS 2026 Build Tools) | MSVC /O2 / float32 | 13 / 13 | 295 / 295 ✅ |
| Windows x64 — MSVC 14.51 (VS 2026 Build Tools) | MSVC /O2 / float64 | 13 / 13 | 294 / 294 ✅ |
| ESP32-S3 — Xtensa LX7 / ESP-IDF v5.5.2 | xtensa-esp32s3-elf-gcc -O2 / float32 | 13 / 13 | 548 / 550 ✅ |
ESP32-S3: 2 sketch test cases fail due to
rand()seed portability across libc implementations — the RSVD algorithm is correct; the test fixture is not portable. See FLAG S-01 invalidation/results/sketch/sketch.md.
Option A — FetchContent (recommended)
include(FetchContent)
FetchContent_Declare(numx
GIT_REPOSITORY https://github.com/NIKX-Tech/numx.git
GIT_TAG v0.1.0
)
FetchContent_MakeAvailable(numx)
target_link_libraries(my_target PRIVATE numx::numx)Option B — clone and build locally
git clone https://github.com/NIKX-Tech/numx.git
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
ctest --test-dir build --output-on-failureSwitch to double precision:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DNUMX_USE_DOUBLE=1#include "numx/numx.h"
int main(void) {
/* Switch precision via -DNUMX_USE_DOUBLE at compile time. */
/* All functions return numx_status_t — always check it. */
numx_real_t result;
numx_status_t s = numx_integrate_simpson(my_func, 0.0f, 1.0f, 100, &result);
if (s != NUMX_OK) {
/* handle error */
return 1;
}
return 0;
}Per-call averages measured on physical hardware. Full tables: validation/results/.
| Function | x86-64 (gcc -O2) | ESP32-S3 (240 MHz) |
|---|---|---|
numx_vec_dot n=64 |
15 ns | 5.5 µs |
numx_mat_mul 4×4 |
26 ns | 11 µs |
numx_lu_decompose 4×4 |
29 ns | 10 µs |
numx_integrate_gauss npts=8 |
11 ns | 2.7 µs |
numx_root_brent tol=1e-6 |
103 ns | 20 µs |
numx_ode_rk45 tol=1e-4 |
239 ns | 40 µs |
numx_stats_median n=128 |
6.6 µs | 1.1 ms |
numx_fft_f32 N=64 |
3.6 µs | 2.6 ms |
numx_autodiff fwd chain-10 |
20 ns | 358 ns |
See CONTRIBUTING.md for the rules, templates, and the exact prompt pattern to use with Claude Code when adding a new algorithm.
MIT — see LICENSE.
Once the accompanying paper is published, cite as:
@software{numx2026,
author = {NIKX Technologies},
title = {numx: Scientific Numerical Computing for Embedded Systems},
year = {2026},
url = {https://github.com/NIKX-Tech/numx},
license = {MIT}
}