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. Here rm.add adds the vector’s first item to the matrix’s first row and its second item to the second row:

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 keeps the order in which values first occur. It also gives each value’s first position (firsts) and count (counts), and for each item the position of its value in values (numbers):

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 parameters by least squares 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 the version in 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.62

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.62
File Size Uploaded Provenance Actions
rustymath-0.1.62.tar.gz 2.6 MB With provenance Details for rustymath-0.1.62.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rustymath 0.1.62
File Actions
rustymath-0.1.62-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.62-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
rustymath-0.1.62-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.62-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
rustymath-0.1.62-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details for rustymath-0.1.62-cp313-cp313-macosx_15_0_arm64.whl
rustymath-0.1.62-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.62-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
rustymath-0.1.62-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.62-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
rustymath-0.1.62-cp312-cp312-macosx_15_0_arm64.whl CPython 3.12 CPython 3.12 macOS 15.0+ ARM64 Details for rustymath-0.1.62-cp312-cp312-macosx_15_0_arm64.whl
rustymath-0.1.62-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.62-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
rustymath-0.1.62-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.62-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
rustymath-0.1.62-cp311-cp311-macosx_15_0_arm64.whl CPython 3.11 CPython 3.11 macOS 15.0+ ARM64 Details for rustymath-0.1.62-cp311-cp311-macosx_15_0_arm64.whl

Total release size: 65.6 MB

Release files / rustymath-0.1.62.tar.gz

Download URL rustymath-0.1.62.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
adb8b59c415712072da9e3d5be48e0e709fd813a18724c0e6265f09ce6ab85ec
BLAKE2b-256 checksum
How to use checksums
ece846c417acf10156f3eec30ec818ee84ed3c0e4bdab7a9aa6e479e6a7e88d0
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 15, 2026.

Transparency log

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

Download URL rustymath-0.1.62-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.4 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
74d19ddc17fe5d65a400c55f9f8358ba504b702445b3225d1068717fa99c0f98
BLAKE2b-256 checksum
How to use checksums
22bb03c7f140b820399fb77a5843f25fb4e36cd54c77d7e6f828611f5f6438ef
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 15, 2026.

Transparency log

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

Download URL rustymath-0.1.62-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 6.4 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
fbfce844c56f3456c838c25fd440ed287797822afa7494936ece2102ca88caa3
BLAKE2b-256 checksum
How to use checksums
8330b37bd655e677e6916187d1d369202aa2bb5e07bdccf7c4b1e6dc34759d85
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 15, 2026.

Transparency log

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

Download URL rustymath-0.1.62-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
cbe304a0f2d0655343eda970f598340d8d0955eb20ef3ee7a7a8a0e0565a2225
BLAKE2b-256 checksum
How to use checksums
f720bb67a44e0787ee2e770464ef3c4d0b9803f579a9684c50bd2aa6e3200a06
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 15, 2026.

Transparency log

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

Download URL rustymath-0.1.62-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.4 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c0d3f2776f976b36c77bc06c0e7ccdcf9964a49401b5aab60b8fcb6a6752ed56
BLAKE2b-256 checksum
How to use checksums
e537e8b5dabcc646eb38dcfae77b987a3a0951658aae83c0b8e66c2385f51973
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 15, 2026.

Transparency log

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

Download URL rustymath-0.1.62-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 6.4 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
a3ff4343b0f647ac93441fc5d51bf856fdf0cf37c7a85bb96dbe2d7e1ae6e630
BLAKE2b-256 checksum
How to use checksums
5e947d45b29e9426c418d455b7dbf1a7c8b0298f727ec02c5f333b49c98eab12
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 15, 2026.

Transparency log

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

Download URL rustymath-0.1.62-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
9f32d7358b0fc39b2990d120dab0de67d7e209add7c8ecf6c6a0833675c5d41c
BLAKE2b-256 checksum
How to use checksums
27e9996b8084b48df1f0b978364a7c6440a4edbbad3090520f431a92b731238c
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 15, 2026.

Transparency log

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

Download URL rustymath-0.1.62-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.4 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3c06c61d33dbb0b9d4c607256c695da2dd68546e9c6eb734317b36b9029838f5
BLAKE2b-256 checksum
How to use checksums
4d8986abfd69cc0a8a7b0b3f32aa84b8f16e5c2286415391324b776d61274290
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 15, 2026.

Transparency log

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

Download URL rustymath-0.1.62-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
6139f000f9d2315a9009cab5bfda6d3a6150b4bdbe2ace882c36ae7d6c58ba7c
BLAKE2b-256 checksum
How to use checksums
090ab5f6ea22ce0d891caad92a579329205f04361f9982e7b3d18cf00e41b6ce
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 15, 2026.

Transparency log

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

Download URL rustymath-0.1.62-cp311-cp311-macosx_15_0_arm64.whl
Size 6.3 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
e3a4b80a4f807fb7543ef9082f2869542d962afc582de91f84ce597e65f62edd
BLAKE2b-256 checksum
How to use checksums
5504573f48748e765fc5b0d6eee68050e8275ed61c041f51dee94934cf3ebe9a
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 15, 2026.

Transparency log

Security for rustymath 0.1.62

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.62.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 15, 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.62 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