Skip to main content

rustymath

Rustymath provides fast elementary and special functions, statistics, searching and sorting, random sampling, linear algebra, optimization, polynomials and exact arithmetic in Rust and Python. It is the numerical core of BasedPL.

The Python package needs no NumPy. Its eager operations use the same broadcasting, selection and tolerant-comparison rules as the shared Rust core. For richer array notation, operators and fusion, use BasedPL.

Float functions give results within four units in the last place (ulps) of the correctly rounded result, apart from documented exceptions. Rustymath prioritizes speed over last-bit agreement and reproducibility.

Install

pip install rustymath

Rust users can add the crate to Cargo.toml. See Using rustymath from Rust for function objects and native bulk routines, build settings, accuracy and speed.

import rustymath as rm

Arrays and indexing

Functions take Python numbers, nested lists, rustymath arrays or buffer exporters such as NumPy arrays. Broadcasting aligns leading axes. A two-item vector adds one value to each row of this matrix:

rm.add([[1, 2, 3], [4, 5, 6]], [10, 20])
Array([[11, 12, 13], [24, 25, 26]], dtype=int64)

Arrays and indexing covers construction, dtypes, selection, reshaping, axis names, keys and interoperability.

Maths and statistics

Real and complex functions operate on whole arrays. The rustymath.mathish namespace provides J-inspired Mathish conventions. Ordinary comparisons are exact:

rm.exp([0., 1, 2]), rm.equal(0.1 + 0.2, 0.3)
(Array([1.0, 2.7182818, 7.3890561], dtype=float64), False)

Maths and statistics covers elementary and special functions, reductions, scans, statistics and tolerant comparison.

Searching, sorting and selection

unique retains first-occurrence order and reports each value’s position, class number and count:

rm.unique([3, 1, 3, 2])
Unique(values=Array([3, 1, 2], dtype=int64), firsts=Array([0, 1, 3], dtype=int64), numbers=Array([0, 1, 0, 2], dtype=int64), counts=Array([2, 1, 1], dtype=int64))

Searching, sorting and selection distinguishes tolerant matching from exact ordering.

Random numbers and distributions

Distributions provide density, cumulative probability, quantiles and seeded sampling:

normal = rm.distribution.normal()
normal.cdf([-1.96, 0, 1.96]), normal.sample(3, seed=0)
(Array([0.024997895, 0.5, 0.9750021], dtype=float64),
 Array([0.11623959, -0.78285485, -2.3346353], dtype=float64))

Random numbers and distributions covers sampling and probability functions.

Linear algebra

Solve real or complex systems, including least-norm solutions for singular or non-square matrices:

rm.linalg.solve([[4., 1], [1, 3]], [1., 2])
Array([0.090909091, 0.63636364], dtype=float64)

Linear algebra covers matrix products, reusable factorizations, decompositions and least squares.

Optimization and iterative solves

Minimize functions, fit residuals or find roots. Here Brent’s method finds where cos x = x:

rm.optimize.root_scalar(lambda x: rm.cos(x) - x, [0, 1]).root
0.7390851350713886

Optimization and iterative solves also covers matrix-free linear systems.

Polynomials, exact arithmetic and number theory

Polynomial coefficients start from the constant term. Factorization accepts Python integers of any size:

rm.polynomial.polyroots([-6, 11, -6, 1]), rm.number_theory.factor(2**64 + 1)
(Array([(1+0j), (2-0j), (3+0j)], dtype=complex128),
 [(274177, 1), (67280421310721, 1)])

Polynomials, exact arithmetic and number theory includes rational matrix solves and calculations with fractions.Fraction.

Accuracy and speed

The Rust page’s Accuracy and speed section compares each function’s speed with Rust’s standard library. It also explains how the 4-ulp bound holds for f16, with and without fused multiply-add, and for pow and root.

Licence

Apache-2.0. Some algorithms and constants come from SLEEF and Arm Optimized Routines. THIRD-PARTY.md has their notices.

Metadata

Release files for rustymath 0.1.61

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rustymath 0.1.61
File Size Uploaded Provenance Actions
rustymath-0.1.61.tar.gz 2.6 MB With provenance Details for rustymath-0.1.61.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rustymath 0.1.61
File Actions
rustymath-0.1.61-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details for rustymath-0.1.61-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
rustymath-0.1.61-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details for rustymath-0.1.61-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
rustymath-0.1.61-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details for rustymath-0.1.61-cp313-cp313-macosx_15_0_arm64.whl
rustymath-0.1.61-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for rustymath-0.1.61-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
rustymath-0.1.61-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details for rustymath-0.1.61-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
rustymath-0.1.61-cp312-cp312-macosx_15_0_arm64.whl CPython 3.12 CPython 3.12 macOS 15.0+ ARM64 Details for rustymath-0.1.61-cp312-cp312-macosx_15_0_arm64.whl
rustymath-0.1.61-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for rustymath-0.1.61-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
rustymath-0.1.61-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details for rustymath-0.1.61-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
rustymath-0.1.61-cp311-cp311-macosx_15_0_arm64.whl CPython 3.11 CPython 3.11 macOS 15.0+ ARM64 Details for rustymath-0.1.61-cp311-cp311-macosx_15_0_arm64.whl

