Fabcoin Core
0.16.2
P2P Digital Currency
|
represents single-variable polynomials over arbitrary rings More...
#include <polynomi.h>
Classes | |
class | DivideByZero |
division by zero exception More... | |
class | RandomizationParameter |
specify the distribution for randomization functions More... | |
Private Member Functions | |
void | FromStr (const char *str, const Ring &ring) |
Private Attributes | |
std::vector< CoefficientType > | m_coefficients |
ENUMS, EXCEPTIONS, and TYPEDEFS | |
typedef T | Ring |
typedef T::Element | CoefficientType |
CREATORS | |
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 ¶meter, const Ring &ring) | |
create a random PolynomialOver<T> More... | |
ACCESSORS | |
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... | |
MANIPULATORS | |
PolynomialOver< Ring > & | operator= (const PolynomialOver< Ring > &t) |
void | Randomize (RandomNumberGenerator &rng, const RandomizationParameter ¶meter, 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) |
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) More... | |
INPUT/OUTPUT | |
std::istream & | Input (std::istream &in, const Ring &ring) |
std::ostream & | Output (std::ostream &out, const Ring &ring) const |
represents single-variable polynomials over arbitrary rings
Definition at line 25 of file polynomi.h.
typedef T::Element PolynomialOver< T >::CoefficientType |
Definition at line 51 of file polynomi.h.
typedef T PolynomialOver< T >::Ring |
Definition at line 50 of file polynomi.h.
|
inline |
creates the zero polynomial
Definition at line 57 of file polynomi.h.
|
inline |
Definition at line 60 of file polynomi.h.
|
inline |
copy constructor
Definition at line 64 of file polynomi.h.
|
inline |
construct constant polynomial
Definition at line 68 of file polynomi.h.
|
inline |
construct polynomial with specified coefficients, starting from coefficient of x^0
Definition at line 72 of file polynomi.h.
|
inline |
convert from string
Definition at line 76 of file polynomi.h.
PolynomialOver< T >::PolynomialOver | ( | const byte * | encodedPolynomialOver, |
unsigned int | byteCount | ||
) |
convert from big-endian byte array
|
explicit |
convert from Basic Encoding Rules encoded byte array
|
explicit |
convert from BER encoded byte array stored in a BufferedTransformation object
|
inline |
create a random PolynomialOver<T>
Definition at line 88 of file polynomi.h.
PolynomialOver< T > & PolynomialOver< T >::Accumulate | ( | const PolynomialOver< Ring > & | t, |
const Ring & | ring | ||
) |
Definition at line 104 of file polynomi.cpp.
unsigned int PolynomialOver< T >::CoefficientCount | ( | const Ring & | ring | ) | const |
|
inline |
the zero polynomial will return a degree of -1
Definition at line 95 of file polynomi.h.
|
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.
PolynomialOver< T > PolynomialOver< T >::DividedBy | ( | const PolynomialOver< Ring > & | t, |
const Ring & | ring | ||
) | const |
Definition at line 309 of file polynomi.cpp.
|
inline |
Definition at line 140 of file polynomi.h.
bool PolynomialOver< T >::Equals | ( | const PolynomialOver< Ring > & | t, |
const Ring & | ring | ||
) | const |
Definition at line 204 of file polynomi.cpp.
PolynomialOver< T >::CoefficientType PolynomialOver< T >::EvaluateAt | ( | const CoefficientType & | x, |
const Ring & | ring | ||
) | const |
|
private |
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.
std::istream & PolynomialOver< T >::Input | ( | std::istream & | in, |
const Ring & | ring | ||
) |
Definition at line 337 of file polynomi.cpp.
PolynomialOver< T > PolynomialOver< T >::Inverse | ( | const Ring & | ring | ) | const |
bool PolynomialOver< T >::IsUnit | ( | const Ring & | ring | ) | const |
|
inline |
Definition at line 124 of file polynomi.h.
PolynomialOver< T > PolynomialOver< T >::Minus | ( | const PolynomialOver< Ring > & | t, |
const Ring & | ring | ||
) | const |
Definition at line 250 of file polynomi.cpp.
PolynomialOver< T > PolynomialOver< T >::Modulo | ( | const PolynomialOver< Ring > & | t, |
const Ring & | ring | ||
) | const |
Definition at line 317 of file polynomi.cpp.
PolynomialOver< T > PolynomialOver< T >::MultiplicativeInverse | ( | const Ring & | ring | ) | const |
void PolynomialOver< T >::Negate | ( | const Ring & | ring | ) |
PolynomialOver< T > & PolynomialOver< T >::operator= | ( | const PolynomialOver< Ring > & | t | ) |
std::ostream & PolynomialOver< T >::Output | ( | std::ostream & | out, |
const Ring & | ring | ||
) | const |
PolynomialOver< T > PolynomialOver< T >::Plus | ( | const PolynomialOver< Ring > & | t, |
const Ring & | ring | ||
) | const |
Definition at line 219 of file polynomi.cpp.
void PolynomialOver< T >::Randomize | ( | RandomNumberGenerator & | rng, |
const RandomizationParameter & | parameter, | ||
const Ring & | ring | ||
) |
PolynomialOver< T > & PolynomialOver< T >::Reduce | ( | const PolynomialOver< Ring > & | t, |
const Ring & | ring | ||
) |
Definition at line 118 of file polynomi.cpp.
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.
PolynomialOver< T > & PolynomialOver< T >::ShiftLeft | ( | unsigned int | n, |
const Ring & | ring | ||
) |
PolynomialOver< T > & PolynomialOver< T >::ShiftRight | ( | unsigned int | n, |
const Ring & | ring | ||
) |
|
inline |
Definition at line 142 of file polynomi.h.
void PolynomialOver< T >::swap | ( | PolynomialOver< Ring > & | t | ) |
Definition at line 198 of file polynomi.cpp.
PolynomialOver< T > PolynomialOver< T >::Times | ( | const PolynomialOver< Ring > & | t, |
const Ring & | ring | ||
) | const |
Definition at line 293 of file polynomi.cpp.
|
private |
Definition at line 162 of file polynomi.h.