Effective implementation of algorithms (Master Thesis)
Effective and error-free implementation of algorithms
math::modular_inverse::ModularInverseGcd Class Reference

#include <modular_inverse_gcd.h>

List of all members.

Static Public Member Functions

template<typename T >
static T getInverse (T i, T p)

Detailed Description

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


Member Function Documentation

template<typename T >
static T math::modular_inverse::ModularInverseGcd::getInverse ( i,
p 
) [inline, static]

Compute modular inverse of number i modulo p.

Returns:
inverse of the number i or zero if such number does not exists

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines