[−][src]Module contest_algorithms::math::num
Rational and Complex numbers, safe modular arithmetic, and linear algebra, implemented minimally for contest use. If you need more features, you might be interested in crates.io/crates/num
Structs
Complex | Represents a complex number using floating-point arithmetic |
Field | Represents an element of the finite (Galois) field of prime order, given by MOD. Until Rust gets const generics, MOD must be hardcoded, but any prime in [1, 2^31.5] will work. If MOD is not prime, ring operations are still valid but recip() and division are not. Note that the latter operations are also the slowest, so precompute any inverses that you intend to use frequently. |
Matrix | |
Rational | Represents a fraction reduced to lowest terms |
Constants
PI | Archimedes' constant (π) |
Functions
fast_gcd | Fast iterative version of Euclid's GCD algorithm |