linbox
Public Member Functions | Static Public Member Functions
PIR_ntl_ZZ_p Class Reference

extend Wrapper of ZZ_p from NTL. More...

#include <pir-ntl-zz_p.h>

+ Inheritance diagram for PIR_ntl_ZZ_p:
+ Collaboration diagram for PIR_ntl_ZZ_p:

Public Member Functions

template<class Element2 >
Element & init (Element &x, const Element2 &y) const
 Init x from y.
 
Element & init (Element &x, const Element &y) const
 Init from a NTL::ZZ_p.
 
Element & init (Element &x, const integer &y) const
 I don't know how to init from integer.
 
integerconvert (integer &x, const Element &y) const
 Convert y to an Element.
 
Element & assign (Element &x, const Element &y) const
 x = y.
 
bool areEqual (const Element &x, const Element &y) const
 Test if x == y.
 
bool isZero (const Element &x) const
 Test if x == 0.
 
bool isOne (const Element &x) const
 Test if x == 1.
 
Element & add (Element &x, const Element &y, const Element &z) const
 return x = y + z
 
Element & sub (Element &x, const Element &y, const Element &z) const
 return x = y - z
 
template<class Int >
Element & mul (Element &x, const Element &y, const Int &z) const
 return x = y * z
 
Element & div (Element &x, const Element &y, const Element &z) const
 If exists a, such that a * z =y, return x = one of them. More...
 
Element & inv (Element &x, const Element &y) const
 If y is a unit, return x = 1 / y, otherwsie, throw an exception.
 
Element & neg (Element &x, const Element &y) const
 return x = -y;
 
template<class Int >
const Element & axpy (Element &r, const Element &a, const Int &x, const Element &y) const
 return r = a x + y
 
Element & addin (Element &x, const Element &y) const
 return x += y;
 
Element & subin (Element &x, const Element &y) const
 return x -= y;
 
template<class Int >
Element & mulin (Element &x, const Int &y) const
 return x *= y;
 
const Element & divin (Element &x, const Element &y) const
 If y divides x, return x /= y, otherwise throw an exception.
 
Element & invin (Element &x) const
 If x is a unit, x = 1 / x, otherwise, throw an exception.
 
Element & negin (Element &x) const
 return x = -x;
 
template<class Int >
Element & axpyin (Element &r, const Element &a, const Int &x) const
 return r += a x
 
std::ostream & write (std::ostream &out, const Element &y) const
 out << y;
 
bool isUnit (const Element &x) const
 some PIR function More...
 
NTL_ZZ_p

Arbitrary precision integers modulus a positive integer.

While NTL allows any integer to serve as the modulus, only prime moduli yield fields. Therefore, while arthmetic operations may be valid for any modulus, only prime moduli are supported in this implementation. The primality of the modulus will not be checked, so it is the programmer's responsibility to supply a prime modulus. These specializations allow the Givaro::ZRing template class to be used to wrap NTL's ZZ_p class as a LinBox field.

Element & init (Element &x, const double &y) const
 
Element & init (Element &x, const NTL::ZZ &y) const
 Specialization for NTL::ZZ. More...
 
Element & init (Element &x) const
 
template<class ANY >
Element & init (Element &x, const ANY &y) const
 
NTL::ZZ & convert (NTL::ZZ &x, const Element &y) const
 Specialization for NTL::ZZ. More...
 
double & convert (double &x, const Element &y) const
 
template<class ANY >
ANY & convert (ANY &x, const Element &y) const
 
Element & pow (Element &res, const Element &x, long exp) const
 
Element & powin (Element &x, long exp) const
 
integer cardinality () const
 
size_t & characteristic (size_t &c) const
 
integer characteristic () const
 

Static Public Member Functions

static Element & gcd (Element &g, const Element &a, const Element &b)
 return g = gcd (a, b)
 
static Element & gcdin (Element &g, const Element &b)
 return g = gcd (g, b)
 
static Element & xgcd (Element &g, Element &s, Element &t, const Element &a, const Element &b)
 g = gcd(a, b) = a*s + b*t. More...
 
static Element & dxgcd (Element &g, Element &s, Element &t, Element &a1, Element &b1, const Element &a, const Element &b)
 g = gcd(a, b) = a*s + b*t. More...
 
static bool isDivisor (const Element &a, const Element &b)
 Test if a | b.
 
static Element & normal (Element &a, const Element &b)
 a = normalization of b.
 

Detailed Description

extend Wrapper of ZZ_p from NTL.

Add PIR functions

Examples
examples/smith.C.

Member Function Documentation

◆ div()

Element& div ( Element &  x,
const Element &  y,
const Element &  z 
) const
inline

If exists a, such that a * z =y, return x = one of them.

Otherwise, throw an exception

◆ isUnit()

bool isUnit ( const Element &  x) const
inline

some PIR function

Test if x is a unit.

◆ xgcd()

static Element& xgcd ( Element &  g,
Element &  s,
Element &  t,
const Element &  a,
const Element &  b 
)
inlinestatic

g = gcd(a, b) = a*s + b*t.

and gcd (s, t) is a unit.

◆ dxgcd()

static Element& dxgcd ( Element &  g,
Element &  s,
Element &  t,
Element &  a1,
Element &  b1,
const Element &  a,
const Element &  b 
)
inlinestatic

g = gcd(a, b) = a*s + b*t.

and gcd (s, t) is a unit. s * a1 + t * b1 = a unit.

◆ init() [1/4]

Element& init ( Element &  x,
const double &  y 
) const
inlineinherited
Parameters
q,e

◆ init() [2/4]

Element& init ( Element &  x,
const NTL::ZZ &  y 
) const
inlineinherited

Specialization for NTL::ZZ.

Returns
reference to field element.
Parameters
xfield element to contain output (reference returned)
yNTL::ZZ.

◆ init() [3/4]

Element& init ( Element &  x) const
inlineinherited
Parameters
q,e

◆ init() [4/4]

Element& init ( Element &  x,
const ANY &  y 
) const
inlineinherited
Parameters
q,e

◆ convert() [1/3]

NTL::ZZ& convert ( NTL::ZZ &  x,
const Element &  y 
) const
inlineinherited

Specialization for NTL::ZZ.

Returns
reference to NTL::ZZ
Parameters
xNTL::ZZ to contain output (reference returned).
yconstant reference to field element.

◆ convert() [2/3]

double& convert ( double &  x,
const Element &  y 
) const
inlineinherited
Parameters
q,e

◆ convert() [3/3]

ANY& convert ( ANY &  x,
const Element &  y 
) const
inlineinherited
Parameters
q,e

◆ pow()

Element& pow ( Element &  res,
const Element &  x,
long  exp 
) const
inlineinherited
Parameters
q,e

◆ powin()

Element& powin ( Element &  x,
long  exp 
) const
inlineinherited
Parameters
q,e

◆ cardinality()

integer cardinality ( ) const
inlineinherited
Parameters
q,e

◆ characteristic() [1/2]

size_t& characteristic ( size_t &  c) const
inlineinherited
Parameters
q,e

◆ characteristic() [2/2]

integer characteristic ( ) const
inlineinherited
Parameters
q,e

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