PolynomialOverFixedRing< T, instance > Class Template Reference

Polynomials over a fixed ring. More...

`#include <polynomi.h>`

Inheritance diagram for PolynomialOverFixedRing< T, instance >:

## 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
unsigned int | CoefficientCount () const
| degree + 1
CoefficientType | GetCoefficient (unsigned int i) const
| return coefficient for x^i
CoefficientType | operator[] (unsigned int i) const
| return coefficient for x^i
MANIPULATORS
ThisType & | operator= (const ThisType &t)
ThisType & | operator+= (const ThisType &t)
ThisType & | operator-= (const ThisType &t)
ThisType & | operator*= (const ThisType &t)
ThisType & | operator/= (const ThisType &t)
ThisType & | operator%= (const ThisType &t)
ThisType & | operator<<= (unsigned int n)
ThisType & | operator>>= (unsigned int n)
void | SetCoefficient (unsigned int i, const CoefficientType &value)
| set the coefficient for x^i to value
void | Randomize (RandomNumberGenerator &rng, const RandomizationParameter &parameter)
void | Negate ()
void | swap (ThisType &t)
UNARY OPERATORS
bool | operator! () const
ThisType | operator+ () const
ThisType | operator- () const

## 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
| PolynomialOverFixedRing (const ThisType &t)
| copy constructor
| PolynomialOverFixedRing (const B &t)
| PolynomialOverFixedRing (const CoefficientType &element)
| construct constant polynomial
template<typename Iterator >
| PolynomialOverFixedRing (Iterator first, Iterator last)
| construct polynomial with specified coefficients, starting from coefficient of x^0
| PolynomialOverFixedRing (const char *str)
| convert from string
| PolynomialOverFixedRing (const byte *encodedPoly, unsigned int byteCount)
| convert from big-endian byte array
| PolynomialOverFixedRing (const byte *BEREncodedPoly)
| convert from Basic Encoding Rules encoded byte array
| PolynomialOverFixedRing (BufferedTransformation &bt)
| convert from BER encoded byte array stored in a BufferedTransformation object
| PolynomialOverFixedRing (RandomNumberGenerator &rng, const RandomizationParameter &parameter)
| create a random PolynomialOverFixedRing
static const ThisType & | Zero ()
static const ThisType & | One ()

## 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))

## 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 163 of file polynomi.h.

## Member Typedef Documentation

## Ring

template<class T , int instance>

typedef T PolynomialOverFixedRing< T, instance >::Ring

Definition at line 169 of file polynomi.h.

## CoefficientType

template<class T , int instance>

typedef T::Element PolynomialOverFixedRing< T, instance >::CoefficientType

Definition at line 170 of file polynomi.h.

## DivideByZero

template<class T , int instance>

typedef B::DivideByZero PolynomialOverFixedRing< T, instance >::DivideByZero

Definition at line 171 of file polynomi.h.

## RandomizationParameter

template<class T , int instance>

typedef B::RandomizationParameter PolynomialOverFixedRing< T, instance >::RandomizationParameter

Definition at line 172 of file polynomi.h.

## Constructor & Destructor Documentation

## PolynomialOverFixedRing() [1/10]

template<class T , int instance>

PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing | ( | unsigned int | count = `0` | ) |

inline

creates the zero polynomial

Definition at line 177 of file polynomi.h.

## PolynomialOverFixedRing() [2/10]

template<class T , int instance>

PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing | ( | const ThisType & | t | ) |

inline

copy constructor

Definition at line 180 of file polynomi.h.

## PolynomialOverFixedRing() [3/10]

template<class T , int instance>

PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing | ( | const B & | t | ) |

inline explicit

Definition at line 182 of file polynomi.h.

## PolynomialOverFixedRing() [4/10]

template<class T , int instance>

PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing | ( | const CoefficientType & | element | ) |

inline

construct constant polynomial

Definition at line 185 of file polynomi.h.

## PolynomialOverFixedRing() [5/10]

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 188 of file polynomi.h.

## PolynomialOverFixedRing() [6/10]

template<class T , int instance>

PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing | ( | const char * | str | ) |

inline explicit

convert from string

Definition at line 192 of file polynomi.h.

## PolynomialOverFixedRing() [7/10]

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 195 of file polynomi.h.

## PolynomialOverFixedRing() [8/10]

template<class T , int instance>

PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing | ( | const byte * | BEREncodedPoly | ) |

inline explicit

convert from Basic Encoding Rules encoded byte array

Definition at line 198 of file polynomi.h.

## PolynomialOverFixedRing() [9/10]

template<class T , int instance>

PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing | ( | BufferedTransformation & | bt | ) |

inline explicit

convert from BER encoded byte array stored in a BufferedTransformation object

Definition at line 201 of file polynomi.h.

## PolynomialOverFixedRing() [10/10]

template<class T , int instance>

PolynomialOverFixedRing< T, instance >::PolynomialOverFixedRing | ( | RandomNumberGenerator & | rng,
|  | const RandomizationParameter & | parameter
| ) |  |

inline

create a random PolynomialOverFixedRing

Definition at line 204 of file polynomi.h.

## Member Function Documentation

## Zero()

template<class T , int instance>

const PolynomialOverFixedRing< T, instance > & PolynomialOverFixedRing< T, instance >::Zero | ( |  | ) |

static

Definition at line 566 of file polynomi.cpp.

## One()

template<class T , int instance>

const PolynomialOverFixedRing< T, instance > & PolynomialOverFixedRing< T, instance >::One | ( |  | ) |

static

Definition at line 572 of file polynomi.cpp.

## Degree()

template<class T , int instance>

