19 releases

0.1.13 Oct 1, 2024
0.1.12 Feb 11, 2024
0.1.11 Jan 1, 2023
0.1.10 Jan 4, 2022
0.1.0 Jul 31, 2021

#340 in Algorithms


Used in 3 crates

GPL-3.0-only

675KB
15K SLoC

crate documentation build status codecov

RELP-num

Number types for the Relp crate, most notably arbitrary precision rationals.

Usage

Add this to your Cargo.toml:

[dependencies]
relp-num = "0.1.13"

You can now use the crate, for example to compute 2 + 2:

fn main() {
    println!("{}", relp_num::RB!(2) + relp_num::R64!(2));
}

The first number is represented in arbitrary precision (type RationalBig), the second one smaller (type Rational64) with 64 bits of precision for both the numerator and denominator.

Purpose

The RELP crate computes with rational numbers that have specific properties. They need to be arbitrary precision, but are often small. Performance is critical and as such these specific properties should be exploited. This crate does exactly that.

Specific linear programs that one wishes to solve with RELP might have specific properties. RELP allows the user to specialize default implementations in order to exploit these. This numerics crate contains default implementations of number types for this usecase.

What this crate is not

There are already some great general purpose numerics libraries out there, such as

  • num (broad range of functionality)
  • ramp (arbitrary precision, fast, requires nightly)

This crate is not trying to be one of them and exists to support RELP only.

Dependencies

~170–550KB
~12K SLoC