CGAL 6.2 - Number Types
Loading...
Searching...
No Matches
CGAL::Zp< p, T, IsPrime > Class Template Reference

#include <CGAL/Zp.h>

Definition

template<size_t p, typename T = unsigned int, bool IsPrime = true>
class CGAL::Zp< p, T, IsPrime >

The class Zp implements the concept IntegralDomainWithoutDivision with the ring \(\mathbb Z/p\mathbb Z\) (which is a field when pis prime).

This is a "lightweight" implementation which aims at providing fast operations and constructors.

According to the value of p, users can chose the size of the representation used to store values (default size: int).

Warning
For \(\mathbb Z/2\mathbb Z\), prefer the class Z2 which is optimized.
Is model of
IntegralDomainWithoutDivision
Template Parameters
pa positive integer.
Ta type used for the inner storage of the values (default: int).
IsPrimea bool encoding wether p is a prime number or not.

Public Member Functions

 Zp (T i=0)
 Constructor from a value.
 
 Zp (const Zp &a)
 
bool is_zero () const
 Tests if the element is 0.
 
Zpoperator= (const Zp &a)
 Operator=.
 
Zpoperator+= (const Zp &a)
 Operator+=.
 
Zpoperator-= (const Zp &a)
 Operator-=.
 
Zpoperator*= (const Zp &a)
 Operator*=.
 
Zpoperator/= (const Zp &a)
 Operator/=.
 
bool is_invertible ()
 Returns the invertibility of the element.
 

Static Public Member Functions

static T operator() ()
 Returns the value of p.
 

Friends

Zp operator+ (const Zp &a)
 Unary operator+.
 
Zp operator- (const Zp &a)
 Unary operator-.
 
Zp operator+ (const Zp &a, const Zp &b)
 Operator+.
 
Zp operator- (const Zp &a, const Zp &b)
 Operator-.
 
Zp operator* (const Zp &a, const Zp &b)
 Operator*.
 
Zp operator/ (const Zp &a, const Zp &b)
 Operator/.
 
bool operator== (const Zp &a, const Zp &b)
 Operator==.
 
bool operator!= (const Zp &a, const Zp &b)
 Operator!=.
 
Zp abs (const Zp &a)
 Absolute value.
 
std::ostream & operator<< (std::ostream &out, const Zp &a)
 Operator<<.
 
std::istream & operator>> (std::istream &in, Zp &a)
 Operator>>.