Fabcoin Core  0.16.2
P2P Digital Currency
Classes | Public Types | Private Types | Static Private Attributes | List of all members
PolynomialOverFixedRing< T, instance > Class Template Reference

Polynomials over a fixed ring. More...

#include <polynomi.h>

Inheritance diagram for PolynomialOverFixedRing< T, instance >:
[legend]
Collaboration diagram for PolynomialOverFixedRing< T, instance >:
[legend]

Classes

struct  NewOnePolynomial
 

Public Types

typedef T Ring
 
typedef T::Element CoefficientType
 
typedef B::DivideByZero DivideByZero
 
typedef B::RandomizationParameter RandomizationParameter
 

Public Member Functions

ACCESSORS
int Degree () const
 the zero polynomial will return a degree of -1 More...
 
unsigned int CoefficientCount () const
 degree + 1 More...
 
CoefficientType GetCoefficient (unsigned int i) const
 return coefficient for x^i More...
 
CoefficientType operator[] (unsigned int i) const
 return coefficient for x^i More...
 
MANIPULATORS
ThisTypeoperator= (const ThisType &t)
 
ThisTypeoperator+= (const ThisType &t)
 
ThisTypeoperator-= (const ThisType &t)
 
ThisTypeoperator*= (const ThisType &t)
 
ThisTypeoperator/= (const ThisType &t)
 
ThisTypeoperator%= (const ThisType &t)
 
ThisTypeoperator<<= (unsigned int n)
 
ThisTypeoperator>>= (unsigned int n)
 
void SetCoefficient (unsigned int i, const CoefficientType &value)
 set the coefficient for x^i to value More...
 
void Randomize (RandomNumberGenerator &rng, const RandomizationParameter &parameter)
 
void Negate ()
 
void swap (ThisType &t)
 
UNARY OPERATORS
bool operator! () const
 
ThisType operator+ () const
 
ThisType operator- () const
 

Private Types

typedef PolynomialOver< TB
 
typedef PolynomialOverFixedRing< T, instance > ThisType
 
- Private Types inherited from PolynomialOver< T >
typedef T Ring
 
typedef T::Element CoefficientType
 

Static Private Attributes

static const Ring ms_fixedRing
 

Friends

BINARY OPERATORS
ThisType operator>> (ThisType a, unsigned int n)
 
ThisType operator<< (ThisType a, unsigned int n)
 
INPUT/OUTPUT
std::istream & operator>> (std::istream &in, ThisType &a)
 
std::ostream & operator<< (std::ostream &out, const ThisType &a)
 

CREATORS

 PolynomialOverFixedRing (unsigned int count=0)
 creates the zero polynomial More...
 
 PolynomialOverFixedRing (const ThisType &t)
 copy constructor More...
 
 PolynomialOverFixedRing (const B &t)
 
 PolynomialOverFixedRing (const CoefficientType &element)
 construct constant polynomial More...
 
template<typename Iterator >
 PolynomialOverFixedRing (Iterator first, Iterator last)
 construct polynomial with specified coefficients, starting from coefficient of x^0 More...
 
 PolynomialOverFixedRing (const char *str)
 convert from string More...
 
 PolynomialOverFixedRing (const byte *encodedPoly, unsigned int byteCount)
 convert from big-endian byte array More...
 
 PolynomialOverFixedRing (const byte *BEREncodedPoly)
 convert from Basic Encoding Rules encoded byte array More...
 
 PolynomialOverFixedRing (BufferedTransformation &bt)
 convert from BER encoded byte array stored in a BufferedTransformation object More...
 
 PolynomialOverFixedRing (RandomNumberGenerator &rng, const RandomizationParameter &parameter)
 create a random PolynomialOverFixedRing More...
 
static const ThisTypeZero ()
 
static const ThisTypeOne ()
 

OTHER ARITHMETIC FUNCTIONS

ThisType MultiplicativeInverse () const
 
bool IsUnit () const
 
ThisType Doubled () const
 
ThisType Squared () const
 
CoefficientType EvaluateAt (const CoefficientType &x) const
 
static void Divide (ThisType &r, ThisType &q, const ThisType &a, const ThisType &d)
 calculate r and q such that (a == d*q + r) && (0 <= r < abs(d)) More...
 

