Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Changelog

All notable changes to [`nettrash-a`](https://crates.io/crates/nettrash-a) are recorded here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.29](https://crates.io/crates/nettrash-a/0.1.29) - 2026-11-04

The first release. Algorithms in pure Rust with no dependencies, each with a page of its own that gives its method, examples and measurements against the reference implementations.

### Added

- `a::sort`: 23 sorting algorithms and a default sort, each taking a mutable slice.
- By comparison, for any `T: Ord`: bubble, selection, insertion, cocktail shaker, gnome, comb, merge, quick, heap, Tim, intro, Shell, Drift, tree, cycle, bitonic, odd-even and stooge sorts. Bitonic and odd-even sorts also come in parallel forms.
- By integer or float keys, with `_by_key` forms: counting, radix, bucket and pigeonhole sorts, and sleep sort as a joke.
- `sort`, the default: Drift sort, chosen over the other general-purpose sorts by measurement.
- `a::math::numbers::Number`: an integer of any size, stored as its sign and the bytes of its magnitude, in either byte order.
- `+`, `-`, `*`, `/` and `%` with their assignments, with owned or borrowed operands and with primitive integers.
- Products by the schoolbook method, Karatsuba's, Toom-3, Toom-4 and number-theoretic transforms.
- Quotients by Knuth's method with Möller and Granlund's reciprocals, by divide and conquer and by Newton's method; `div_rem`, Euclid's division, a prepared `Divisor`, and exact division.
- Shifts, bitwise operations in two's complement, and bit queries.
- Text in any radix from 2 to 36.
- Roots, factorials and binomials, greatest common divisors and modular inverses, powers and modular powers.
- Primality by Baillie–PSW, the next prime, the Jacobi symbol, and square roots modulo a prime.
- Comparison, hashing, conversions from and to the primitive integers, to floats and from strings, and `Sum` and `Product`.
- Assembly kernels on aarch64 and x86_64, and NEON transforms on aarch64.
- `a::math::ec`: elliptic curves over prime fields of any length, on `Number`.
- Short Weierstrass, Montgomery and twisted Edwards forms.
- Points that add with `+`, subtract with `-` and multiply by a number with `*`.
- Compression, `multi_mul` by Straus's and Pippenger's methods, and prepared points for repeated products.
- Invariants and maps between the forms.
- secp256k1, P-256, P-384, P-521, Curve25519 and Ed25519 ready made, with field kernels of their own.
- `k·P` and `k·G` are faster than OpenSSL 3.6 on its curves, and than curve25519-dalek 4.1 on Ed25519 and X25519.
- `a::math::complex`: `Complex<f32>` and `Complex<f64>`.
- Their arithmetic, with a float of the same type on either side.
- `abs`, `arg`, `exp`, `ln`, `sqrt` and powers, as principal values with C99's branch cuts.
- Division and square roots that neither overflow nor underflow before their results do.
Comment thread
nettrash marked this conversation as resolved.
Resolved
- `a::math::matrix`: `Matrix<T>` of `f32`, `f64`, `Complex<f32>`, `Complex<f64>` or `Number`.
- Arithmetic: `+`, `-` and `*`, by an element, and Hadamard's product. Transposes and conjugate transposes, row and column operations, the trace, and powers.
- LU, QR, Cholesky, singular value, Schur and eigendecompositions.
- Determinants, inverses, solutions of linear systems and least squares, ranks, null spaces, characteristic polynomials, six norms and condition numbers.
- `exp`, `sqrt` and `log`.
- On `Number`: exact determinants, ranks, characteristic polynomials, adjugates, inverses and null spaces.
- In `f64` on one core, at least as fast as faer and nalgebra at every size measured, from 8 × 8 to 1024 × 1024.

### Security

- Nothing in the crate is constant-time: `pow_mod` and the elliptic curves in particular branch on the values of their exponents and scalars. Use them on public data, not on secret keys.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Algorithms in pure Rust, with no dependencies:

- **Sorting** (`a::sort`): 24 sorts by comparison and by key, a default one among them.
- **Sorting** (`a::sort`): 23 sorting algorithms by comparison and by key, and a default sort.
- **Integers of any size** (`a::math::numbers`): `Number`, with its arithmetic up to transforms for the longest products, roots, powers modulo a number, greatest common divisors, primes and text in any radix.
- **Elliptic curves** (`a::math::ec`): Weierstrass, Montgomery and Edwards curves over prime fields, secp256k1, P-256, P-384, P-521, Curve25519 and Ed25519 among them.
- **Complex numbers** (`a::math::complex`) and **matrices** (`a::math::matrix`): decompositions, eigenvalues, singular values and functions of matrices of floats and complex numbers, and exact algorithms on matrices of integers.
Expand All @@ -16,7 +16,14 @@ Every algorithm has a page with its method, examples and measurements against th

## Usage

Add the crate with `cargo add nettrash-a`; its library is named `a`:
Add the crate with `cargo add nettrash-a`, or to `Cargo.toml`:

```toml
[dependencies]
nettrash-a = "0.1"
```

Its library is named `a`:

```rust
use a::math::matrix::Matrix;
Expand Down Expand Up @@ -224,6 +231,10 @@ Apple's Accelerate, which runs its products on the M4's matrix unit, is faster t

Nothing here is written to take the same time whatever its operands: `pow_mod` and the elliptic curves in particular branch on the values of their exponents and scalars. Use them on public data, for verification and research, not on secret keys or scalars.

## Changelog

What each version added, changed and fixed is in [CHANGELOG.md](https://github.com/nettrash/a/blob/HEAD/CHANGELOG.md).

## License

[MIT](https://github.com/nettrash/a/blob/HEAD/LICENSE).
2 changes: 1 addition & 1 deletion lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nettrash-a"
version = "0.0.29"
version = "0.1.29"
edition = "2024"
description = "Algorithms in pure Rust with no dependencies: 23 sorting algorithms and a default sort; arbitrary-precision integers with Karatsuba, Toom-Cook and NTT multiplication, Newton division, GCD, roots, modular powers, primes and modular square roots; elliptic curves over prime fields with secp256k1, P-256, P-384, P-521, Curve25519 and Ed25519; complex numbers; matrices of floats, complex numbers or integers with LU, QR, Cholesky, SVD, Schur and eigendecompositions, exp, sqrt and log, and exact integer determinants and inverses. Not constant-time."
license = "MIT"
Expand Down
Loading