int PolynomialOverFixedRing< T, instance >::Degree | ( |  | ) | const

inline

the zero polynomial will return a degree of -1

Definition at line 213 of file polynomi.h.

## CoefficientCount()

template<class T , int instance>

unsigned int PolynomialOverFixedRing< T, instance >::CoefficientCount | ( |  | ) | const

inline

degree + 1

Definition at line 215 of file polynomi.h.

## GetCoefficient()

template<class T , int instance>

CoefficientType PolynomialOverFixedRing< T, instance >::GetCoefficient | ( | unsigned int | i | ) | const

inline

return coefficient for x^i

Definition at line 217 of file polynomi.h.

## operator[]()

template<class T , int instance>

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

inline

return coefficient for x^i

Definition at line 219 of file polynomi.h.

## operator=()

template<class T , int instance>

ThisType & PolynomialOverFixedRing< T, instance >::operator= | ( | const ThisType & | t | ) |

inline

Definition at line 225 of file polynomi.h.

## operator+=()

template<class T , int instance>

ThisType & PolynomialOverFixedRing< T, instance >::operator+= | ( | const ThisType & | t | ) |

inline

Definition at line 227 of file polynomi.h.

## operator-=()

template<class T , int instance>

ThisType & PolynomialOverFixedRing< T, instance >::operator-= | ( | const ThisType & | t | ) |

inline

Definition at line 229 of file polynomi.h.

## operator*=()

template<class T , int instance>

ThisType & PolynomialOverFixedRing< T, instance >::operator*= | ( | const ThisType & | t | ) |

inline

Definition at line 231 of file polynomi.h.

## operator/=()

template<class T , int instance>

ThisType & PolynomialOverFixedRing< T, instance >::operator/= | ( | const ThisType & | t | ) |

inline

Definition at line 233 of file polynomi.h.

## operator%=()

template<class T , int instance>

ThisType & PolynomialOverFixedRing< T, instance >::operator%= | ( | const ThisType & | t | ) |

inline

Definition at line 235 of file polynomi.h.

## operator<<=()

template<class T , int instance>

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

inline

Definition at line 238 of file polynomi.h.

## operator>>=()

template<class T , int instance>

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

inline

Definition at line 240 of file polynomi.h.

## SetCoefficient()

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 243 of file polynomi.h.

## Randomize()

template<class T , int instance>

void PolynomialOverFixedRing< T, instance >::Randomize | ( | RandomNumberGenerator & | rng,
|  | const RandomizationParameter & | parameter
| ) |  |

inline

Definition at line 246 of file polynomi.h.

## Negate()

template<class T , int instance>

void PolynomialOverFixedRing< T, instance >::Negate | ( |  | ) |

inline

Definition at line 249 of file polynomi.h.

## swap()

template<class T , int instance>

void PolynomialOverFixedRing< T, instance >::swap | ( | ThisType & | t | ) |

inline

Definition at line 251 of file polynomi.h.

## operator!()

template<class T , int instance>

bool PolynomialOverFixedRing< T, instance >::operator! | ( |  | ) | const

inline

Definition at line 257 of file polynomi.h.

## operator+()

template<class T , int instance>

ThisType PolynomialOverFixedRing< T, instance >::operator+ | ( |  | ) | const

inline

Definition at line 259 of file polynomi.h.

## operator-()

template<class T , int instance>

ThisType PolynomialOverFixedRing< T, instance >::operator- | ( |  | ) | const

inline

Definition at line 261 of file polynomi.h.

## MultiplicativeInverse()

template<class T , int instance>

ThisType PolynomialOverFixedRing< T, instance >::MultiplicativeInverse | ( |  | ) | const

inline

Definition at line 275 of file polynomi.h.

## IsUnit()

template<class T , int instance>

bool PolynomialOverFixedRing< T, instance >::IsUnit | ( |  | ) | const

inline

Definition at line 277 of file polynomi.h.

## Doubled()

template<class T , int instance>

ThisType PolynomialOverFixedRing< T, instance >::Doubled | ( |  | ) | const

inline

Definition at line 280 of file polynomi.h.

## Squared()

template<class T , int instance>

ThisType PolynomialOverFixedRing< T, instance >::Squared | ( |  | ) | const

inline

Definition at line 282 of file polynomi.h.

## EvaluateAt()

template<class T , int instance>

CoefficientType PolynomialOverFixedRing< T, instance >::EvaluateAt | ( | const CoefficientType & | x | ) | const

inline

Definition at line 284 of file polynomi.h.

## Divide()

template<class T , int instance>

static void PolynomialOverFixedRing< T, instance >::Divide | ( | ThisType & | r,
|  | ThisType & | q,
|  | const ThisType & | a,
|  | const ThisType & | d
| ) |  |

inline static

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

Definition at line 287 of file polynomi.h.

## Friends And Related Symbol Documentation

## operator>> [1/2]

template<class T , int instance>

ThisType operator>> | ( | ThisType | a,
|  | unsigned int | n
| ) |  |

friend

Definition at line 267 of file polynomi.h.

## operator<< [1/2]

template<class T , int instance>

ThisType operator<< | ( | ThisType | a,
|  | unsigned int | n
| ) |  |

friend

Definition at line 269 of file polynomi.h.

## operator>> [2/2]

template<class T , int instance>

std::istream & operator>> | ( | std::istream & | in,
|  | ThisType & | a
| ) |  |

friend

Definition at line 294 of file polynomi.h.

## operator<< [2/2]

template<class T , int instance>

std::ostream & operator<< | ( | std::ostream & | out,
|  | const ThisType & | a
| ) |  |

friend

Definition at line 297 of file polynomi.h.

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

- polynomi.h
- polynomi.cpp