Next Previous Table of Contents

The ResidueClass Class

#include <linteger/residue.hxx>

Overview

The goal of the ResidueClass class is to provide support for arithmetic in rings of residue classes containing multiplicative identities. A ring is set by the user, and arithmetic involving residue classes then takes place inside this ring until it is changed. Currently, only enough functionality is provided to allow an instantiation of the LC_Exp function.

Public Methods

Default Constructor

ResidueClass::ResidueClass();
This constructor creates a NULL instance, which represent no residue class in the current residue ring. Be sure to assign a proper value to this instance before using it.

Constructor from an LInteger

ResidueClass::ResidueClass(const LInteger& x);
This constructor creates an instance representing the residue class within the current ring that contains the integer that x represents.

Copy Constructor

ResidueClass::ResidueClass(const ResidueClass& x);
The copy constructor creates an instance representing the same residue class that x represents.

Destructor

ResidueClass::~ResidueClass();
Nothing special is done by the destructor.

Assignment from a ResidueClass

inline ResidueClass& ResidueClass::operator=(const ResidueClass& x); 
This assignment makes the calling instance represent the same residue class that x represents. A reference to the modified calling instance is returned.

MultiplicativeIdentity

static inline ResidueClass ResidueClass::MultiplicativeIdentity(); 
This method returns an instance representing the residue class which is the multiplicative identity of the current residue ring.

Ring

static inline const LInteger& ResidueClass::Ring(); 
This method return an LInteger representing an integer, x, which is equal to the number of elements in the current residue ring. That is to say, arithmetic is taking place mod x.

SetRing

static inline LInteger ResidueClass::SetRing(const LInteger& x); 
This method sets the residue ring in which arithmetic is to take place. The residue ring will be the one with a number of elements equal to the integer that x represents. That is to say, arithmetic will take place mod x. In order to ensure that the residue ring will have a multiplicative identity, x must be positive. An LInteger representing the cardinality of the ring arithmetic was to take place in before the call is returned.

Times Equals: y*=x

inline ResidueClass& operator*=(const ResidueClass& x); 
This operator makes the calling instance represent the product (in the current residue ring) of the residue class it represented before the call and the residue class that x represents. A reference to the modified calling instance is returned.

Square

inline ResidueClass& ResidueClass::Square(); 
This method makes the calling instance represent the square (in the current residue ring) of residue class it represented before the call, and returns a reference to the modified calling instance.

ToLInteger

inline LInteger ResidueClass::ToLInteger(); 
This method returns an LIntger which represents the principal residue in the residue class that the calling instance represents. That is to say, that if the current residue ring has x elements, then this method will return the member of the residue class that the calling instance represents that is greater than or equal to 0, but less than x.
Next Previous Table of Contents