Z< p, T > Class Template Reference

List of all members.

Detailed Description

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

Class used to represent modular numbers. The internal storage is of type T. The computations are performed modulo p. The number p should be a prime number, otherwise inversion and exponentiation may not be valid.

Definition at line 23 of file Zp.h.

Public Member Functions

 Z ()
 Z (int n)
 Z (const char *s)
 Conversion of a string to the cooresponding modular number.
 Z (const Z< p, T > &z)
rep () const
Z< p, T > & operator= (const Z< p, T > z)
Z< p, T > & operator+= (const Z< p, T > z)
Z< p, T > & operator-= (const Z< p, T > z)
Z< p, T > & operator *= (const Z< p, T > z)
Z< p, T > & operator/= (const Z< p, T > &z)
 Division operator, based on Euclid's algorithm.
bool operator== (const Z< p, T > &z) const
bool operator!= (const Z< p, T > &z) const

Friends

Z< p, T > operator- (const Z< p, T > &a)
Z< p, T > operator+ (const Z< p, T > &a, const Z< p, T > &b)
Z< p, T > operator- (const Z< p, T > &a, const Z< p, T > &b)
Z< p, T > operator * (const Z< p, T > &a, const Z< p, T > &b)
Z< p, T > operator/ (const Z< p, T > &a, const Z< p, T > &b)
std::ostream & operator<< (std::ostream &os, const Z< p, T > &z)
std::istream & operator>> (std::istream &is, Z< p, T > &z)


Constructor & Destructor Documentation

template<unsigned int p, class T>
Z< p, T >::Z ( const char *  s  ) 

Conversion of a string to the cooresponding modular number.

Definition at line 70 of file Zp.h.


Member Function Documentation

template<unsigned int p, class T>
Z< p, T > & Z< p, T >::operator/= ( const Z< p, T > &  z  ) 

Division operator, based on Euclid's algorithm.

Definition at line 84 of file Zp.h.

References Z< p, T >::rep_.


The documentation for this class was generated from the following file:

SYNAPS DOCUMENTATION
logo