Crypto++ 8.9
Free C++ class library of cryptographic schemes
Classes | List of all members
PolynomialOver< T > Class Template Reference

represents single-variable polynomials over arbitrary rings More...

#include <polynomi.h>

+ Inheritance diagram for PolynomialOver< T >:

Classes

class  DivideByZero
 division by zero exception More...
 
class  RandomizationParameter
 specify the distribution for randomization functions More...
 

ENUMS, EXCEPTIONS, and TYPEDEFS

typedef T Ring
 
typedef T::Element CoefficientType
 

INPUT/OUTPUT

std::istream & Input (std::istream &in, const Ring &ring)
 
std::ostream & Output (std::ostream &out, const Ring &ring) const
 

CREATORS

 PolynomialOver ()
 creates the zero polynomial
 
 PolynomialOver (const Ring &ring, unsigned int count)
 
 PolynomialOver (const PolynomialOver< Ring > &t)
 copy constructor
 
 PolynomialOver (const CoefficientType &element)
 construct constant polynomial
 
template<typename Iterator >
 PolynomialOver (Iterator begin, Iterator end)
 construct polynomial with specified coefficients, starting from coefficient of x^0
 
 PolynomialOver (const char *str, const Ring &ring)
 convert from string
 
 PolynomialOver (const byte *encodedPolynomialOver, unsigned int byteCount)
 convert from big-endian byte array
 
 PolynomialOver (const byte *BEREncodedPolynomialOver)
 convert from Basic Encoding Rules encoded byte array
 
 PolynomialOver (BufferedTransformation &bt)
 convert from BER encoded byte array stored in a BufferedTransformation object
 
 PolynomialOver (RandomNumberGenerator &rng, const RandomizationParameter &parameter, const Ring &ring)
 create a random PolynomialOver<T>
 

ACCESSORS

int Degree (const Ring &ring) const
 the zero polynomial will return a degree of -1
 
unsigned int CoefficientCount (const Ring &ring) const
 
CoefficientType GetCoefficient (unsigned int i, const Ring &ring) const
 return coefficient for x^i
 

MANIPULATORS

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
 
void Negate (const Ring &ring)
 
void swap (PolynomialOver< Ring > &t)
 

BASIC ARITHMETIC ON POLYNOMIALS

bool Equals (const PolynomialOver< Ring > &t, const Ring &ring) const
 
bool IsZero (const Ring &ring) const
 
PolynomialOver< Ring > Plus (const PolynomialOver< Ring > &t, const Ring &ring) const
 
PolynomialOver< Ring > Minus (const PolynomialOver< Ring > &t, const Ring &ring) const
 
PolynomialOver< Ring > Inverse (const Ring &ring) const
 
PolynomialOver< Ring > Times (const PolynomialOver< Ring > &t, const Ring &ring) const
 
PolynomialOver< Ring > DividedBy (const PolynomialOver< Ring > &t, const Ring &ring) const
 
PolynomialOver< Ring > Modulo (const PolynomialOver< Ring > &t, const Ring &ring) const
 
PolynomialOver< Ring > MultiplicativeInverse (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< Ring > Doubled (const Ring &ring) const
 
PolynomialOver< Ring > Squared (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)
 
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)
 

Detailed Description

template<class T>
class PolynomialOver< T >

represents single-variable polynomials over arbitrary rings

Definition at line 21 of file polynomi.h.

Member Typedef Documentation

◆ Ring

template<class T >
typedef T PolynomialOver< T >::Ring

Definition at line 46 of file polynomi.h.

◆ CoefficientType

template<class T >
typedef T::Element PolynomialOver< T >::CoefficientType

Definition at line 47 of file polynomi.h.

Constructor & Destructor Documentation

◆ PolynomialOver() [1/7]

template<class T >
PolynomialOver< T >::PolynomialOver ( )
inline

creates the zero polynomial

Definition at line 53 of file polynomi.h.

◆ PolynomialOver() [2/7]

template<class T >
PolynomialOver< T >::PolynomialOver ( const Ring & ring,
unsigned int count )
inline

Definition at line 56 of file polynomi.h.

◆ PolynomialOver() [3/7]

template<class T >
PolynomialOver< T >::PolynomialOver ( const PolynomialOver< Ring > & t)
inline

copy constructor

Definition at line 60 of file polynomi.h.

◆ PolynomialOver() [4/7]

template<class T >
PolynomialOver< T >::PolynomialOver ( const CoefficientType & element)
inline

construct constant polynomial

Definition at line 64 of file polynomi.h.

◆ PolynomialOver() [5/7]

template<class T >
template<typename Iterator >
PolynomialOver< T >::PolynomialOver ( Iterator begin,
Iterator end )
inline

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

Definition at line 68 of file polynomi.h.

◆ PolynomialOver() [6/7]

template<class T >
PolynomialOver< T >::PolynomialOver ( const char * str,
const Ring & ring )
inline

convert from string

Definition at line 72 of file polynomi.h.

◆ PolynomialOver() [7/7]

template<class T >
PolynomialOver< T >::PolynomialOver ( RandomNumberGenerator & rng,
const RandomizationParameter & parameter,
const Ring & ring )
inline

create a random PolynomialOver<T>

Definition at line 84 of file polynomi.h.

Member Function Documentation

◆ Degree()

template<class T >
int PolynomialOver< T >::Degree ( const Ring & ring) const
inline

the zero polynomial will return a degree of -1

Definition at line 91 of file polynomi.h.

◆ CoefficientCount()

template<class T >
unsigned int PolynomialOver< T >::CoefficientCount ( const Ring & ring) const

