Specialization of Modular to int64_t element type with efficient dot product.
More...
Public Types |
typedef int64_t | Element |
typedef ModularRandIter< int64_t > | RandIter |
Public Member Functions |
| Modular () |
| Modular (int64_t value, int64_t exp=1) |
| Modular (const Modular< int64_t > &mf) |
Modular< Element > & | assign (const Modular< Element > &F) |
const Modular & | operator= (const Modular< int64_t > &F) |
unsigned long & | cardinality (unsigned long &c) const |
unsigned long & | characteristic (unsigned long &c) const |
unsigned long | characteristic () const |
unsigned long | cardinality () const |
int64_t & | convert (int64_t &x, const Element &y) const |
double & | convert (double &x, const Element &y) const |
float & | convert (float &x, const Element &y) const |
std::ostream & | write (std::ostream &os) const |
std::istream & | read (std::istream &is) |
std::ostream & | write (std::ostream &os, const Element &x) const |
std::istream & | read (std::istream &is, Element &x) const |
Element & | init (Element &x, const double &y) const |
Element & | init (Element &x, const float &y) const |
template<class Element1 > |
Element & | init (Element &x, const Element1 &y) const |
Element & | init (Element &x, int y=0) const |
Element & | init (Element &x, long y) const |
Element & | assign (Element &x, const Element &y) const |
bool | areEqual (const Element &x, const Element &y) const |
bool | isZero (const Element &x) const |
bool | isOne (const Element &x) const |
Element & | add (Element &x, const Element &y, const Element &z) const |
Element & | sub (Element &x, const Element &y, const Element &z) const |
Element & | mul (Element &x, const Element &y, const Element &z) const |
Element & | div (Element &x, const Element &y, const Element &z) const |
Element & | neg (Element &x, const Element &y) const |
Element & | inv (Element &x, const Element &y) const |
Element & | axpy (Element &r, const Element &a, const Element &x, const Element &y) const |
Element & | addin (Element &x, const Element &y) const |
Element & | subin (Element &x, const Element &y) const |
Element & | mulin (Element &x, const Element &y) const |
Element & | divin (Element &x, const Element &y) const |
Element & | negin (Element &x) const |
Element & | invin (Element &x) const |
Element & | axpyin (Element &r, const Element &a, const Element &x) const |
Static Public Member Functions |
static int64_t | getMaxModulus () |
Data Fields |
const Element | one |
const Element | zero |
const Element | mone |
Static Public Attributes |
static const bool | balanced = false |
Protected Attributes |
int64_t | modulus |
double | modulusinv |
unsigned long | lmodulus |
int64_t | _two64 |
template<>
class FFPACK::Modular< int64_t >
Specialization of Modular to int64_t element type with efficient dot product.
Efficient element operations for dot product, mul, axpy, by using floating point inverse of modulus (borrowed from NTL) and some use of non-normalized intermediate values.
For some uses this is the most efficient field for primes in the range from half word to 2^62.
Requires: Modulus < 2^62. Intended use: 2^30 < prime modulus < 2^62.