Additional Inherited Members

- Private Member Functions inherited from PolynomialOver< T >
 PolynomialOver ()
 creates the zero polynomial More...
 
 PolynomialOver (const Ring &ring, unsigned int count)
 
 PolynomialOver (const PolynomialOver< Ring > &t)
 copy constructor More...
 
 PolynomialOver (const CoefficientType &element)
 construct constant polynomial More...
 
template<typename Iterator >
 PolynomialOver (Iterator begin, Iterator end)
 construct polynomial with specified coefficients, starting from coefficient of x^0 More...
 
 PolynomialOver (const char *str, const Ring &ring)
 convert from string More...
 
 PolynomialOver (const byte *encodedPolynomialOver, unsigned int byteCount)
 convert from big-endian byte array More...
 
 PolynomialOver (const byte *BEREncodedPolynomialOver)
 convert from Basic Encoding Rules encoded byte array More...
 
 PolynomialOver (BufferedTransformation &bt)
 convert from BER encoded byte array stored in a BufferedTransformation object More...
 
 PolynomialOver (RandomNumberGenerator &rng, const RandomizationParameter &parameter, const Ring &ring)
 create a random PolynomialOver<T> More...
 
int Degree (const Ring &ring) const
 the zero polynomial will return a degree of -1 More...
 
unsigned int CoefficientCount (const Ring &ring) const
 
CoefficientType GetCoefficient (unsigned int i, const Ring &ring) const
 return coefficient for x^i More...
 
PolynomialOver< Ring > & operator= (const PolynomialOver< Ring > &t)
 
void Randomize (RandomNumberGenerator &rng, const RandomizationParameter &parameter, const Ring &ring)
 
void SetCoefficient (unsigned int i, const CoefficientType &value, const Ring &ring)
 set the coefficient for x^i to value More...
 
void Negate (const Ring &ring)
 
void swap (PolynomialOver< Ring > &t)
 
bool Equals (const PolynomialOver< Ring > &t, const Ring &ring) const
 
bool IsZero (const Ring &ring) const
 
PolynomialOver< RingPlus (const PolynomialOver< Ring > &t, const Ring &ring) const
 
PolynomialOver< RingMinus (const PolynomialOver< Ring > &t, const Ring &ring) const
 
PolynomialOver< RingInverse (const Ring &ring) const
 
PolynomialOver< RingTimes (const PolynomialOver< Ring > &t, const Ring &ring) const
 
PolynomialOver< RingDividedBy (const PolynomialOver< Ring > &t, const Ring &ring) const
 
PolynomialOver< RingModulo (const PolynomialOver< Ring > &t, const Ring &ring) const
 
PolynomialOver< RingMultiplicativeInverse (const Ring &ring) const
 
bool IsUnit (const Ring &ring) const
 
PolynomialOver< Ring > & Accumulate (const PolynomialOver< Ring > &t, const Ring &ring)
 
PolynomialOver< Ring > & Reduce (const PolynomialOver< Ring > &t, const Ring &ring)
 
PolynomialOver< RingDoubled (const Ring &ring) const
 
PolynomialOver< RingSquared (const Ring &ring) const
 
CoefficientType EvaluateAt (const CoefficientType &x, const Ring &ring) const
 
PolynomialOver< Ring > & ShiftLeft (unsigned int n, const Ring &ring)
 
PolynomialOver< Ring > & ShiftRight (unsigned int n, const Ring &ring)
 
std::istream & Input (std::istream &in, const Ring &ring)
 
std::ostream & Output (std::ostream &out, const Ring &ring) const
 
- Static Private Member Functions inherited from PolynomialOver< T >
static void Divide (PolynomialOver< Ring > &r, PolynomialOver< Ring > &q, const PolynomialOver< Ring > &a, const PolynomialOver< Ring > &d, const Ring &ring)
 calculate r and q such that (a == d*q + r) && (0 <= degree of r < degree of d) More...
 

Detailed Description

template<class T, int instance>
class PolynomialOverFixedRing< T, instance >

Polynomials over a fixed ring.

Having a fixed ring allows overloaded operators

Definition at line 167 of file polynomi.h.

Member Typedef Documentation

template<class T , int instance>
typedef PolynomialOver<T> PolynomialOverFixedRing< T, instance >::B
private

