Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

atlas::arithmetic Namespace Reference


Functions

unsigned long gcd (unsigned long a, unsigned long b)
unsigned long lcm (unsigned long a, unsigned long b)
unsigned long & modProd (unsigned long &a, unsigned long b, unsigned long n)
unsigned long & modAdd (unsigned long &, unsigned long, unsigned long)
template<typename C>
unsigned long remainder (C, unsigned long)
unsigned long gcd (long a, unsigned long b)


Function Documentation

unsigned long gcd long  a,
unsigned long  b
[inline]
 

Definition at line 39 of file arithmetic.h.

Referenced by atlas::interpreter::annihilator_modulo(), atlas::abelian::cycGenerators(), gcd(), lcm(), atlas::makeOrthogonal(), atlas::abelian::FiniteAbelianGroup::order(), atlas::filekl::scan_polynomials(), atlas::abelian::transpose(), and atlas::updateCycGenerator().

unsigned long atlas::arithmetic::gcd unsigned long  a,
unsigned long  b
 

Synopsis: the classic Euclidian algorithm. It is assumed that

Precondition: b > 0;

Definition at line 30 of file arithmetic.cpp.

References gcd().

unsigned long atlas::arithmetic::lcm unsigned long  a,
unsigned long  b
 

Synopsis: returns the lowest common multiple of a and b.

Precondition: b > 0;

Definition at line 57 of file arithmetic.cpp.

References gcd().

Referenced by atlas::checkGenerator(), do_work(), atlas::abelian::Homomorphism::Homomorphism(), atlas::abelian::FiniteAbelianGroup::order(), atlas::interpreter::quotient_basis_wrapper(), and atlas::lattice::toCommonDenominator().

unsigned long & atlas::arithmetic::modAdd unsigned long &  ,
unsigned  long,
unsigned  long
[inline]
 

Definition at line 46 of file arithmetic.h.

Referenced by atlas::abelian::FiniteAbelianGroup::leftApply().

unsigned long & atlas::arithmetic::modProd unsigned long &  a,
unsigned long  b,
unsigned long  n
 

Synopsis: a *= b mod n.

Precondition: a < n; b < n.

NOTE: preliminary implementation. It assumes that n <= 2^^(longBits/2). Will exit brutally if this is not fulfilled.

Definition at line 70 of file arithmetic.cpp.

Referenced by atlas::abelian::FiniteAbelianGroup::leftApply().

template<typename C>
unsigned long atlas::arithmetic::remainder a,
unsigned long  m
 

Synopsis: returns the remainder of the division of c modulo m.

The point is to always return the unique number r in [0,m[ such that a = q.m + r for a (unique) q. The difficulty arises when C is a signed type; if we are not careful the sign conversions will mess things up big time.

NOTE: this looks rather clumsy but I didn't see a better way. It is not always true that for a < 0 one should return m - (-a m); this fails iff a is divisible by m.

Definition at line 16 of file arithmetic_def.h.

Referenced by test(), atlas::abelian::toArray(), and atlas::abelian::toEndomorphism().


Generated on Wed Mar 26 16:52:18 2008 for atlas by  doxygen 1.3.9.1