Expand description
rumpy — a numpy-feature-compatible Python module implemented in Rust on top
of ndarray, exposed to rustpython_vm as the module numpy.
Supports the full numpy numeric dtype set:
bool- signed integers:
int8 / int16 / int32 / int64 - unsigned integers:
uint8 / uint16 / uint32 / uint64 - floats:
float16 / float32 / float64 - complex:
complex64 / complex128
Element type promotion follows numpy.result_type (see promote.rs).
The on-array data is a plain ndarray::ArrayD<T> per dtype — there is no
internal locking; synchronization is the embedder’s responsibility.
Re-exports§
pub use dtype::ArrayElement;pub use dtype::ArraysD;pub use dtype::CoerceArray;pub use dtype::DType;
Modules§
- convert
- Python ↔ ArraysD conversion.
- create
- Array constructors: zeros, ones, full, eye, arange, linspace.
- dtype
- Dtype machinery: the
DTypeenum, theArraysDstorage enum that holds onendarray::ArrayD<T>per numpy element type, and the dispatch macros and helpers used by every operation. - einsum
numpy.einsum— the subscript-string variant.- extras
- Second-tier numpy operations: logical/bitwise/finite predicates, clip, cumulative ops, where/nonzero, sort/argsort/unique, stack/squeeze/expand, repeat/tile, median/ptp.
- extras2
- Additional creation helpers, trig auxiliaries, and stats — the “obvious-numpy” surface that wasn’t in the first cut.
- fft
numpy.fft— 1-D forward/inverse FFT, 2-D variants, and real-input transforms, all routed throughrustfft. Frequencies follow numpy’sfftfreq/rfftfreqconventions.- fmt
- repr() and str() formatting for ArraysD.
- index
- Indexing & slicing.
- internal
- Small helpers for “this should not happen, but if it does, raise a clean Python error instead of panicking.”
- linalg
- dot / matmul (numpy semantics for 1-D and 2-D cases).
- linalg_
extra numpy.linalgalgorithms: norm, det, inv, solve, matrix_rank. Pure-Rust implementations on f64 (input promoted to f64 first).- more_
ops - Third-tier numpy operations: flip/roll/rot90, column_stack/dstack, diag/triu/tril/diagflat, atleast_Nd, count_nonzero/bincount/histogram, nan-aware reductions, searchsorted, meshgrid, interp/trapz/gradient.
- npy
- Reader/writer for the numpy
.npyformat, version 1.0. - npz
- Reader/writer for the numpy
.npzformat. - ops
- Elementwise binary arithmetic with broadcasting + unary ufuncs.
- poly
- Polynomial helpers:
polyval,roots,polyfit. - promote
- Numpy-compatible type promotion (
numpy.result_type). - random
numpy.random— pseudo-random generators and distribution sampling.- reduce
- Reductions: sum / prod / mean / min / max / std / var.
- textio
numpy.savetxt/loadtxt(text format) andtofile/fromfile(raw binary).
Macros§
- dispatch_
numeric - Dispatch that ONLY covers the 14 numeric variants. Non-numeric variants
(
Object,Str, …) take the wildcard arm$other, useful for ops that only make sense on numeric data. - dispatch_
view - “View-style” dispatch — runs
$bodyonce per arm with$abound to a reference to the inner array. Useful for read-only inspection where the element type does not appear in the result.
Structs§
Functions§
- module_
def - Return the
numpymodule definition for embedding into arustpython_vm::Interpreter.