Modular Numbers

This class implements the arithmetic of modular integers. The class

template<unsigned int p, class T=int> class Z;

depends on two parameters. The first one p is the moduli, the second one T is the type used to represent the modular numbers. By default, the internal representation is int.

Example

typedef Z<31> F31;
F31 a("232343"), b(8);  // a = 29;
F31 m = a*b;            // m = 15;
F31 d = a/28;           // d = 11;  use Euclide algorithm.  

Implementation

See also:
synaps/arithm/Zp.h

SYNAPS DOCUMENTATION
logo