atlas  0.6
Public Member Functions | Private Attributes | List of all 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 <Atlas.h>

Public Member Functions

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

Private Attributes

d_exp [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_exp[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|.

Constructor & Destructor Documentation

template<typename C >
atlas::size::SizeType< C >::SizeType ( )
inline
template<typename C >
atlas::size::SizeType< C >::SizeType ( unsigned long  a)
explicit

Synopsis: constructs the SizeType object representing value |a|.

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

Member Function Documentation

template<typename C >
bool atlas::size::SizeType< C >::operator!= ( const SizeType< C > &  c) const
inline
template<typename C >
SizeType< C > & atlas::size::SizeType< C >::operator*= ( const SizeType< C > &  a)

NOTE: multiplication becomes addition in our logarithmic representation.

template<typename C >
SizeType& atlas::size::SizeType< C >::operator*= ( unsigned long  n)
inline
template<typename C >
SizeType< C > & atlas::size::SizeType< C >::operator/= ( const SizeType< C > &  a)

NOTE: division becomes subtraction in our logarithmic representation.

template<typename C >
bool atlas::size::SizeType< C >::operator== ( const SizeType< C > &  c) const
inline
template<typename C >
C atlas::size::SizeType< C >::operator[] ( size_t  j) const
inline
template<typename C >
C& atlas::size::SizeType< C >::operator[] ( size_t  j)
inline
template<typename C >
unsigned long atlas::size::SizeType< C >::piece ( size_t  k) const

Synopsis: return the unsigned long value of $prime(i)^{d_exp[i]}$

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

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

template<typename C >
void atlas::size::SizeType< C >::reset ( )
inline
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}$.

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

Member Data Documentation

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

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