#include <linteger/montyrep.hxx>
Warning: The residue ring
that computations involving MontRep
instances are to
take place in
is completely independent of the residue ring that computations
involving ResidueClass
instances
are to take place in. To
emphasize this fact, the ring in which computations involving Montgomery
representations are to take place in will be refered to as the "Montgomery
residue ring".
MontyRep::MontyRep();This constructor creates a NULL instance, which represent no residue class in the current Montgomery residue ring. Be sure to assign a proper value to this instance before using it.
LInteger
MontyRep::MontyRep(const LInteger& x);This constructor creates an instance representing the residue class within the current Montgomery residue ring that contains the integer that x represents.
MontyRep::MontyRep(const MontyRep& x);The copy constructor creates an instance representing the same residue class that x represents.
MontyRep::~MontyRep();The destructor deletes memory dynamically allocated to the instance.
MontyRep
MontyRep& MontyRep::operator=(const MontyRep& x);This assignment makes the calling instance represent the same residue class that x represents. A reference to the modified calling instance is returned.
static inline MontyRep MontyRep::MultiplicativeIdentity();This method returns an instance representing the residue class which is the multiplicative identity of the current Montgomery residue ring.
static inline const MontyRing& MontyRep::Ring();This method returns a
MontyRing
that contains precomputation
information for the residue ring in which arithmetic involving Montgomery
representations is to take place.
static MontyRing MontyRep::SetRing(const MontyRing& newRing);This method sets the residue ring in which arithmetic involving Montgomery representations is to take place equal to the ring that newRing represents. A
MontyRing
representing the ring that arithmetic involving Montgomery
representations was previously taking place in is returned.
y*=x
MontyRep& operator*=(const MontyRep& x);This operator makes the calling instance represent the product (in the current Montgomery 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.
MontyRep& MontyRep::Square();This method makes the calling instance represent the square (in the current Montgomery residue ring) of residue class it represented before the call, and returns a reference to the modified calling instance.
LInteger MontyRep::ToLInteger();This method returns an
LInteger
representing
the principal residue in
the residue class that the calling instance represents. That is
to say, that if the current Montgomery 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.