Effective implementation of algorithms (Master Thesis)
Effective and error-free implementation of algorithms
|
#include <modular_inverse_gcd.h>
Static Public Member Functions | |
template<typename T > | |
static T | getInverse (T i, T p) |
Computes modular inverse of number over any (even non-prime) modulus.
The implementation is O(1) for initialization (no initialization) and O(log n) for query, but the queries are generally fast.
If you need to precompute modular inverses over all elements of field Z_p where p is prime, then you may use ModularInverse
static T math::modular_inverse::ModularInverseGcd::getInverse | ( | T | i, |
T | p | ||
) | [inline, static] |
Compute modular inverse of number i modulo p.