What numera is#
numera is an n-dimensional array library for Node.js. It follows NumPy's API and behaviour closely, so code and knowledge carry over: the same dtypes and promotion rules, the same broadcasting, the same results from np.linalg, np.fft and seeded random generators. The numerical loops run in a C++20 core loaded as a Node-API addon. The TypeScript layer on top validates arguments and translates errors, and it gives every function a typed signature.
NumPy semantics
1045 of the 1054 NumPy 2.5.3 names numera tracks are implemented (99.1%). Behaviour is checked against real NumPy by thousands of differential test cases.
Native speed
Array data lives in native memory, and loops run in C++ instead of per-element JavaScript. On macOS, linear algebra uses Apple Accelerate.
Typed API
Every function has TypeScript declarations. Keyword arguments become typed option objects, and errors are typed classes such as ShapeError and LinAlgError.
Reproducible random numbers
np.random.defaultRng(seed) and np.random.seed(seed) produce the same numbers as NumPy, bit for bit.
Broad coverage
106 ufuncs with out, where and ufunc methods, plus linalg, fft, random, ma, strings, polynomial, emath, testing, file I/O and datetimes.
No build step
Prebuilt binaries ship for macOS and Linux on x64 and arm64. You do not need a compiler, CMake or Python.
A first look#
import np from "@cyfora/numera";
const a = np.array([[1, 2, 3], [4, 5, 6]]);
a.shape; // => [2, 3]
a.dtype.name; // => "int64"
np.add(a, 10); // => [[11, 12, 13], [14, 15, 16]]
a.sum({ axis: 0 }); // => [5, 7, 9]
np.mean(a, { axis: 1 }); // => [2, 5]
np.linalg.solve([[3, 1], [1, 2]], [9, 8]); // => [2, 3]In these docs, a // => comment shows the value of the expression. For an NDArray, that is .toArray(). The test suite runs every example in the API reference and every guide example.
Where to go next#
- Installation: supported platforms and package managers.
- Quickstart: a short tour of the main features.
- Coming from NumPy: a translation table from Python to numera.
- API reference: every function with its parameters, return value and an example.
- NumPy name index: look up any NumPy name and find its numera equivalent.
- NumPy compatibility: what is verified, and every documented difference.