#algebra #numeric

rug-maths

rug wrapper implementing maths-traits

7 releases

0.2.5 Mar 26, 2021
0.2.4 Feb 5, 2021
0.2.3 May 2, 2020
0.2.2 Apr 4, 2020
0.1.0 Jan 18, 2020

#606 in Math

AGPL-3.0

40KB
1.5K SLoC

rug-maths

A wrapper for the rug structs, implementing maths-traits traits. It enables computing with arbitrary precision, with algebra & analysis traits.

Example

let z = Complex::with_val(53, (123, 369)); // 123 + 369i
let a = z.real(); // 123
let b = z.imag(); // 369

let n = Integer::from(101);
assert!(n.prime()); // Check primality
assert!(!(n+1).prime());

let a = Integer::from(27);
let b = Integer::from(72);
assert_eq!(a.clone().gcd(b.clone()), Integer::from(9)); // Compute GCD
assert_eq!(a.lcm(b), Integer::from(216)); // Compute LCM

Dependencies

~3MB
~51K SLoC