Definition at line 169 of file polynomi.h.

template<class T , int instance>
typedef T::Element PolynomialOverFixedRing< T, instance >::CoefficientType

Definition at line 174 of file polynomi.h.

template<class T , int instance>
typedef B::DivideByZero PolynomialOverFixedRing< T, instance >::DivideByZero

Definition at line 175 of file polynomi.h.

template<class T , int instance>
typedef B::RandomizationParameter PolynomialOverFixedRing< T, instance >::RandomizationParameter

Definition at line 176 of file polynomi.h.

template<class T , int instance>
typedef T PolynomialOverFixedRing< T, instance >::Ring

Definition at line 173 of file polynomi.h.

template<class T , int instance>
typedef PolynomialOverFixedRing<T, instance> PolynomialOverFixedRing< T, instance >::ThisType
private

Definition at line 170 of file polynomi.h.

Constructor & Destructor Documentation

template<class T , int instance>
PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing ( unsigned int  count = 0)
inline

creates the zero polynomial

Definition at line 181 of file polynomi.h.

template<class T , int instance>
PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing ( const ThisType t)
inline

copy constructor

Definition at line 184 of file polynomi.h.

template<class T , int instance>
PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing ( const B t)
inlineexplicit

Definition at line 186 of file polynomi.h.

template<class T , int instance>
PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing ( const CoefficientType element)
inline

construct constant polynomial

Definition at line 189 of file polynomi.h.

template<class T , int instance>
template<typename Iterator >
PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing ( Iterator  first,
Iterator  last 
)
inline

construct polynomial with specified coefficients, starting from coefficient of x^0

Definition at line 192 of file polynomi.h.

template<class T , int instance>
PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing ( const char *  str)
inlineexplicit

convert from string

Definition at line 196 of file polynomi.h.

template<class T , int instance>
PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing ( const byte encodedPoly,
unsigned int  byteCount 
)
inline

convert from big-endian byte array

Definition at line 199 of file polynomi.h.

template<class T , int instance>
PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing ( const byte BEREncodedPoly)
inlineexplicit

convert from Basic Encoding Rules encoded byte array

Definition at line 202 of file polynomi.h.

template<class T , int instance>
PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing ( BufferedTransformation bt)
inlineexplicit

convert from BER encoded byte array stored in a BufferedTransformation object

Definition at line 205 of file polynomi.h.

template<class T , int instance>
PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing ( RandomNumberGenerator rng,
const RandomizationParameter parameter 
)
inline

create a random PolynomialOverFixedRing

Definition at line 208 of file polynomi.h.

Member Function Documentation

template<class T , int instance>
unsigned int PolynomialOverFixedRing< T, instance >::CoefficientCount ( ) const
inline

degree + 1

Definition at line 219 of file polynomi.h.

template<class T , int instance>
int PolynomialOverFixedRing< T, instance >::Degree ( ) const
inline

the zero polynomial will return a degree of -1

Definition at line 217 of file polynomi.h.

template<class T , int instance>
static void PolynomialOverFixedRing< T, instance >::Divide ( ThisType r,
ThisType q,
const ThisType a,
const ThisType d 
)
inlinestatic

calculate r and q such that (a == d*q + r) && (0 <= r < abs(d))

Definition at line 291 of file polynomi.h.

Here is the call graph for this function:

template<class T , int instance>
ThisType PolynomialOverFixedRing< T, instance >::Doubled ( ) const
inline

Definition at line 284 of file polynomi.h.

template<class T , int instance>
CoefficientType PolynomialOverFixedRing< T, instance >::EvaluateAt ( const CoefficientType x) const
inline

Definition at line 288 of file polynomi.h.

template<class T , int instance>
CoefficientType PolynomialOverFixedRing< T, instance >::GetCoefficient ( unsigned int  i) const
inline

return coefficient for x^i

Definition at line 221 of file polynomi.h.

template<class T , int instance>
bool PolynomialOverFixedRing< T, instance >::IsUnit ( ) const
inline

Definition at line 281 of file polynomi.h.

template<class T , int instance>
ThisType PolynomialOverFixedRing< T, instance >::MultiplicativeInverse ( ) const
inline

Definition at line 279 of file polynomi.h.

