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 target four units in the last place (ulps), with 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 scalar and slice forms, 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.53

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.53
File Size Uploaded Provenance Actions
rustymath-0.1.53.tar.gz 2.4 MB With provenance Details for rustymath-0.1.53.tar.gz

Built distributions (wheels)

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

Total release size: 50.0 MB

Release files / rustymath-0.1.53.tar.gz

Download URL rustymath-0.1.53.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
963b3af45cef40d6ecc4343f18acc14fd978ea8e3bdff97a4b2c700311955424
BLAKE2b-256 checksum
How to use checksums
3598945ed21f37564f60a60f36a08b550cc6d4f8695eb0db937eb3b633fec69c
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 Oct 28, 2026.

Transparency log

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

Download URL rustymath-0.1.53-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.5 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9ef4908af07563c5aad0bf219928e335530d4a378c5ecceb8ce0cbf657e30361
BLAKE2b-256 checksum
How to use checksums
d799edfbc2999d84331bb57e7f3554afae853b2f8f45d6c5b43da20ca43c471b
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 Oct 28, 2026.

Transparency log

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

Download URL rustymath-0.1.53-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 4.7 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
01b55306170589a0ef89d60423b3166e17b2e5ae3278f328872ddc331b88292f
BLAKE2b-256 checksum
How to use checksums
1c0e65b5156cdedb1a4f431a988b79da9a71083c2d2fc43920acc8cb4f15eae1
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 Oct 28, 2026.

Transparency log

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

Download URL rustymath-0.1.53-cp313-cp313-macosx_15_0_arm64.whl
Size 4.7 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
014c4f89224a5e748e40be461ce1742f6af3458ee02df31b5da1e6b4a07e378f
BLAKE2b-256 checksum
How to use checksums
764a672e96e0c15ead1f41c51e2a8caab55e49bfffbc2796c62546adce715f08
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 Oct 28, 2026.

Transparency log

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

Download URL rustymath-0.1.53-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.5 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b91fe20b345b79fca1918d169ffddbe01c839194b74a05a0a8e98bc3bbf77479
BLAKE2b-256 checksum
How to use checksums
74f7c85cbd885056573f72a1033033c1c8c95d3af6a9d9335992f3572262c287
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 Oct 28, 2026.

Transparency log

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

Download URL rustymath-0.1.53-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 4.7 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
fb2d8a4716b9dbf9d3f8e2f4462735474cb2acabd30894b26c6ece3dfd3d409e
BLAKE2b-256 checksum
How to use checksums
7f2bb93990a0b31efac2a5a9ff5987a2cd251fd40c5aa32a58e6ccf70c4f2bc1
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 Oct 28, 2026.

Transparency log

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

Download URL rustymath-0.1.53-cp312-cp312-macosx_15_0_arm64.whl
Size 4.7 MB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
7da078629349abc2b0e28e038d2c3635aebe15a04c23718f8d76d6b255d8d7a5
BLAKE2b-256 checksum
How to use checksums
6168e1f11f242e73fcc85d01d3322a1c33ad18a9a9b44a400cf6d14bdef6d571
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 Oct 28, 2026.

Transparency log

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

Download URL rustymath-0.1.53-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.5 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c42a4b6a92909e2bf340fbfeb09f468d4126ea24d6de97670319122790fd2b71
BLAKE2b-256 checksum
How to use checksums
2b74425d5cc34ab58c3329e8017b9a698a6e6692568bc11525bd8fd3712d4947
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 Oct 28, 2026.

Transparency log

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

Download URL rustymath-0.1.53-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 4.7 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
ffe7a0a62414c6cef04b61dd4adfedb34ede55e694f09f91149190dc0fa97633
BLAKE2b-256 checksum
How to use checksums
86dbb8ccad22477c00e1d90a70c4aa0c95d6066cb8caf997dd474444959a8339
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 Oct 28, 2026.

Transparency log

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

Download URL rustymath-0.1.53-cp311-cp311-macosx_15_0_arm64.whl
Size 4.7 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
06ed8b3456a40cbe044c58651215af71bcc37f48f1a084d808b81e9a0d5124f6
BLAKE2b-256 checksum
How to use checksums
4a07ae2dedb764a5fb6b427d6b7302c56a94a579a69ba449fff10cf86e1ee92d
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 Oct 28, 2026.

Transparency log

Security for rustymath 0.1.53

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.53.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 Oct 28, 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.53 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