fieldScalar< TScalar > Class Template Reference

class representing elements of F_q.
Limitation: field element representatives assumed as positive and only values between {0...characterristic-1} More...

#include <basicNumber.h>

Collaboration diagram for fieldScalar< TScalar >:
Collaboration graph
[legend]

List of all members.

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)

Detailed Description

template<typename TScalar>
class fieldScalar< TScalar >

Todo:
bei zusammengesetzten Typen bei getX() und getEPS keinen primitiven Datentyp zurueckliefern, sondern einen mit Memberfunktionen wie z.B. isZero.
Todo:
wenn eine Initialisierung von TNum unter Umgehung des Rings geschehen soll, muss das über einen expliziten Konstruktor-Aufruf erfolgen, der Fehlerfreiheit zuliebe!

Definition at line 200 of file basicNumber.h.


Member Typedef Documentation

template<typename TScalar>
typedef TScalar fieldScalar< TScalar >::scalarType

Definition at line 217 of file basicNumber.h.


Constructor & Destructor Documentation

template<typename TScalar >
fieldScalar< TScalar >::fieldScalar ( std::stringstream &  sstream  )  [inline]

Definition at line 389 of file basicNumber.cpp.

References fieldScalar< TScalar >::x.

template<typename TScalar >
fieldScalar< TScalar >::fieldScalar (  )  [inline]

Definition at line 385 of file basicNumber.cpp.

template<typename TScalar >
fieldScalar< TScalar >::fieldScalar ( TScalar  s  )  [inline]

constructs afieldScalar {s }

Definition at line 400 of file basicNumber.cpp.

template<typename TScalar >
fieldScalar< TScalar >::fieldScalar ( TScalar  s,
TScalar  eps 
) [inline]

Definition at line 452 of file basicNumber.cpp.

template<typename TScalar >
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.

template<typename TScalar >
fieldScalar< TScalar >::fieldScalar ( const fieldScalar< TScalar > &  z  )  [inline]

Definition at line 446 of file basicNumber.cpp.


Member Function Documentation

template<typename TScalar >
TScalar fieldScalar< TScalar >::getEps (  )  const [inline]

implementation only for compatibility

Definition at line 483 of file basicNumber.cpp.

template<typename TScalar >
short fieldScalar< TScalar >::getEpsDegree (  )  const [inline]

Definition at line 464 of file basicNumber.cpp.

References fieldScalar< TScalar >::getX().

Here is the call graph for this function:

template<typename TScalar >
unsigned short fieldScalar< TScalar >::getEpsPrecision (  )  const [inline]

-Properties------------------------------------------------- returns maximum possible epsPrecision

Definition at line 458 of file basicNumber.cpp.

template<typename TScalar >
size_t fieldScalar< TScalar >::getMaxPairIndex ( const TScalar  characteristic  )  [inline, static]

Definition at line 656 of file basicNumber.cpp.

template<typename TScalar >
size_t fieldScalar< TScalar >::getMaxSingleIndex ( const TScalar  characteristic  )  [inline, static]

Definition at line 650 of file basicNumber.cpp.

template<typename TScalar >
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.

template<typename TScalar >
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.

template<typename TScalar >
size_t fieldScalar< TScalar >::getSingleIndex ( const fieldScalar< TScalar >  b  )  [inline, static]

Definition at line 636 of file basicNumber.cpp.

References fieldScalar< TScalar >::x.

template<typename TScalar >
size_t fieldScalar< TScalar >::getSingleIndex ( const fieldScalar< TScalar >  b,
const TScalar  characteristic 
) [inline, static]
Todo:
const Correctness

Definition at line 621 of file basicNumber.cpp.

template<typename TScalar >
size_t fieldScalar< TScalar >::getSingleIndexByRef ( const fieldScalar< TScalar > &  b  )  [inline, static]

Definition at line 643 of file basicNumber.cpp.

References fieldScalar< TScalar >::x.

template<typename TScalar >
size_t fieldScalar< TScalar >::getSingleIndexByRef ( const fieldScalar< TScalar > &  b,
const TScalar &  characteristic 
) [inline, static]

