Fabcoin Core  0.16.2
P2P Digital Currency
Public Types | Public Member Functions | List of all members
AbstractGroup< T > Class Template Referenceabstract

Abstract group. More...

#include <algebra.h>

Inheritance diagram for AbstractGroup< T >:
[legend]

Public Types

typedef T Element
 

Public Member Functions

virtual ~AbstractGroup ()
 
virtual bool Equal (const Element &a, const Element &b) const =0
 Compare two elements for equality. More...
 
virtual const ElementIdentity () const =0
 Provides the Identity element. More...
 
virtual const ElementAdd (const Element &a, const Element &b) const =0
 Adds elements in the group. More...
 
virtual const ElementInverse (const Element &a) const =0
 Inverts the element in the group. More...
 
virtual bool InversionIsFast () const
 Determine if inversion is fast. More...
 
virtual const ElementDouble (const Element &a) const
 Doubles an element in the group. More...
 
virtual const ElementSubtract (const Element &a, const Element &b) const
 Subtracts elements in the group. More...
 
virtual ElementAccumulate (Element &a, const Element &b) const
 TODO. More...
 
virtual ElementReduce (Element &a, const Element &b) const
 Reduces an element in the congruence class. More...
 
virtual Element ScalarMultiply (const Element &a, const Integer &e) const
 Performs a scalar multiplication. More...
 
virtual Element CascadeScalarMultiply (const Element &x, const Integer &e1, const Element &y, const Integer &e2) const
 TODO. More...
 
virtual void SimultaneousMultiply (Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const
 Multiplies a base to multiple exponents in a group. More...
 

Detailed Description

template<class T>
class AbstractGroup< T >

Abstract group.

Template Parameters
Telement class or type

const Element& returned by member functions are references to internal data members. Since each object may have only one such data member for holding results, the following code will produce incorrect results:

    abcd = group.Add(group.Add(a,b), group.Add(c,d));

But this should be fine:

    abcd = group.Add(a, group.Add(b, group.Add(c,d));

Definition at line 26 of file algebra.h.

Member Typedef Documentation

template<class T>
typedef T AbstractGroup< T >::Element

Definition at line 29 of file algebra.h.

Constructor & Destructor Documentation

template<class T>
virtual AbstractGroup< T >::~AbstractGroup ( )
inlinevirtual

Definition at line 31 of file algebra.h.

Member Function Documentation

template<class T >
T & AbstractGroup< T >::Accumulate ( Element a,
const Element b 
) const
virtual

TODO.

Parameters
afirst element
bsecond element
Returns
TODO

Reimplemented in QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, AbstractRing< T >::MultiplicativeGroupT, ModularArithmetic, and GFP2_ONB< F >.

Definition at line 27 of file algebra.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
virtual const Element& AbstractGroup< T >::Add ( const Element a,
const Element b 
) const
pure virtual
template<class T >
T AbstractGroup< T >::CascadeScalarMultiply ( const Element x,
const Integer e1,
const Element y,
const Integer e2 
) const
virtual

TODO.

Parameters
xfirst multiplicand
e1the first multiplier
ysecond multiplicand
e2the second multiplier
Returns
TODO

Reimplemented in AbstractRing< T >::MultiplicativeGroupT, and ECP.

Definition at line 97 of file algebra.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
const T & AbstractGroup< T >::Double ( const Element a) const
virtual

Doubles an element in the group.

Parameters
athe element
Returns
the element doubled

Reimplemented in QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, AbstractRing< T >::MultiplicativeGroupT, ModularArithmetic, GFP2_ONB< F >, ECP, and EC2N.

Definition at line 15 of file algebra.cpp.

Here is the call graph for this function:

template<class T>
virtual bool AbstractGroup< T >::Equal ( const Element a,
const Element b 
) const
pure virtual

Compare two elements for equality.

Parameters
afirst element
bsecond element
Returns
true if the elements are equal, false otherwise

Equal() tests the elements for equality using a==b

Implemented in QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, GF2NP, AbstractRing< T >::MultiplicativeGroupT, ModularArithmetic, GFP2_ONB< F >, ECP, and EC2N.

template<class T>
virtual const Element& AbstractGroup< T >::Identity ( ) const
pure virtual
template<class T>
virtual const Element& AbstractGroup< T >::Inverse ( const Element a) const
pure virtual

Inverts the element in the group.

Parameters
afirst element
Returns
the inverse of the element

Implemented in QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, AbstractRing< T >::MultiplicativeGroupT, ModularArithmetic, GFP2_ONB< F >, ECP, and EC2N.

Here is the caller graph for this function:

template<class T>
virtual bool AbstractGroup< T >::InversionIsFast ( ) const
inlinevirtual

Determine if inversion is fast.

Returns
true if inversion is fast, false otherwise

Reimplemented in ECP, and EC2N.

Definition at line 57 of file algebra.h.

Here is the caller graph for this function:

template<class T >
T & AbstractGroup< T >::Reduce ( Element a,
const Element b 
) const
virtual

Reduces an element in the congruence class.

Parameters
aelement to reduce
bthe congruence class
Returns
the reduced element

Reimplemented in QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, AbstractRing< T >::MultiplicativeGroupT, ModularArithmetic, and GFP2_ONB< F >.

Definition at line 32 of file algebra.cpp.

Here is the call graph for this function:

template<class T >
T AbstractGroup< T >::ScalarMultiply ( const Element a,
const Integer e 
) const
virtual

Performs a scalar multiplication.

Parameters
amultiplicand
emultiplier
Returns
the product

Reimplemented in AbstractRing< T >::MultiplicativeGroupT, and ECP.

Definition at line 90 of file algebra.cpp.

Here is the caller graph for this function:

template<class T >
void AbstractGroup< T >::SimultaneousMultiply ( Element results,
const Element base,
const Integer exponents,
unsigned int  exponentsCount 
) const
virtual

Multiplies a base to multiple exponents in a group.

Parameters
resultsan array of Elements
basethe base to raise to the exponents
exponentsan array of exponents
exponentsCountthe number of exponents in the array

SimultaneousMultiply() multiplies the base to each exponent in the exponents array and stores the result at the respective position in the results array.

SimultaneousMultiply() must be implemented in a derived class.

Precondition
COUNTOF(results) == exponentsCount
COUNTOF(exponents) == exponentsCount

Reimplemented in AbstractRing< T >::MultiplicativeGroupT, and ECP.

Definition at line 256 of file algebra.cpp.

Here is the call graph for this function:

template<class T >
const T & AbstractGroup< T >::Subtract ( const Element a,
const Element b 
) const
virtual

Subtracts elements in the group.

Parameters
afirst element
bsecond element
Returns
the difference of a and b. The element a must provide a Subtract member function.

Reimplemented in QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, AbstractRing< T >::MultiplicativeGroupT, ModularArithmetic, and GFP2_ONB< F >.

Definition at line 20 of file algebra.cpp.

Here is the call graph for this function:


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