Skip to content

v0.15.0

Latest

Choose a tag to compare

@mhogrefe mhogrefe released this 23 Nov 04:43
· 34 commits to master since this release

This release adds matrices, a big batch of new Float functions, and a new floating-point type, BigExponentFloat. Malachite is also now checked against Azurite, a formally verified Lean library, for almost three times as many functions as before.

Matrices

Malachite now has matrices: UnsignedMatrix<T> in malachite-base, NaturalMatrix and IntegerMatrix in malachite-nz, and RationalMatrix in malachite-q. They come with:

  • Arithmetic: addition, subtraction, negation, scalar, matrix-vector and matrix products, powers, Kronecker products, traces and exact division. Each has versions modulo $m$ and modulo $2^k$.
  • Linear algebra:
    • determinants (including fast sign computation), rank, nullspaces, linear solving, inverses and LU decompositions
    • characteristic polynomials and permanents
    • reduced row echelon, Hermite and Smith normal forms
    • Howell and strong echelon forms modulo $m$ and $2^k$
  • Multimodular tools: CRT reconstruction, and rational reconstruction for RationalMatrix.
  • Supporting features: row and column access and iterators, Display/FromStr/ToLatex, conversions between all the matrix types, and exhaustive and random generators.

Vectors gained cross products (including generalized ones), entrywise products and inverses, fused dot products, and Euclidean norms.

New Float functions

All are correctly rounded in every rounding mode, with Rational-input forms:

  • the Lambert $W$ function on both real branches, $W_0$ and $W_{-1}$
  • the tree function $T(x) = -W(-x)$, the exponential generating function of rooted labeled trees (not the extremely fast-growing one)
  • the Wright omega function $\omega$
  • the Gudermannian function and its inverse
  • the gamma function $\Gamma$ and its reciprocal $1/\Gamma$
  • $\ln\,\Gamma$ and $\ln\lvert\Gamma\rvert$

Several of these are ports of formally verified algorithms from Azurite.

With the std feature, π, ln 2 and the values used by the gamma functions are cached per thread.

Several existing functions are now much faster on extreme inputs, with unchanged results:

  • exp_x_minus_1, power_of_2_x_minus_1 and power_of_10_x_minus_1 on tiny Rationals
  • sin, tan and sin_cos on tiny inputs
  • logarithms to a base that is a power of 2

BigExponentFloat

BigExponentFloat is a new floating-point type modeled on FLINT's arf_t.

  • Its exponent is an Integer, so it never overflows or underflows.
  • It stores no precision: its significand is exactly as long as the value needs.
  • Plain arithmetic (+, -, *, shifts) is exact. Every rounded operation takes a target precision and a RoundingMode.
  • It supports the same transcendental functions as Float, plus comparisons, conversions, string I/O in every base, serde support, and generators.

Verified against Azurite

The test suite now checks Malachite against Azurite's oracles in 773 modes, up from 264 in 0.14.0. These include 240 Float modes (up from 42) and 233 new BigExponentFloat modes. Five new mapping pages cover vectors: azurite-*-vectors*.md in docs/mapping.

Also new

  • Polynomials:
    • composition and Taylor shifts
    • pseudo-division, checked and exact division, middle products and truncated series inverses and division
    • division for RationalPolynomial
    • Bernoulli and Euler polynomials
  • Number theory:
    • Bernoulli and Euler numbers
    • tangent numbers
    • factorial-number-system (factoradic) digits
    • Rational digit expansions that mark which digits repeat
    • ShrRoundWithOrdering for Natural and Integer
  • Lambert $W$, tree and Wright omega traits for primitive floats.

Breaking changes

  • Rust 1.100 or later is required, for the never type !, which replaces malachite_base::nevers::Never.
  • Trait modules are reorganized. The traits of num::arithmetic::traits are split into modules by topic (modular, number_theory, exponential, elliptic, trigonometric, hyperbolic, linear_algebra), and the polynomial traits likewise. The old paths still work in this release but will be removed in the next one.
  • Unused optional dependencies are removed: getrandom, indoc and time, along with their implicit features.

The full list is in CHANGELOG.md.