template<class T , int instance>
void PolynomialOverFixedRing< T, instance >::Negate ( )
inline

Definition at line 253 of file polynomi.h.

template<class T , int instance>
const PolynomialOverFixedRing< T, instance > & PolynomialOverFixedRing< T, instance >::One ( )
static

Definition at line 572 of file polynomi.cpp.

template<class T , int instance>
bool PolynomialOverFixedRing< T, instance >::operator! ( ) const
inline

Definition at line 261 of file polynomi.h.

template<class T , int instance>
ThisType& PolynomialOverFixedRing< T, instance >::operator%= ( const ThisType t)
inline

Definition at line 239 of file polynomi.h.

template<class T , int instance>
ThisType& PolynomialOverFixedRing< T, instance >::operator*= ( const ThisType t)
inline

Definition at line 235 of file polynomi.h.

template<class T , int instance>
ThisType PolynomialOverFixedRing< T, instance >::operator+ ( ) const
inline

Definition at line 263 of file polynomi.h.

template<class T , int instance>
ThisType& PolynomialOverFixedRing< T, instance >::operator+= ( const ThisType t)
inline

Definition at line 231 of file polynomi.h.

template<class T , int instance>
ThisType PolynomialOverFixedRing< T, instance >::operator- ( ) const
inline

Definition at line 265 of file polynomi.h.

Here is the call graph for this function:

template<class T , int instance>
ThisType& PolynomialOverFixedRing< T, instance >::operator-= ( const ThisType t)
inline

Definition at line 233 of file polynomi.h.

template<class T , int instance>
ThisType& PolynomialOverFixedRing< T, instance >::operator/= ( const ThisType t)
inline

Definition at line 237 of file polynomi.h.

template<class T , int instance>
ThisType& PolynomialOverFixedRing< T, instance >::operator<<= ( unsigned int  n)
inline

Definition at line 242 of file polynomi.h.

template<class T , int instance>
ThisType& PolynomialOverFixedRing< T, instance >::operator= ( const ThisType t)
inline

Definition at line 229 of file polynomi.h.

template<class T , int instance>
ThisType& PolynomialOverFixedRing< T, instance >::operator>>= ( unsigned int  n)
inline

Definition at line 244 of file polynomi.h.

template<class T , int instance>
CoefficientType PolynomialOverFixedRing< T, instance >::operator[] ( unsigned int  i) const
inline

return coefficient for x^i

Definition at line 223 of file polynomi.h.

template<class T , int instance>
void PolynomialOverFixedRing< T, instance >::Randomize ( RandomNumberGenerator rng,
const RandomizationParameter parameter 
)
inline

Definition at line 250 of file polynomi.h.

template<class T , int instance>
void PolynomialOverFixedRing< T, instance >::SetCoefficient ( unsigned int  i,
const CoefficientType value 
)
inline

set the coefficient for x^i to value

Definition at line 247 of file polynomi.h.

template<class T , int instance>
ThisType PolynomialOverFixedRing< T, instance >::Squared ( ) const
inline

Definition at line 286 of file polynomi.h.

template<class T , int instance>
void PolynomialOverFixedRing< T, instance >::swap ( ThisType t)
inline

Definition at line 255 of file polynomi.h.

Here is the call graph for this function:

template<class T , int instance>
const PolynomialOverFixedRing< T, instance > & PolynomialOverFixedRing< T, instance >::Zero ( )
static

Definition at line 566 of file polynomi.cpp.

Friends And Related Function Documentation

template<class T , int instance>
ThisType operator<< ( ThisType  a,
unsigned int  n 
)
friend

Definition at line 273 of file polynomi.h.

template<class T , int instance>
std::ostream& operator<< ( std::ostream &  out,
const ThisType a 
)
friend

Definition at line 301 of file polynomi.h.

template<class T , int instance>
ThisType operator>> ( ThisType  a,
unsigned int  n 
)
friend

Definition at line 271 of file polynomi.h.

template<class T , int instance>
std::istream& operator>> ( std::istream &  in,
ThisType a 
)
friend

Definition at line 298 of file polynomi.h.

Member Data Documentation

template<class T , int instance>
const Ring PolynomialOverFixedRing< T, instance >::ms_fixedRing
staticprivate

Definition at line 314 of file polynomi.h.


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