linbox
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:

Public Member Functions

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 UnparametricField template class to be used to wrap NTL's ZZ_p class as a LinBox field.

Element & init (Element &x, const integer &y) const
 Specialization for NTL::ZZ.
Element & init (Element &x, const double &y) const
 Specialization for NTL::ZZ.
Element & init (Element &x, const NTL::ZZ &y) const
 Specialization for NTL::ZZ.
Element & init (Element &x) const
 Specialization for NTL::ZZ.
template<class ANY >
Element & init (Element &x, const ANY &y) const
 Specialization for NTL::ZZ.
NTL::ZZ & convert (NTL::ZZ &x, const Element &y) const
 Specialization for NTL::ZZ.
integerconvert (integer &x, const Element &y) const
 Conversion of field element to an integer.
double & convert (double &x, const Element &y) const
 Specialization for NTL::ZZ.
template<class ANY >
ANY & convert (ANY &x, const Element &y) const
 Specialization for NTL::ZZ.
Element & pow (Element &res, const Element &x, long exp) const
 Specialization for NTL::ZZ.
Element & powin (Element &x, long exp) const
 Specialization for NTL::ZZ.
integercardinality (integer &c) const
 Cardinality.
integer cardinality () const
 Specialization for NTL::ZZ.
integercharacteristic (integer &c) const
 Characteristic.
integer characteristic () const
 Specialization for NTL::ZZ.
Element & inv (Element &x, const Element &y) const
 Multiplicative Inverse.
bool isZero (const Element &x) const
 Zero equality.
bool isOne (const Element &x) const
 One equality.
Element & invin (Element &x) const
 Inplace Multiplicative Inverse.
std::ostreamwrite (std::ostream &os) const
 Print field.
std::ostreamwrite (std::ostream &os, const Element &x) const
 Specialization for NTL::ZZ.

Static Public Member Functions

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

Detailed Description

extend Wrapper of ZZ_p from NTL.

Add PIR functions


Member Function Documentation

static Element& div ( Element &  x,
const Element &  y,
const Element &  z 
) [inline, static]

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

Otherwise, throw an exception

static bool isUnit ( const Element &  x) [inline, static]

some PIR function

Test if x is a unit.

static Element& xgcd ( Element &  g,
Element &  s,
Element &  t,
const Element &  a,
const Element &  b 
) [inline, static]

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

and gcd (s, t) is a unit.

static Element& dxgcd ( Element &  g,
Element &  s,
Element &  t,
Element &  a1,
Element &  b1,
const Element &  a,
const Element &  b 
) [inline, static]

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

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

static integer getMaxModulus ( ) [inline, static]

Specialization for NTL::ZZ.

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

Reimplemented from NTL_ZZ_p.

Element& init ( Element &  x,
const integer y 
) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
Element& init ( Element &  x,
const double &  y 
) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
Element& init ( Element &  x,
const NTL::ZZ &  y 
) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
Element& init ( Element &  x) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
Element& init ( Element &  x,
const ANY &  y 
) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
NTL::ZZ& convert ( NTL::ZZ &  x,
const Element &  y 
) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to NTL::ZZ
Parameters:
xNTL::ZZ to contain output (reference returned).
yconstant reference to field element.
integer& convert ( integer x,
const Element &  y 
) const [inline, inherited]

Conversion of field element to an integer.

This function assumes the output field element x has already been constructed, but that it is not already initialized. This done by converting to a std::string : inefficient but correct.

Returns:
reference to integer.
Parameters:
xreference to integer to contain output (reference returned).
yconstant reference to field element.
double& convert ( double &  x,
const Element &  y 
) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
ANY& convert ( ANY &  x,
const Element &  y 
) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
Element& pow ( Element &  res,
const Element &  x,
long  exp 
) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
Element& powin ( Element &  x,
long  exp 
) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
integer& cardinality ( integer c) const [inline, inherited]

Cardinality.

Return integer representing cardinality of the field. Returns the modulus of the field, which should be prime.

Returns:
integer representing cardinality of the field
integer cardinality ( ) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
integer& characteristic ( integer c) const [inline, inherited]

Characteristic.

Return integer representing characteristic of the field. Returns the modulus of the field, which should be prime.

Returns:
integer representing characteristic of the field.
integer characteristic ( ) const [inline, inherited]

Specialization for NTL::ZZ.

Returns:
reference to field element.
Parameters:
xfield element to contain output (reference returned)
yNTL::ZZ.
Element& inv ( Element &  x,
const Element &  y 
) const [inline, inherited]

Multiplicative Inverse.

x = 1 / y This function assumes both field elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield element (reference returned).
yfield element.
bool isZero ( const Element &  x) const [inline, inherited]

Zero equality.

Test if field element is equal to zero. This function assumes the field element has already been constructed and initialized. In this specialization, NTL's IsZero function is called.

Returns:
boolean true if equals zero, false if not.
Parameters:
xfield element.
bool isOne ( const Element &  x) const [inline, inherited]

One equality.

Test if field element is equal to one. This function assumes the field element has already been constructed and initialized. In this specialization, NTL's IsOne function is called.

Returns:
boolean true if equals one, false if not.
Parameters:
xfield element.
Element& invin ( Element &  x) const [inline, inherited]

Inplace Multiplicative Inverse.

x = 1 / x This function assumes both field elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield element (reference returned).
std::ostream& write ( std::ostream os) const [inline, inherited]

Print field.

Returns:
output stream to which field is written.
Parameters:
osoutput stream to which field is written.
std::ostream& write ( std::ostream os,
const Element &  x 
) const [inline, inherited]

Specialization for NTL::ZZ.

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

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