Definition at line 76 of file polynomi.cpp.

◆ GetCoefficient()

template<class T >
PolynomialOver< T >::CoefficientType PolynomialOver< T >::GetCoefficient ( unsigned int i,
const Ring & ring ) const

return coefficient for x^i

Definition at line 86 of file polynomi.cpp.

◆ operator=()

template<class T >
PolynomialOver< T > & PolynomialOver< T >::operator= ( const PolynomialOver< Ring > & t)

Definition at line 92 of file polynomi.cpp.

◆ Randomize()

template<class T >
void PolynomialOver< T >::Randomize ( RandomNumberGenerator & rng,
const RandomizationParameter & parameter,
const Ring & ring )

Definition at line 16 of file polynomi.cpp.

◆ SetCoefficient()

template<class T >
void PolynomialOver< T >::SetCoefficient ( unsigned int i,
const CoefficientType & value,
const Ring & ring )

set the coefficient for x^i to value

Definition at line 182 of file polynomi.cpp.

◆ Negate()

template<class T >
void PolynomialOver< T >::Negate ( const Ring & ring)

Definition at line 190 of file polynomi.cpp.

◆ swap()

template<class T >
void PolynomialOver< T >::swap ( PolynomialOver< Ring > & t)

Definition at line 198 of file polynomi.cpp.

◆ Equals()

template<class T >
bool PolynomialOver< T >::Equals ( const PolynomialOver< Ring > & t,
const Ring & ring ) const

Definition at line 204 of file polynomi.cpp.

◆ IsZero()

template<class T >
bool PolynomialOver< T >::IsZero ( const Ring & ring) const
inline

Definition at line 120 of file polynomi.h.

◆ Plus()

template<class T >
PolynomialOver< T > PolynomialOver< T >::Plus ( const PolynomialOver< Ring > & t,
const Ring & ring ) const

Definition at line 219 of file polynomi.cpp.

◆ Minus()

template<class T >
PolynomialOver< T > PolynomialOver< T >::Minus ( const PolynomialOver< Ring > & t,
const Ring & ring ) const

Definition at line 250 of file polynomi.cpp.

◆ Inverse()

template<class T >
PolynomialOver< T > PolynomialOver< T >::Inverse ( const Ring & ring) const

Definition at line 281 of file polynomi.cpp.

◆ Times()

template<class T >
PolynomialOver< T > PolynomialOver< T >::Times ( const PolynomialOver< Ring > & t,
const Ring & ring ) const

Definition at line 293 of file polynomi.cpp.

◆ DividedBy()

template<class T >
PolynomialOver< T > PolynomialOver< T >::DividedBy ( const PolynomialOver< Ring > & t,
const Ring & ring ) const

Definition at line 309 of file polynomi.cpp.

◆ Modulo()

template<class T >
PolynomialOver< T > PolynomialOver< T >::Modulo ( const PolynomialOver< Ring > & t,
const Ring & ring ) const

Definition at line 317 of file polynomi.cpp.

◆ MultiplicativeInverse()

template<class T >
PolynomialOver< T > PolynomialOver< T >::MultiplicativeInverse ( const Ring & ring) const

Definition at line 325 of file polynomi.cpp.

◆ IsUnit()

template<class T >
bool PolynomialOver< T >::IsUnit ( const Ring & ring) const

Definition at line 331 of file polynomi.cpp.

◆ Accumulate()

template<class T >
PolynomialOver< T > & PolynomialOver< T >::Accumulate ( const PolynomialOver< Ring > & t,
const Ring & ring )

Definition at line 104 of file polynomi.cpp.

◆ Reduce()

template<class T >
PolynomialOver< T > & PolynomialOver< T >::Reduce ( const PolynomialOver< Ring > & t,
const Ring & ring )

Definition at line 118 of file polynomi.cpp.

◆ Doubled()

template<class T >
PolynomialOver< Ring > PolynomialOver< T >::Doubled ( const Ring & ring) const
inline

Definition at line 136 of file polynomi.h.

◆ Squared()

template<class T >
PolynomialOver< Ring > PolynomialOver< T >::Squared ( const Ring & ring) const
inline

Definition at line 138 of file polynomi.h.

◆ EvaluateAt()

template<class T >
PolynomialOver< T >::CoefficientType PolynomialOver< T >::EvaluateAt ( const CoefficientType & x,
const Ring & ring ) const

Definition at line 132 of file polynomi.cpp.

◆ ShiftLeft()

template<class T >
PolynomialOver< T > & PolynomialOver< T >::ShiftLeft ( unsigned int n,
const Ring & ring )

Definition at line 149 of file polynomi.cpp.

◆ ShiftRight()

template<class T >
PolynomialOver< T > & PolynomialOver< T >::ShiftRight ( unsigned int n,
const Ring & ring )

Definition at line 167 of file polynomi.cpp.

◆ Divide()

template<class T >
void PolynomialOver< T >::Divide ( PolynomialOver< Ring > & r,
PolynomialOver< Ring > & q,
const PolynomialOver< Ring > & a,
const PolynomialOver< Ring > & d,
const Ring & ring )
static

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

Definition at line 430 of file polynomi.cpp.

◆ Input()

template<class T >
std::istream & PolynomialOver< T >::Input ( std::istream & in,
const Ring & ring )

Definition at line 337 of file polynomi.cpp.

◆ Output()

template<class T >
std::ostream & PolynomialOver< T >::Output ( std::ostream & out,
const Ring & ring ) const

Definition at line 370 of file polynomi.cpp.


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