class representing elements of F_q.
Limitation: field element representatives assumed as positive and only values between {0...characterristic-1}
More...
#include <basicNumber.h>
Public Member Functions | |
operator int () | |
void | printMultSecure (std::ostream &os) const |
Constructors | |
fieldScalar (std::stringstream &sstream) | |
fieldScalar () | |
constructs a basic number {0 + 0*EPS } | |
fieldScalar (TScalar s) | |
constructs a basic number {s + 0*EPS } | |
fieldScalar (TScalar s, TScalar eps) | |
constructs a basic number {s } | |
fieldScalar (TScalar epsPrecision, std::string s) | |
constructs a basic number, epsPrecision is ignored and assumed =1 | |
fieldScalar (const fieldScalar &z) | |
copy constructor | |
properties | |
unsigned short | getEpsPrecision () const |
short | getEpsDegree () const |
returns the highest EpsExponent where the coeffitient is not zero. | |
data Access | |
TScalar | getX () const |
returns x | |
TScalar | getEps () const |
returns 0 | |
void | setX (TScalar xxx) |
set x= xxx | |
void | setEps (TScalar _eps) |
does nothing : throw Exception ! | |
TScalar | getValue (TScalar epsPrecision) const |
get coefficient with defined EPSPrecision to {val + coeff*epsPrcision } | |
void | setValue (TScalar _epsExponent, TScalar coeff) |
set value to coeff if _epsExponent==0, otherwise does nothing | |
getset | |
TScalar & | operator[] (int i) |
operators | |
int | nearlyEqual (const fieldScalar z) const |
returs true if (z . x == this -> x); eps is ignored! | |
bool | isZero () const |
bool | isNotZero () const |
bool | operator== (const fieldScalar z) const |
bool | operator!= (const fieldScalar z) const |
Static Public Member Functions | |
static bool | memsetClearAllowed () |
returns true, if it is allowed to initialise class objects with memset(0) | |
static bool | wellDefined (unsigned int characteristic) |
checks, if the datatype TScalar is large enough (in bits) to store field element representatives {0...characterristic-1} | |
index computation | |
static size_t | getSingleIndex (const fieldScalar b, const TScalar characteristic) |
static size_t | getSingleIndexByRef (const fieldScalar &b, const TScalar &characteristic) |
static size_t | getSingleIndex (const fieldScalar b) |
static size_t | getSingleIndexByRef (const fieldScalar &b) |
static size_t | getPairIndex (const fieldScalar a, const fieldScalar b, const TScalar characteristic) |
static size_t | getPairIndexByRef (const fieldScalar &a, const fieldScalar &b, const TScalar &characteristic) |
static size_t | getMaxSingleIndex (const TScalar characteristic) |
static size_t | getMaxPairIndex (const TScalar characteristic) |
Protected Attributes | |
TScalar | x |
represents x*EPS^0 | |
static data | |
| |
typedef TScalar | scalarType |
static const fieldScalar | Zero = fieldScalar<TScalar>(0) |
represents zero (x=0 and eps=0) | |
static const fieldScalar | One = fieldScalar<TScalar>(1) |
represents one (x=1 and eps=0) |
Definition at line 200 of file basicNumber.h.
typedef TScalar fieldScalar< TScalar >::scalarType |
Definition at line 217 of file basicNumber.h.
fieldScalar< TScalar >::fieldScalar | ( | std::stringstream & | sstream | ) | [inline] |
Definition at line 389 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
fieldScalar< TScalar >::fieldScalar | ( | ) | [inline] |
Definition at line 385 of file basicNumber.cpp.
fieldScalar< TScalar >::fieldScalar | ( | TScalar | s | ) | [inline] |
constructs afieldScalar {s }
Definition at line 400 of file basicNumber.cpp.
fieldScalar< TScalar >::fieldScalar | ( | TScalar | s, | |
TScalar | eps | |||
) | [inline] |
Definition at line 452 of file basicNumber.cpp.
fieldScalar< TScalar >::fieldScalar | ( | TScalar | epsPrecision, | |
std::string | s | |||
) | [inline] |
constructs a fieldScalar, epsPrecision is ignored and assumed =0
Definition at line 405 of file basicNumber.cpp.
fieldScalar< TScalar >::fieldScalar | ( | const fieldScalar< TScalar > & | z | ) | [inline] |
Definition at line 446 of file basicNumber.cpp.
TScalar fieldScalar< TScalar >::getEps | ( | ) | const [inline] |
implementation only for compatibility
Definition at line 483 of file basicNumber.cpp.
short fieldScalar< TScalar >::getEpsDegree | ( | ) | const [inline] |
Definition at line 464 of file basicNumber.cpp.
References fieldScalar< TScalar >::getX().
unsigned short fieldScalar< TScalar >::getEpsPrecision | ( | ) | const [inline] |
-Properties------------------------------------------------- returns maximum possible epsPrecision
Definition at line 458 of file basicNumber.cpp.
size_t fieldScalar< TScalar >::getMaxPairIndex | ( | const TScalar | characteristic | ) | [inline, static] |
Definition at line 656 of file basicNumber.cpp.
size_t fieldScalar< TScalar >::getMaxSingleIndex | ( | const TScalar | characteristic | ) | [inline, static] |
Definition at line 650 of file basicNumber.cpp.
size_t fieldScalar< TScalar >::getPairIndex | ( | const fieldScalar< TScalar > | a, | |
const fieldScalar< TScalar > | b, | |||
const TScalar | characteristic | |||
) | [inline, static] |
Definition at line 603 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
size_t fieldScalar< TScalar >::getPairIndexByRef | ( | const fieldScalar< TScalar > & | a, | |
const fieldScalar< TScalar > & | b, | |||
const TScalar & | characteristic | |||
) | [inline, static] |
Definition at line 612 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
size_t fieldScalar< TScalar >::getSingleIndex | ( | const fieldScalar< TScalar > | b | ) | [inline, static] |
Definition at line 636 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
size_t fieldScalar< TScalar >::getSingleIndex | ( | const fieldScalar< TScalar > | b, | |
const TScalar | characteristic | |||
) | [inline, static] |
Definition at line 621 of file basicNumber.cpp.
size_t fieldScalar< TScalar >::getSingleIndexByRef | ( | const fieldScalar< TScalar > & | b | ) | [inline, static] |
Definition at line 643 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
size_t fieldScalar< TScalar >::getSingleIndexByRef | ( | const fieldScalar< TScalar > & | b, | |
const TScalar & | characteristic | |||
) | [inline, static] |
Definition at line 629 of file basicNumber.cpp.
TScalar fieldScalar< TScalar >::getValue | ( | TScalar | epsPrecision | ) | const [inline] |
Definition at line 517 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
TScalar fieldScalar< TScalar >::getX | ( | ) | const [inline] |
Definition at line 475 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
Referenced by fieldScalar< TScalar >::getEpsDegree(), and fieldScalar< TScalar >::printMultSecure().
bool fieldScalar< TScalar >::isNotZero | ( | ) | const [inline] |
Definition at line 549 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
bool fieldScalar< TScalar >::isZero | ( | ) | const [inline] |
Definition at line 542 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
static bool fieldScalar< TScalar >::memsetClearAllowed | ( | ) | [inline, static] |
Definition at line 228 of file basicNumber.h.
int fieldScalar< TScalar >::nearlyEqual | ( | const fieldScalar< TScalar > | z | ) | const [inline] |
nearlyEqual-comparison; ignores EPS components.
Definition at line 583 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
fieldScalar< TScalar >::operator int | ( | ) | [inline] |
Definition at line 208 of file basicNumber.h.
References fieldScalar< TScalar >::x.
bool fieldScalar< TScalar >::operator!= | ( | const fieldScalar< TScalar > | z | ) | const [inline] |
Definition at line 575 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
bool fieldScalar< TScalar >::operator== | ( | const fieldScalar< TScalar > | z | ) | const [inline] |
Definition at line 569 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
TScalar & fieldScalar< TScalar >::operator[] | ( | int | i | ) | [inline] |
Definition at line 526 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
void fieldScalar< TScalar >::printMultSecure | ( | std::ostream & | os | ) | const [inline] |
Definition at line 590 of file basicNumber.cpp.
References fieldScalar< TScalar >::getX().
void fieldScalar< TScalar >::setEps | ( | TScalar | _eps | ) | [inline] |
Definition at line 497 of file basicNumber.cpp.
void fieldScalar< TScalar >::setValue | ( | TScalar | epsPrecision, | |
TScalar | coeff | |||
) | [inline] |
set coeff of e^epsPrecision to 'coeff'. TODO: error checking
Definition at line 507 of file basicNumber.cpp.
References fieldScalar< TScalar >::setX().
void fieldScalar< TScalar >::setX | ( | TScalar | xxx | ) | [inline] |
Definition at line 490 of file basicNumber.cpp.
References fieldScalar< TScalar >::x.
Referenced by fieldScalar< TScalar >::setValue().
bool fieldScalar< TScalar >::wellDefined | ( | unsigned int | characteristic | ) | [inline, static] |
in the case, that TScalar is signed, sizeof(TScalar) must be one bit greater than nessesary to store positive field element representatives {0...characterristic-1}
Definition at line 418 of file basicNumber.cpp.
References make::test().
const fieldScalar< TScalar > fieldScalar< TScalar >::One = fieldScalar<TScalar>(1) [inline, static] |
Definition at line 223 of file basicNumber.h.
TScalar fieldScalar< TScalar >::x [protected] |
Definition at line 205 of file basicNumber.h.
Referenced by fieldScalar< TScalar >::fieldScalar(), fieldScalar< TScalar >::getPairIndex(), fieldScalar< TScalar >::getPairIndexByRef(), fieldScalar< TScalar >::getSingleIndex(), fieldScalar< TScalar >::getSingleIndexByRef(), fieldScalar< TScalar >::getValue(), fieldScalar< TScalar >::getX(), fieldScalar< TScalar >::isNotZero(), fieldScalar< TScalar >::isZero(), fieldScalar< TScalar >::nearlyEqual(), fieldScalar< TScalar >::operator int(), fieldScalar< TScalar >::operator!=(), fieldScalar< TScalar >::operator==(), fieldScalar< TScalar >::operator[](), and fieldScalar< TScalar >::setX().
const fieldScalar< TScalar > fieldScalar< TScalar >::Zero = fieldScalar<TScalar>(0) [inline, static] |
Definition at line 220 of file basicNumber.h.