RMath

Installation Guide

RMath is distributed as a pre-compiled Python wheel containing the Rust binary. No Rust toolchain is required for standard installation — just pip and Python 3.9+.

Quick Install

terminal
pip install rmath-py

Requirements

RequirementVersionNotes
Python3.9 – 3.13CPython only (no PyPy)
PlatformWindows, Linux, macOSx86_64 and arm64 wheels available
pip21.0+For wheel installation
NumPy (optional)1.21+Required only for .to_numpy() / .from_numpy()

Verify Your Installation

After installing, run the following to confirm everything is working:

verify_install.py
import rmath as rm
import rmath.vector as rv
import rmath.array as ra

v = rv.Vector([1.0, 2.0, 3.0])
print("sum:", v.sum())    # 6.0
print("mean:", v.mean())  # 2.0

a = ra.Array([[1.0, 2.0], [3.0, 4.0]])
print("array mean:", a.mean())  # 2.5

print("rmath OK ✓")
sum: 6.0 mean: 2.0 array mean: 2.5 rmath OK ✓

Building from Source

If you want the latest unreleased changes or need to modify the Rust core, build from the GitHub repository. You will need the Rust toolchain.

terminal
# 1. Install Rust (https://rustup.rs)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# 2. Clone the repository
git clone https://github.com/Ay-developerweb/rmath
cd rmath

# 3. Install maturin (PyO3 build tool)
pip install maturin

# 4. Build and install in development mode
maturin develop --release
Always use --release when building from source. Rust debug builds disable all compiler optimisations — numerical kernels will run 10–100× slower than the production wheel.

Available Submodules

After installation, the following submodules are importable:

submodule_check.py
import rmath           # rm.Array, rm.Vector, rm.Tensor, rm.Scalar, rm.Dual
import rmath.array     # Array, LazyArray
import rmath.vector    # Vector, ComplexVector
import rmath.stats     # descriptive + inferential statistics
import rmath.linalg    # LU, QR, Cholesky, SVD, eigh
import rmath.calculus  # Dual numbers, integration, root-finding
import rmath.geometry  # 3D transforms, cosine similarity
import rmath.signal    # FFT, convolution
import rmath.nn        # activations, loss, normalization
import rmath.special   # gamma, beta, error functions
import rmath.constants # mathematical and physical constants
print("All imports: OK")
All imports: OK