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

atlas::size::SizeType< C > Class Template Reference

Stores a positive integer as product of prime powers, using the first PRIMES_MAX primes. More...

#include <size.h>

Collaboration diagram for atlas::size::SizeType< C >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SizeType ()
 SizeType (unsigned long)
 ~SizeType ()
 SizeType (const SizeType &a)
SizeTypeoperator= (const SizeType &a)
operator[] (size_t j) const
bool operator== (const SizeType &c) const
bool operator!= (const SizeType &c) const
bool hasOverflow () const
bool hasOverflow (size_t) const
unsigned long piece (size_t) const
unsigned long toUlong () const
C & operator[] (size_t j)
SizeTypeoperator *= (const SizeType &)
SizeTypeoperator *= (unsigned long)
SizeTypeoperator/= (const SizeType &)
void reset ()
void twoShift (C n)

Private Attributes

d_data [PRIMES_MAX]

Detailed Description

template<typename C>
class atlas::size::SizeType< C >

Stores a positive integer as product of prime powers, using the first PRIMES_MAX primes.

The exponent of the jth prime is d_data[j]. The reason for using this is that the software must occasionally deal with integers too large to be unsigned long; mostly these appear as cardinalities of Weyl groups. The constant PRIMES_MAX is chosen so that the cardinality of any Weyl group of rank at most RANK_MAX can be represented as a SizeType. (Note from DV: when RANK_MAX is 16, it appears to me that the largest possible prime factor of a Weyl group order is the sixth prime 13, so one should for elegance choose PRIMES_MAX=6. The constant used above in that case is PRIMES_MAX=7. But taking PRIMES_MAX too large is harmless.)

Definition at line 136 of file size.h.


Constructor & Destructor Documentation

template<typename C>
atlas::size::SizeType< C >::SizeType  )  [inline]
 

Definition at line 143 of file size.h.

template<typename C>
atlas::size::SizeType< C >::SizeType unsigned long  a  )  [explicit]
 

Synopsis: constructs the SizeType object representing a.

Triggers a fatal error if a is not representable as a SizeType

Definition at line 31 of file size_def.h.

References atlas::size::SizeType< C >::d_data, atlas::size::prime(), atlas::size::PRIMES_MAX, and atlas::error::PrimesError.

template<typename C>
atlas::size::SizeType< C >::~SizeType  )  [inline]
 

Definition at line 149 of file size.h.

template<typename C>
atlas::size::SizeType< C >::SizeType const SizeType< C > &  a  )  [inline]
 

Definition at line 153 of file size.h.


Member Function Documentation

template<typename C>
bool atlas::size::SizeType< C >::hasOverflow size_t   )  const
 

template<typename C>
bool atlas::size::SizeType< C >::hasOverflow  )  const
 

template<typename C>
SizeType< C > & atlas::size::SizeType< C >::operator *= unsigned long  a  ) 
 

Synopsis: current *= SizeType(a).

Precondition: a is representable as a SizeType.

Definition at line 129 of file size_def.h.

References atlas::size::SizeType< C >::d_data, and atlas::size::prime().

template<typename C>
SizeType< C > & atlas::size::SizeType< C >::operator *= const SizeType< C > &  a  ) 
 

NOTE: multiplication becomes addition in our logarithmic representation.

NOTE: we explicitly convert to long to avoid compiler warnings.

Definition at line 111 of file size_def.h.

References atlas::size::SizeType< C >::d_data.

template<typename C>
bool atlas::size::SizeType< C >::operator!= const SizeType< C > &  c  )  const [inline]
 

Definition at line 170 of file size.h.

template<typename C>
SizeType< C > & atlas::size::SizeType< C >::operator/= const SizeType< C > &  a  ) 
 

NOTE: division becomes subtraction in our logarithmic representation.

Definition at line 148 of file size_def.h.

References atlas::size::SizeType< C >::d_data.

template<typename C>
SizeType& atlas::size::SizeType< C >::operator= const SizeType< C > &  a  )  [inline]
 

Definition at line 157 of file size.h.

template<typename C>
bool atlas::size::SizeType< C >::operator== const SizeType< C > &  c  )  const [inline]
 

Definition at line 166 of file size.h.

template<typename C>
C& atlas::size::SizeType< C >::operator[] size_t  j  )  [inline]
 

Definition at line 183 of file size.h.

template<typename C>
C atlas::size::SizeType< C >::operator[] size_t  j  )  const [inline]
 

Definition at line 162 of file size.h.

template<typename C>
unsigned long atlas::size::SizeType< C >::piece size_t  j  )  const
 

Synopsis: return the unsigned long value of prime(j)^^d_data[j]

The algorithm is the classical algorithm with squarings and multiplications, logarithmic in j.

NOTE: in case of overflow, we simply return the value modulo 2^^longBits.

Definition at line 60 of file size_def.h.

References atlas::size::prime().

Referenced by atlas::size::SizeType< C >::toUlong().

template<typename C>
void atlas::size::SizeType< C >::reset  )  [inline]
 

Definition at line 193 of file size.h.

Referenced by atlas::realweyl::blockStabilizerSize(), atlas::realweyl::dualRealWeylSize(), atlas::size::factorial(), atlas::realweyl::realWeylSize(), and atlas::weylsize::weylSize().

template<typename C>
unsigned long atlas::size::SizeType< C >::toUlong  )  const
 

Synopsis: returns the unsigned long value of *this.

NOTE: in case of overflow, we simply return the value modulo 2^^longBits.

Definition at line 91 of file size_def.h.

References atlas::size::SizeType< C >::piece().

Referenced by atlas::cartanclass::CartanClass::orbitSize().

template<typename C>
void atlas::size::SizeType< C >::twoShift n  )  [inline]
 

Definition at line 197 of file size.h.

Referenced by atlas::realweyl::blockStabilizerSize(), atlas::realweyl::dualRealWeylSize(), and atlas::realweyl::realWeylSize().


Member Data Documentation

template<typename C>
C atlas::size::SizeType< C >::d_data[PRIMES_MAX] [private]
 

Definition at line 139 of file size.h.

Referenced by atlas::size::SizeType< C >::operator *=(), atlas::size::SizeType< BaseType >::operator!=(), atlas::size::SizeType< C >::operator/=(), atlas::size::SizeType< BaseType >::operator=(), atlas::size::SizeType< BaseType >::operator==(), atlas::size::SizeType< C >::SizeType(), and atlas::size::SizeType< BaseType >::SizeType().


The documentation for this class was generated from the following files:
Generated on Wed Mar 26 16:53:05 2008 for atlas by  doxygen 1.3.9.1