Cyforanumera
npm

Reference

NumPy compatibility

Reference: NumPy 2.5.3. "Verified" means the behaviour is covered by the NumPy differential tests (the project's NumPy differential test suite).

Supported (verified)#

FeatureNotes
np.array dtype inferencebool / int64 / float64 rules; see divergences below
np.array(data, {dtype}) for all 12 real dtypesout-of-range ints raise ValueError (NumPy OverflowError)
np.zeros / np.emptyshape, strides (incl. zero strides for empty arrays), flags
astypeunsafe casting; float→int only verified for in-range values
reshapeview when layout allows, else copy; -1 inference
strided viewsasStrided; shape, strides, flags, values, copy() strides
mayShareMemoryNumPy may_share_memory bounds semantics
promoteTypesfull 14×14 table incl. complex
canCastall 5 casting rules × 14×14 dtype pairs (980 cases), default "safe", array arguments (dtype only, no value-based casting), unknown rule → ValueError
ones / full / eyeall real dtypes (ones shape/strides also verified for complex); full dtype inference
arangeint/float args, negative steps, empty ranges; int8/int32/float16/float32/float64 targets; bool ≤ 2 elements
linspaceendpoint, num 0/1, integer targets (floor, NumPy ≥ 2)
transpose / squeeze / expandDims / swapAxes / moveAxis / ravel / flattenshape, strides, flags, values, view-vs-copy, error class; on contiguous and transposed inputs
add subtract multiply divide power mod floorDivideall 12 real dtypes plus mixed pairs; result dtype, NaN/inf/-0, integer wrap, x//0, x%0; power on floats within rtol
abs negative sqrt exp logall 12 real dtypes; sqrt/exp/log within rtol (float16 1e-3, float32 1e-6, float64 1e-14)
broadcastingbroadcastShapes, broadcastTo, broadcast results incl. 0-d and zero-size; NEP 50 number scalars
indexing (get/slice/set)integer, negative, slice (incl. reverse/clamped/empty), ellipsis, newaxis, integer-array, boolean mask, 0-d bool, mixed advanced; result dtype/shape/values, view-vs-copy, basic-view strides, error class; setitem on int32/float64/uint8/bool with broadcast, cast and repeated indices
flags.writeablebroadcastTo views read-only; views inherit (basic index, transpose, expandDims, squeeze, swapAxes, moveAxis, view reshape, asStrided); copies writeable; writing a read-only view raises ValueError "assignment destination is read-only"
reductions (sum/prod/min/max/mean/var/std/argmin/argmax)12 real dtypes × axis none/0/1/-1/tuple/keepdims on (2,3,4); transposed inputs; NaN, signed zero, ties, empty arrays, 0-d, initial, ddof, dtype, bad/repeated axis. Exact dtype/shape/strides; exact values except float sum/prod/mean/var/std (relative tolerance)
complex reductions (same 9 functions)254 cases: complex64/complex128 × the same axis/keepdims set on (2,3,4); transposed inputs; lexicographic ties, NaN in either part, ±inf, signed zeros, empty arrays, 0-d, initial, ddof, bad axis, real input with a complex dtype=; 1000-element random inputs on trailing (pairwise) and leading (sequential) axes. Exact except complex prod (rtol 1e-5 / 1e-12) and the small-case var/std (real float results, same tolerance as real); var/std are exact on the large random inputs
matmul/dot/inner/outerfloat64/float32/int32/int8/uint16/bool (plus mixed int/float, float16, int8 wraparound) × 1-D/2-D/batched/broadcast/empty/mismatched shapes. Exact values for integer and bool; relative tolerance for floats
complex matmul/dot/inner/outer262 cases on both backends: complex64/complex128 × the same shapes plus every BLAS-dispatch shape, batched/broadcast stacks, N-D dot, empty operands, all 12 real dtypes mixed with either complex width, complex64·complex128, 0-d dot, inf/NaN, core/batch/0-d errors. Exact values (exactly representable inputs); large random gemm/gemv/dotu cases within 2e-5 / 1e-12 relative to max|x|
linalg.det/inv/solve/eig/eigh/svd/qr/lstsq/normfloat64/float32/int/bool inputs, batched stacks, singular and empty matrices, rectangular and rank-deficient matrices, NaN input to eig, float16 and non-square errors; every norm ord and axis/keepdims. dtype and shape exact. Values checked by tolerance (det, inv, solve, eigenvalues, S, lstsq, norm). Vectors checked by reconstruction and orthogonality: A·V=V·Λ, U·S·Vh=A, Q·R=A with upper-triangular R. Run on both Accelerate and fallback backends. Complex64/complex128 input to every function (complex_linalg group, 211 cases): square, batched, 1×1 and 0×0 matrices, Hermitian eigh/eigvalsh, rectangular and rank-deficient svd/qr/lstsq, every norm ord, mixed real/complex promotion, singular/NaN/non-square errors. Eigenvalues compared after sorting; vectors by reconstruction and unitarity (A·V=V·Λ, U·S·Vh=A, Q·R=A, Qᴴ·Q=I) and qr(mode='r') by |R|, since signs and phases depend on the backend
random: defaultRng Generator (random, uniform, standardNormal, normal, integers, choice, shuffle, permutation) and legacy seed/RandomState (rand, randn, random/randomSample, standardNormal, normal, uniform, randint, choice, shuffle, permutation)Bit-exact streams (exact equality) for int, bigint and array seeds, including chained calls that continue one stream; float32; int8/int16/uint8/uint32/int64/uint64/bool integers/randint; endpoint; choice with and without replacement (Floyd, partial-shuffle and shuffle=False paths); array populations; 1-D and 2-D shuffle, including Generator axis=1; bound/size/scale errors
fft.fft/ifft/rfft/irfft/fft2/ifft2/fftn/ifftn/fftfreq/rfftfreq697 cases: float64/float32/float16/int32/uint8/bool/complex128/complex64 inputs; lengths 1, odd, even, prime and power of two; n pad/truncate/0/-1; every axis incl. out of range; all three norm values plus a bad one, including float16 half-precision factors; zero-size and 0-d inputs; s/axes combinations (-1 entries, repeated axes, empty axes, s without axes, length mismatch). dtype and shape exact; values within 1e-12 (float64), 2e-6 (float32) and 2e-3 (float16) relative to max|x|. Complex input from JS (complex_fft group, 120 cases): nested np.complex lists and plain { re, im } objects (inferred, complex64, complex128), mixed number/bool/complex lists, transposed, reversed and step-2 views, n/axis/norm/s/axes, NaN input, 0-d and empty input; results read back through toArray() as Complex values

Documented divergences#

BehaviourNumPynumera
np.array([2**60])int64float64 (JS number is not safe int)
np.array([-0])int64 (Python int 0)float64 (-0 kept)
bigint > int64 max without dtypeuint64ValueError
as_strided out of boundsreads arbitrary memoryValueError
out-of-range int inputOverflowErrorValueError
float→int cast out of range / NaNplatform-dependentplatform-dependent (not tested)
int64/uint64 toArray()exact Python intsJS numbers, exact only to 2^53; use toTypedArray()
float16 toTypedArray()—raw bits as Uint16Array
full(shape, -1.5, {dtype: uint*})unchecked castValueError
invalid axisAxisErrorIndexError (repeated axis: ValueError)
incompatible broadcast shapesValueErrorBroadcastError
ufunc result layout (strides)order='K' default; 'C'/'F'/'A'same: NumPy's trivial-loop and NpyIter layout rules for every element-wise ufunc, incl. conjugate/angle (default 'K'), and dot/inner with a scalar
ufunc out= shape mismatchValueErrorBroadcastError
ufunc out= cast not same_kind, non-array outUFuncTypeError / TypeErrorDTypeError
ufunc out=(arr,) tuple formacceptednot accepted; pass { out: arr }
ufunc dtype=/casting= input or output cast refused, no matching loopUFuncTypeError / TypeErrorDTypeError
ufunc signature= / dtype= as a tupleacceptednot supported; dtype is a single dtype
ufunc where= without out: masked-out elementsuninitializedzero
ufunc where=Nonetreated as Falserejected (DTypeError)
subtract/negative on bool, unsupported loopsTypeErrorDTypeError
number scalar out of the array dtype's rangeOverflowErrorValueError
sqrt/exp/log/float powerNumPy SIMD kernelsplatform libm (may differ by a few ULP)
integer //0, %00 + RuntimeWarning0, no warning
a[1, 2] (full integer index)NumPy scalar0-d NDArray copy via get; item() for a JS scalar
advanced-index result stridesmay be non-C (internal transposes)always C-contiguous copy (same shape/values)
setitem value broadcast mismatchValueErrorBroadcastError
nested JS list as an index arraylist → array indexnot accepted; wrap in np.array
where(c, x, y) with JS number scalarsweak (NEP 50)inferred int64/float64 arrays
astype on non-C-contiguous inputkeeps layout (order='K')always C-contiguous (same values)
setflags(write=...)supportednot implemented; flag is read-only from JS
float sum/prod/mean/var/stdpairwise summationBit-exact with NumPy for C-contiguous float32/float64 input, with no cast and no initial, when the reduced axes are all trailing (pairwise) or all leading (sequential). Verified on AArch64. Other cases may differ by a few ULP: float16, dtype casts, initial, mixed/middle axes and non-contiguous input. prod is sequential on both sides.
complex sum/mean/var/stdpairwise summationSame exactness rules as float. var/std return float32/float64. Complex prod may differ by 1 ulp: NumPy's arm64 complex64 loop fuses one multiply (FMA)
complex matmul/dot/innerBLAS where NumPy's dispatch picks it, else NumPy's own loopAccelerate backend: same routine choice as NumPy, bit-identical on arm64. Fallback backend: always the non-BLAS loop, so with inf/NaN input it matches NumPy's non-BLAS result (e.g. inf+nanj) where Accelerate's gemv/gemm give nan+nanj; finite results within tolerance
complex detzgetrf in complex128, then castSame: complex64 input is computed in complex128 and rounded once; sign/log-magnitude formula of umath_linalg. Accelerate backend bit-identical on arm64 in random probes; fallback LU within tolerance
complex inv/solvezgesv in complex128, then cast; complex64 result only if every operand is float32/complex64Same routine, dtype rule and single final rounding. Accelerate backend bit-identical on arm64 in random probes; fallback LU within tolerance
complex qrzgeqrf/zungqr in complex128, then cast; R has a real diagonalSame routines and single final rounding, all modes. Accelerate backend bit-identical on arm64 in random probes; fallback Householder (zlarfg convention) within tolerance
complex svdzgesdd in complex128, then cast; S real (_realType); non-finite input raises before LAPACKSame routine, dtypes and NaN check. Accelerate backend: S bit-identical in random probes on arm64, U/Vh bit-identical in 57/60 (others ≤6e-17 apart). Fallback (complex Jacobi) matches S within tolerance; vectors match up to phase, checked by reconstruction
complex eigh/eigvalshzheevd (UPLO='L') in complex128, then cast; eigenvalues real; eigvalsh uses JOBZ='N'Same routine, JOBZ and dtypes; eigvalsh is now a native values-only call for real input too. Accelerate backend: values and vectors bit-identical in random probes on arm64 (complex128/complex64/float64). Fallback (complex Jacobi) within tolerance; vectors up to phase. Inf input: the fallback raises LinAlgError where LAPACK returns NaN
complex eig/eigvalszgeev (JOBVL='N') in complex128, then cast; eigvals uses JOBVR='N'Same routine, JOBVR and dtypes (complex64 in -> complex64 out); eigvals is now a native values-only call for real input too. Accelerate backend: complex128/complex64 values, eigvals and vectors bit-identical in a 15-case random probe each on arm64. Float64 eigenvectors match in 10/15; the other 5 are within 1 ulp, as before this change. Fallback (complex shifted QR) within tolerance; vectors up to phase
real float32 det/inv/solve/eig/eigh/svd/qr/lstsqcomputed in float64 (_commonType), result cast to float32computed in float32, so results are not expected to be bit-identical. Measured only for eigh so far: max |Δw| 7.6e-6 in a 15-case probe. Open item
complex min/max/argmin/argmaxlexicographicSame: real part, then imaginary part; a NaN in either part propagates and the first NaN wins
complex var/std with a different dtype=dtype-specific castsNotImplementedError
reduction result layout for non-C inputskeeps input orderalways C-contiguous (same values)
full reduction resultNumPy scalar0-d NDArray; item() for a JS scalar
empty mean/var/stdNaN + RuntimeWarningNaN, no warning
var export namenp.varnp.var on default export; named export variance
matmul/dot/inner/solve core-dimension mismatchValueErrorShapeError (batch mismatch: BroadcastError)
linalg on float16TypeErrorDTypeError
eigenvector / singular-vector signs and phasesLAPACK (OpenBLAS)backend-dependent (Accelerate or fallback); same subspaces
decomposition resultnamed tupleplain object ({eigenvalues, eigenvectors}, {U, S, Vh}, {Q, R}, {x, residuals, rank, s})
svd/qr optionsfull_matrices=, compute_uv=, mode={fullMatrices, computeUV}, qr(a, mode)
float matmul / decompositionsOpenBLASAccelerate or fallback loops; may differ by rounding
random with no seedOS entropy via SeedSequenceOS entropy (node:crypto randomFillSync); the legacy global state is array-seeded with 624 entropy words (not reproducible either way)
random distribution parametersbroadcast array loc/scale/low/highscalars only; arrays raise NotImplementedError
random scalar resultsNumPy scalarJS number/boolean (the toArray 2^53 limit applies to int64 > 2^53)
rfft on complex inputTypeErrorDTypeError
fftfreq/rfftfreq with n == 0 or d == 0ZeroDivisionErrorValueError
fftn with s but no axesDeprecationWarningaccepted silently (same result)
FFT complex resultscomplex ndarraycomplex64/complex128 NDArray; elements read as np.Complex
complex scalarsPython complexfrozen np.Complex {re, im}; {re, im} objects accepted as input
complex value into a real arrayTypeError (int) / ComplexWarning, imag dropped (float)DTypeError for every real dtype (astype still drops imag, like NumPy)
mod / floorDivide on complexTypeErrorDTypeError
complex sqrt/exp/log/power/abs/angleplatform libm / npymathNumPy's npymath algorithms (npy_csqrt, npy_clog, npy_cpow, SIMD cabsolute); exp, pow and atan2 come from the C++ library; libm results may differ by a few ULP
imag of a real arrayread-only zeros arraysame (read-only zeros)
kind: "heapsort"heapsortintrosort (same result; heapsort only as the depth-limit fallback)
kind: "mergesort"/"stable"timsort/radix sortstd::stable_sort (same stable order)
NDArray.sort({axis: null}), lexsort with axis: nullTypeErrorDTypeError
sort/partition axis out of rangeAxisErrorIndexError
unique with multiple-return flagstupleobject {values, indices?, inverse?, counts?}
unique of equal signed zeros ([0, -0]) with no flagshash path; which zero is kept is unspecifiedsort path; keeps the first zero in stable sorted order
unique({sorted: false})hash-table ordersorted order
uniqueAll/uniqueCounts/uniqueInversenamed tuples (inverse_indices)objects (inverseIndices)
intersect1d({returnIndices: true})tupleobject {values, indices1, indices2}
isin({kind: "table"})lookup tablesort + binary search (same result; errors identical)
ediff1d incompatible toBegin/toEnd, bool inputTypeErrorDTypeError
P4 long-double / object loopsg, G, O loopsnot available (no such dtypes)
P4 libm-based ufuncs (trig, exp/log, ...)platform libm / SIMDC++ std:: libm; may differ by a few ULP
divmod / modf / frexpufunc objects (where=, .reduce, ...)functions returning [NDArray, NDArray]; only out, dtype, casting
np.clipdedicated clip ufuncminimum(maximum(a, min), max), out only
nan_to_num replacementsscalars or arraysscalars only
unwrap on float16computed in float16computed in float32, cast back (last bit may differ)
P11 slogdet, cond, matrix_rank, vdot, einsum scalar resultsNumPy scalars / SlogdetResult namedtuple0-d NDArray; slogdet returns { sign, logabsdet }
P11 keyword arguments (cholesky(upper), pinv(rcond, hermitian, rtol), matrix_rank(tol, hermitian, rtol), tensorinv(ind), tensorsolve(axes), cross(axisa…), vecdot(axis), tensordot(axes), einsum(optimize))keywordstrailing options object
cholesky, slogdet, pinv, cond internal precisionLAPACK in the input precision (float32 stays float32)compute in float64/complex128, then cast to the NumPy result dtype
vecdot/matvec/vecmatgufuncs with out=, axes=, dtype=plain functions (vecdot takes axis only)
einsum resultmay be a view ('ii->i', 'ij->ji'); out=, dtype=, order=, casting=always a new array; those keywords are not supported
einsum without optimizesingle n-ary C loop (c_einsum)pairwise left-to-right contractions over matmul; results equal up to float rounding
einsumPath report for ... subscriptsellipsis letters from Python set order ("may vary")the highest unused letters (z, y, …)
einsumPath unknown path nameKeyError / TypeErrorValueError
a.flatflatiter object, a.flat[i]FlatIter with get(i)/set(i, v), iterable; a.flat = v assigns cyclically
a.flat[i] for an integerNumPy scalarJS scalar
a.tobytes()Python bytesUint8Array copy
a.setflags(align=, uic=)supportedNotImplementedError (only write)
a.fill(300) on int8OverflowErrorValueError
a.astype(dt, casting=) disallowedTypeErrorDTypeError
np.nditerfull iterator (buffering, writable operands, context manager)read-only NDIter, flags multi_index/c_index/f_index/zerosize_ok; others raise NotImplementedError
np.ndenumerate valuesNumPy scalarsJS scalars
np.finfo/np.iinfo fieldsNumPy scalars of the dtype; snake_caseJS numbers (camelCase); iinfo also has exact bigint minExact/maxExact
np.minScalarType(1e5)float32 (Python float)uint32: JS cannot tell 1e5 from 100000, so safe integers count as integers
np.minScalarType for integers beyond 64 bitsobjectValueError
np.commonTypereturns a scalar typereturns a DType
np.printoptions(...)context manager (with)callback form np.printoptions(opts, fn); options restored after fn
print option legacy'1.13', '1.21', '1.25', '2.1', '2.2' or Falseonly false; others raise NotImplementedError
formatter callables in array2string/print optionsPython callables; keys incl. str_kind, numpystr, datetime, objectJS callbacks for all, bool, int, float, complexfloat, int_kind, float_kind, complex_kind
formatFloatPositional/formatFloatScientific argument TypeErrorsTypeErrorDTypeError
String(a) / a.toString()n/a (repr(a))NumPy repr text
np.emath with scalar inputNumPy scalar0-d array
np.testing messages for JS integer-valued numbers1.0 (Python float)1 (JS has one number type)
np.testing.assertRaises / assertWarnscontext manager or callablecallable only; warnings are Node process.emitWarning warnings
np.testing.assertStringEqual diffdifflib with ? hint lines-/+ lines only
np.polynomial coefficient dtype / dimensionalityany dtype incl. object; N-D c with axis/tensorfloat64/complex128, 1-D only; no *val2d/3d, *grid*, *vander2d/3d, *gauss, *weight yet
np.polynomial operators and division by a zero seriesPython operators; ZeroDivisionErrormethods (add, mul, floordiv, pow, call, ...); ValueError

Not implemented#

  • Reduction keywords out=, where=; nansum/nanmean etc.; argmin/argmax with axis tuples (NumPy doesn't support them either).
  • Complex ufuncs beyond add, subtract, multiply, divide, power, negative, abs, sqrt, exp, log, conjugate and angle. Trig/hyperbolic functions and comparison ufuncs are not implemented for any dtype yet; they will accept complex input when they land.
  • Linalg (every implemented function accepts complex input): pinv, matrix_rank, matrix_power, cholesky, slogdet, cond, tensordot, einsum, vdot, kron; batched lstsq; out= parameters; eigh(UPLO='U') (only the lower triangle is used). The @ operator is not available in JS; use np.matmul.
  • NDArray operator methods; ufunc keywords on conjugate/angle (the other 12 element-wise ufuncs support out=, where=, casting=, dtype= and order=).
  • take out=; field (structured) indexing.
  • Random: choice(p=...), other distributions (exponential, gamma, binomial, poisson, ...), permuted, bytes, spawn, get_state/set_state, other bit generators (Philox, SFC64), and float32 normal with non-default loc/scale (NumPy has no such API either).
  • FFT: rfftn/irfftn/rfft2/irfft2, hfft/ihfft, fftshift/ifftshift, out=; fftfreq device=.
  • Not yet supported: order='F' for array creation/reshape/astype (ufuncs support it), arange/linspace with complex arguments, linspace retstep/axis.

P8 indexing extras (build-first, not yet differential-verified)#

Implemented natively: take mode= (raise/wrap/clip), takeAlongAxis, putAlongAxis, put (mode), putmask, place, choose (mode), compress, extract, select, piecewise, argwhere, flatnonzero, countNonzero (axis, keepdims), ravelMultiIndex (mode, order), unravelIndex (order), diagonal (read-only view), trace (dtype), and the NDArray methods choose compress diagonal nonzero put take trace. This supersedes the "take mode=; put, putmask, choose, compress" item under "Not implemented" (take out= is still missing). NumPy differential cases come in the V phase.

FeatureNumPynumera
countNonzero(a) without axis, ravelMultiIndex of scalarsPython int / np.int640-d int64 NDArray
unravelIndextuple of arraysNDArray[]
choose with an out-of-range weak int scalar (e.g. 300 with int8)wraps silentlyValueError
putAlongAxis(..., axis=null) on a non-contiguous arrayraises (writes to a read-only copy)writes through in flat C order
piecewise callbacksPython callablesJS callbacks on x[cond]
nested_itersiterator objectsexcluded (api/exclusions.json)

P7 creation and grids divergences#

BehaviourNumPynumera
mgrid/ogrid/r_/c_/s_/index_expindex-trick objects (np.mgrid[0:3, 0:1:5j])functions taking [start, stop, step] tuples (complex step = point count) or slice strings ("1:4", "0:1:5j")
r_/c_ matrix directives "r"/"c"return np.matrixNotImplementedError (no matrix class)
meshgrid/ix_/indices(sparse)/ogrid resultstuple (ogrid: list)JS array of NDArrays
logspace/geomspace boundsarray-like start/stop/base, axis=scalar (real or complex) start/stop/base only, no axis
np.astype on non-arraysTypeErrorDTypeError
tril/triu on 0-d inputValueErrorDTypeError
frombuffer resultread-only view sharing the bufferowned, writeable copy; native byte order only
fromstring binary mode (sep="")removed (ValueError)same ValueError
fromstring with count larger than the dataDeprecationWarning, short arrayValueError: string is smaller than requested size
fromiter without dtypeTypeErrordtype is a required positional argument

P5 — comparison, logic and bitwise#

AreaNumPynumera
logical ufuncs with casting=mixed dtypes accepted under casting="no" (inputs go through the bool loop)casting is checked against the promoted dtype, so mixed inputs under "no" raise DTypeError
uint64 vs int64 comparisonsexact comparisoncompared via float64 (can differ for values above 2^53)
dtype= on comparison/logical/classification ufuncsoutput signature, only boolsame; other dtypes raise DTypeError
isnatworks for datetime64/timedelta64always raises DTypeError (no datetime dtypes yet)
isscalartrue for Python and NumPy scalarstrue for JS number/boolean/bigint/string and complex scalars; false for every NDArray, including 0-d
bitwise ufuncs on float / uint64+int64 mixesTypeErrorDTypeError
isclose with float16each step rounded to float16evaluated in float32 (can differ only right at the tolerance boundary)
isclose rtol/atolscalars or arraysJS numbers only
allclose / arrayEqual / arrayEquiv resultPython boolJS boolean
bitorder=prefix match ("l...", "b...")only "big" / "little"; anything else raises ValueError
packbits/unpackbits bad axisAxisErrorIndexError
  • P9: unique({sorted: false}) unsorted order, isin table algorithm, benchmarks and NumPy differential cases for sorting/set functions.

P6 array manipulation divergences (build-first, unverified by differential tests)#

BehaviourNumPynumera
np.delete namedeletenamed export delete (implemented as del, a reserved word in JS)
slice arguments to insert/deleteslice(a, b, c){start, stop, step} object
pad option namesconstant_values, end_values, stat_length, reflect_typeconstantValues, endValues, statLength, reflectType
pad linear_ramp/mean/median precisioncomputed in the array's float dtypecomputed in float64 (complex128), cast once
pad mode emptyuninitialised paddingzero padding
non-integer pad_width / repeatsTypeErrorDTypeError
ndarray.resize refcheckPython refcountcount of live native arrays sharing the buffer (views not yet garbage-collected count)
delete with an index arrayadvanced-indexing result layoutF if input F- and not C-contiguous, else C
copyto casting / overflow errorsTypeError / OverflowErrorDTypeError / ValueError
require unknown flagKeyErrorValueError
broadcast_arrays writeable viewswriteable with FutureWarningwriteable, no warning
asanyarraykeeps subclassessame as asarray (no subclasses)

P12 — FFT completion (build-first, not yet differential-verified)#

New: np.fft.hfft ihfft rfftn irfftn rfft2 irfft2 fftshift ifftshift, and out for every transform. The compute precision now follows NumPy's ufunc loop selection (for example, float32 real input to fft runs the float64 loop). Ad-hoc checks against NumPy 2.5.3 were bit-exact; the committed differential cases are still to be written.

BehaviourNumPynumera
FFT out= cast not same_kindUFuncTypeErrorDTypeError
FFT out= other dims not broadcastableValueErrorBroadcastError
out= given as a non-arrayTypeErrorDTypeError
rfftn/irfftn with axes=[]IndexError (list index out of range)IndexError
ihfft/rfftn on complex inputTypeErrorDTypeError
fftshift/ifftshift of a 0-d arrayValueError from np.rollValueError
s without axes (rfftn, irfftn)DeprecationWarningaccepted, no warning

P11 linear algebra completion#

Implemented on both linalg backends: linalg.cholesky (upper), slogdet, svdvals, matrixPower, pinv, matrixRank, cond, vectorNorm, matrixNorm, matrixTranspose, diagonal, trace, outer, tensorinv, tensorsolve, cross, tensordot, multiDot, vecdot; np.vdot, kron, cross, tensordot, vecdot, matvec, vecmat, einsum, einsumPath; NDArray dot. This supersedes the "pinv, matrix_rank, matrix_power, cholesky, slogdet, cond, tensordot, einsum, vdot, kron" part of the Linalg item under "Not implemented". Batched lstsq (NumPy 2.5.3 rejects stacks too), out= and eigh(UPLO='U') are still missing. Divergences are listed in "Documented divergences".

load of an empty fileEOFErrorValueError
allow_pickle / mmap_mode in loadobject arrays via pickle, memory mapsnot supported (ValueError)
savetxt %x on boolTypeErroraccepted (0/1)
fromfile with offset past the endValueError (negative dimensions)empty array
fromregex resultstructured array{name: NDArray} object
genfromtxt dtype=None, names, converters, usemasksupportednot supported
base_repr of a floattruncatesTypeError
kaiser windowNumPy i0same Chebyshev coefficients, may differ by 1 ulp (libm)
poly1d operatorsp(x) p+q p*q p/q p**n p[k]methods call add mul div pow get/set
polyfit rank warningRankWarning classNode warning named RankWarning

P16-D datetime64/timedelta64/busday#

FeatureNumPynumera
datetime64/timedelta64 dtypeC-level DType in the dtype enum, accepted by ufuncsTS DatetimeArray/TimedeltaArray subclass wrapping int64 NDArray + unit string; rejected by all ufunc loops
Arithmetic on datetime arraysa + b, a - b operator overloadsNot yet implemented (arithmetic must be done via explicit offset conversions)
np.array(["2023-01-15"], dtype="datetime64[D]")Creates datetime64 arrayNot wired into array(); use datetime64() directly
busday_offset NaT inputReturns NaTReturns NaT sentinel (same)
datetime_as_string timezone offset outputCan display timezone offsetsAll output is UTC (timezone parameter accepted but ignored)
np.strings.encode(a, encoding)encodes str_ to bytes_ with given codecidentity stub — no bytes_ DType in JS; returns input unchanged
np.strings.decode(a, encoding)decodes bytes_ to str_ with given codecidentity stub — returns input unchanged
np.strings.mod(a, values)full Python %-format (all conversion types)subset only: %s %d %i %o %u %x %X %e %E %f %F %g %G %%
np.strings.translate(a, table)table is dict keyed by ordinal (int)table is Map<string, string|null> (char→char/null) — ASCII-compatible only
np.rec.recarray memory modelC-contiguous structured buffer, single allocationJS object with separate named NDArray columns
np.rec.recarray field accessr.x returns a view into the struct bufferr.x returns the column NDArray directly
np.rec.fromfile / fromstringreads structured binary data from file/bufferraises NotImplementedError (deferred)
np.shares_memory maxWorkmay be approximate for high-dim overlapping viewsalways exact (native sharesMemory)
np.ptpdeprecated peak-to-peak functionexcluded (removed in NumPy 2.x)
np.asmatrix / np.bmat / np.matrixmatrix classexcluded (c)

P16B: np.ma masked arrays#

np.ma is now implemented in pure TypeScript. Known divergences:

NumPy behaviournumera behaviour
ma.masked is a 0-d MaskedArray with dtype float64ma.masked is a symbolic object sentinel
ma.nomask is False (Python bool)ma.nomask is false (JS boolean)
MaskedArray inherits ndarrayMaskedArray wraps NDArray
ma.fill_value defaults vary by dtypedefaults are float64-based (1e20, max float64)
ma.compress_nd(x, ndmin) accepts ndminnot supported (ignored)
ma.convolve mode 'same' uses central portionidentical
ma.corrcoef rowvar parameterrowvar=True default only
ma.cov full parameter setrowvar, bias, ddof supported
Structured arrays / record arrays in manot supported
ma.flatten_structured_arrayreturns identity (not structured)

P10 statistics & NaN-reductions (build-first, not yet differential-verified)#

Implemented natively: median, percentile, quantile, nanmedian, nanpercentile, nanquantile, cumsum, cumprod, cumulativeSum, cumulativeProd, nancumsum, nancumprod, diff, ptp, nansum, nanprod, nanmean, nanvar, nanstd, nanmin, nanmax, nanargmin, nanargmax, average, cov, corrcoef, gradient, trapezoid, histogram, histogramBinEdges, histogram2d, histogramdd, bincount, digitize, interp, correlate, convolve, and where=/out= for np.sum/prod/min/max/mean/var/std. NumPy differential cases and benchmarks come in the V phase.

FeatureNumPynumera
histogram rightmost binhalf-open [edge, +∞) → closed on rightclosed on both sides for the last bin; matches NumPy exactly
bincount([])zeros(0, int64)zeros(0, int64) (empty input is safe; no error)
histogram with identical range endpoints (range=[v,v])RuntimeWarning, all counts 0ValueError (zero-width range is never meaningful)
convolve([], [])array([], dtype=float64)array([], dtype=float64) — matches
np.min/max with where= and no initial=ValueErrorValueError (same)
where= masked-out elements in reduction outputuninitializedzero
nanargmin/nanargmax on all-NaN sliceValueErrorValueError (same)
quantile method='inverted_cdf' with weights=supported in NumPy ≥ 2.0supported