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.63

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

Built distributions (wheels)

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

Total release size: 65.6 MB

Release files / rustymath-0.1.63.tar.gz

Download URL rustymath-0.1.63.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
9a9996d1317f9f9e034ae8ceaa172aac80a787f015a49a4f474fc05ff9fcd549
BLAKE2b-256 checksum
How to use checksums
a091fc829355b824ae255efa4209c803b1fc819b74efcdc54c25762dc8164771
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 18, 2026.

Transparency log

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

Download URL rustymath-0.1.63-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
dd22ca0928b25ba719768d41802271c0b8ff6c664dc683e3510597b92ca4d688
BLAKE2b-256 checksum
How to use checksums
a600c4d3705b15312d21d35bc44e89ed765fba7ef598e8f96c71dd42678ec029
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 18, 2026.

Transparency log

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

Download URL rustymath-0.1.63-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
27919c88117649fe4311080d1e2eb75cf169bb5b7659295024748d3c612496df
BLAKE2b-256 checksum
How to use checksums
cf298fdc87c87910d6b8bf6b2568a70106152c010f01370bd7064d7afcd68cff
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 18, 2026.

Transparency log

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

Download URL rustymath-0.1.63-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
46c2324c29ac635d28217a82da17447ee756fc78d9b3e9c94c48d158fde17626
BLAKE2b-256 checksum
How to use checksums
b64065694f1f7f37b995b8231231737efdf76de071cdd013a8f1668beb5d9a11
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 18, 2026.

Transparency log

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

Download URL rustymath-0.1.63-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
9ab8e3b246d963760d966f7e50687ff7c8ed0577c8892c77c481b04a68bc67fd
BLAKE2b-256 checksum
How to use checksums
61daaf1d40166855122e6a7fbf715ff85ccd0e4abb0b171d2a93860c9e920da4
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 18, 2026.

Transparency log

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

Download URL rustymath-0.1.63-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
2e3df9348fc2e2484a0a56ca9fd6d1e15b8173fd22b2ad844d0e8e51008d6bab
BLAKE2b-256 checksum
How to use checksums
f0ed6e91ce6f80a7fb0d3d63d648ce6ddc3cf3df25fd8a8c3e8f9e6d8066244f
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 18, 2026.

Transparency log

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

Download URL rustymath-0.1.63-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
f2fa48c62c64941c22fbd8f5ce3d8209c83469de9ad239f66f2105a92d00c60b
BLAKE2b-256 checksum
How to use checksums
dabe2f068d104c0388accd4df89e2b29c1a40b2824acc5b1e30d5fc6221b7d66
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 18, 2026.

Transparency log

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

Download URL rustymath-0.1.63-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
d1a1f9299036b2a60e7c4ab946ab662f3f6ac67031f69bdf645047c055de0365
BLAKE2b-256 checksum
How to use checksums
0dd35f680dbea7cea408ec9351a974b132351f7d6a307c04c8e0eca5c445928f
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 18, 2026.

Transparency log

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

Download URL rustymath-0.1.63-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
98ab079143d46b77b2f4702ea61e2b4a8defa2dfb33d174f967d5b3926b69631
BLAKE2b-256 checksum
How to use checksums
9a2bcc674d94a4e3eb1d5f81ab8c2f4e39f2452f3d3b49f7ef06af0a6cf8cad4
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 18, 2026.

Transparency log

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

Download URL rustymath-0.1.63-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
0532d15797975fdb473e06185544c2c9948f91a5c7feec30b01a9d721f388e4f
BLAKE2b-256 checksum
How to use checksums
2fc62fdea29f1daf6115df62cb2911af2e0bd249c1afdd29aa5cce8d853bdc51
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 18, 2026.

Transparency log

Security for rustymath 0.1.63

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.63.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 18, 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.63 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