Definition at line 629 of file basicNumber.cpp.

template<typename TScalar >
TScalar fieldScalar< TScalar >::getValue ( TScalar  epsPrecision  )  const [inline]

Definition at line 517 of file basicNumber.cpp.

References fieldScalar< TScalar >::x.

template<typename TScalar >
TScalar fieldScalar< TScalar >::getX (  )  const [inline]
template<typename TScalar >
bool fieldScalar< TScalar >::isNotZero (  )  const [inline]

Definition at line 549 of file basicNumber.cpp.

References fieldScalar< TScalar >::x.

template<typename TScalar >
bool fieldScalar< TScalar >::isZero (  )  const [inline]

Definition at line 542 of file basicNumber.cpp.

References fieldScalar< TScalar >::x.

template<typename TScalar>
static bool fieldScalar< TScalar >::memsetClearAllowed (  )  [inline, static]

Definition at line 228 of file basicNumber.h.

template<typename TScalar >
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.

template<typename TScalar>
fieldScalar< TScalar >::operator int (  )  [inline]

Definition at line 208 of file basicNumber.h.

References fieldScalar< TScalar >::x.

template<typename TScalar >
bool fieldScalar< TScalar >::operator!= ( const fieldScalar< TScalar >  z  )  const [inline]

Definition at line 575 of file basicNumber.cpp.

References fieldScalar< TScalar >::x.

template<typename TScalar >
bool fieldScalar< TScalar >::operator== ( const fieldScalar< TScalar >  z  )  const [inline]
Todo:
wo zum Teufel hast du diesen Operator eingesetzt? Todo: testen, ob nicht aus Versehen zwei 'fieldScalar'-Objekte unbedarft addiert werden können.

Definition at line 569 of file basicNumber.cpp.

References fieldScalar< TScalar >::x.

template<typename TScalar >
TScalar & fieldScalar< TScalar >::operator[] ( int  i  )  [inline]

Definition at line 526 of file basicNumber.cpp.

References fieldScalar< TScalar >::x.

template<typename TScalar >
void fieldScalar< TScalar >::printMultSecure ( std::ostream &  os  )  const [inline]

Definition at line 590 of file basicNumber.cpp.

References fieldScalar< TScalar >::getX().

Here is the call graph for this function:

template<typename TScalar >
void fieldScalar< TScalar >::setEps ( TScalar  _eps  )  [inline]

Definition at line 497 of file basicNumber.cpp.

template<typename TScalar >
void fieldScalar< TScalar >::setValue ( TScalar  epsPrecision,
TScalar  coeff 
) [inline]

set coeff of e^epsPrecision to 'coeff'. TODO: error checking

Todo:
setValue-Operation nur über den Körper/ Ring laufen lassen?

Definition at line 507 of file basicNumber.cpp.

References fieldScalar< TScalar >::setX().

Here is the call graph for this function:

template<typename TScalar >
void fieldScalar< TScalar >::setX ( TScalar  xxx  )  [inline]

Definition at line 490 of file basicNumber.cpp.

References fieldScalar< TScalar >::x.

Referenced by fieldScalar< TScalar >::setValue().

template<typename TScalar >
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}

Todo:
Note:
pow call is constructed to be compilable with gcc 3.x

Definition at line 418 of file basicNumber.cpp.

References make::test().

Here is the call graph for this function:


Member Data Documentation

template<typename TScalar>
const fieldScalar< TScalar > fieldScalar< TScalar >::One = fieldScalar<TScalar>(1) [inline, static]

Definition at line 223 of file basicNumber.h.

template<typename TScalar>
TScalar fieldScalar< TScalar >::x [protected]
template<typename TScalar>
const fieldScalar< TScalar > fieldScalar< TScalar >::Zero = fieldScalar<TScalar>(0) [inline, static]

Definition at line 220 of file basicNumber.h.


The documentation for this class was generated from the following files:
Generated on Tue Nov 23 13:10:53 2010 for centerfocus by  doxygen 1.6.3