Total release size: 65.2 MB

Release files / rustymath-0.1.61.tar.gz

Download URL rustymath-0.1.61.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
ce7ebfbdaea27276d622213b5f731cbf6c4be0ba2ae63b60f71cfa14b24c2f19
BLAKE2b-256 checksum
How to use checksums
7780fe122531fbf051555a4da22e457c548558c6d8473e76397c1f7fee378cbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / rustymath-0.1.61-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL rustymath-0.1.61-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.3 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
0b1a66f0bebbab840ec7a44fc8f6be005b7f057fba9de9d57ac8a5eb70d999d4
BLAKE2b-256 checksum
How to use checksums
378ba96069ab112e8ae5f3ec11dba9dafd0af2ddb0b76289d7a7cdb3ff985b9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / rustymath-0.1.61-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL rustymath-0.1.61-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 6.3 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
a3f309c2ff69af2c63f08df5afebb55c81b1bdcb3d0ac36f4831cfb09f270b23
BLAKE2b-256 checksum
How to use checksums
a75a22f22d65a5a562cdef52add3b4c7023aed8c80764ba55b61026c8de65fde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / rustymath-0.1.61-cp313-cp313-macosx_15_0_arm64.whl

Download URL rustymath-0.1.61-cp313-cp313-macosx_15_0_arm64.whl
Size 6.2 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
9219222b784ad6af8d1fb2a5906d9b26be7a2b62fc2b764ac3d844008e350c13
BLAKE2b-256 checksum
How to use checksums
7edc703f54b4a155d80625899ffa9de7ed5b9d2947a22b9d1d513f158222a8a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / rustymath-0.1.61-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL rustymath-0.1.61-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.3 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
075988ccd5d255b6a8675732bfafc4c4b7b22c7c4a01e26d71739cd14778167b
BLAKE2b-256 checksum
How to use checksums
65046c1cc45466a347bc77a12144e7460974fac2c437272dc58de7951cf41e79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / rustymath-0.1.61-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL rustymath-0.1.61-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 6.3 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
86c44a118a98a00be5eab0d6ce05d0df27d26bbdfcf0a92b19efb8309af1f833
BLAKE2b-256 checksum
How to use checksums
e3425b338100957d61ba071972ae6c11624e6af204277ac1383377203f006c9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / rustymath-0.1.61-cp312-cp312-macosx_15_0_arm64.whl

Download URL rustymath-0.1.61-cp312-cp312-macosx_15_0_arm64.whl
Size 6.2 MB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
2a54ef8eb85afbaf75de5a91e2ff3bf3790b0c267794c40db17c1e3a43407c2f
BLAKE2b-256 checksum
How to use checksums
08a61758b191755802ceae9b73da79983f7520f56f2c6627895333cf879d226f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / rustymath-0.1.61-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL rustymath-0.1.61-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.3 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
4f9e7ae5bd3c77f9864de3d62969bb25d84626d354835d6dba29dd93e12c3f02
BLAKE2b-256 checksum
How to use checksums
36a5b6d10268f306138319b93f94274231957eeb81b4d714cfcf16e80b216312
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / rustymath-0.1.61-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL rustymath-0.1.61-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 6.4 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
6a04bb17b3c3ac71039d0be21fabf5b2b08b4db8f50e5893c3742fa1fc33a2f4
BLAKE2b-256 checksum
How to use checksums
afff00405adc1b726b5eba5621e868f00bd4ef34c6c5738f90d6192462a27b09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / rustymath-0.1.61-cp311-cp311-macosx_15_0_arm64.whl

Download URL rustymath-0.1.61-cp311-cp311-macosx_15_0_arm64.whl
Size 6.2 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
3b07cb3c320a026ba91addccc4f421002e75b2ffd1a01982a757635534536778
BLAKE2b-256 checksum
How to use checksums
22200da8c78e72795e89c49732062dc6aebf94f931e0251938cc8c519906c896
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for rustymath 0.1.61

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 10 files in this release have been uploaded with provenance metadata.

Select from 10 files

Attestation for rustymath-0.1.61.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.61 This release

10 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page