Expand description
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
- Matrix
- Modulo
- Represents an element of the finite (Galois) field of prime order M, where 1 <= M < 2^31.5. If M 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.
- Rational
- Represents a fraction reduced to lowest terms
Constants§
- COMMON_
PRIME - Prime modulus that’s commonly used in programming competitions
- PI
- Archimedes’ constant (π)
Functions§
- fast_
gcd - Fast iterative version of Euclid’s GCD algorithm