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

atlas::partition::Partition Class Reference

Partition of some set [0,n[ into classes. More...

#include <partition.h>

List of all members.

Public Types

typedef unsigned long argument_type
 Required to make Partition an adaptable unary function object.
typedef unsigned long result_type
 Required to make Partition an adaptable unary function object.

Public Member Functions

 Partition ()
 Partition (unsigned long n)
 The trivial partition of [0,n[ into a single class.
 Partition (std::vector< unsigned long > &)
 Constructs a partition from the class vector f.
 Partition (std::vector< unsigned long > &, tags::UnnormalizedTag)
 Like the previous one, but uses the actual values of f to number the classes.
 ~Partition ()
void swap (Partition &)
unsigned long operator() (unsigned long j) const
bool operator== (const Partition &other) const
unsigned long classCount () const
 Returns the number of classes in the partition.
unsigned long classRep (unsigned long c) const
 Returns the number of an element belong to class # c.
unsigned long classSize (unsigned long) const
 Counts the number of elements in class #c.
unsigned long size () const
 Number of elements of the underlying set of the partition.
void addToClass (unsigned long c, unsigned long j)
 Adds value j to class #c.
void clear ()
 Clears all entries of d_classRep.
void newClass (unsigned long c)
 Starts a new class at location j.
void resize (unsigned long n)
 Resizes the class to be a partition of [0,n[.

Private Attributes

std::vector< unsigned long > d_class
 The number d_class[j] labels the class containing the value j.
std::vector< unsigned long > d_classRep
 The value d_classRep[i] is some element of class #i.


Detailed Description

Partition of some set [0,n[ into classes.

The partition is represented by a vector d_class of n unsigned longs, mapping values to a number in [0,s[ characterizing the class (where s is the number of classes), and by a vector d_classRep of s unsigned longs that inversely gives a representative element for each class.

The class is equipped with members allowing it to be used as an unary function object ; this objects behaves as the map d_class.

Main application is to the Fiber class: in that case n=2^m, with m at most RANK_MAX; then elements of [0,n[ are interpreted as elements of a vector space (Z/2Z)^m. Typical partitions are into the orbits of a Weyl group acting on this vector space (such partitions are computed by makeOrbits).

Definition at line 69 of file partition.h.


Member Typedef Documentation

typedef unsigned long atlas::partition::Partition::argument_type
 

Required to make Partition an adaptable unary function object.

Alternatively we could have got this by deriving the Parition class from std::unary_function<unsigned long,unsigned long>

Definition at line 93 of file partition.h.

typedef unsigned long atlas::partition::Partition::result_type
 

Required to make Partition an adaptable unary function object.

Alternatively we could have got this by deriving the Parition class from std::unary_function<unsigned long,unsigned long>

Definition at line 101 of file partition.h.


Constructor & Destructor Documentation

atlas::partition::Partition::Partition  )  [inline]
 

Definition at line 104 of file partition.h.

atlas::partition::Partition::Partition unsigned long  n  )  [inline, explicit]
 

The trivial partition of [0,n[ into a single class.

Definition at line 109 of file partition.h.

atlas::partition::Partition::Partition std::vector< unsigned long > &  f  )  [explicit]
 

Constructs a partition from the class vector f.

The partition is defined by values i and j belonging to the same class if and only if f[i]==f[j]. Note that f can have values in any range, but the Partition will label its classes consecutively from 0.

Definition at line 45 of file partition.cpp.

References addToClass(), and newClass().

atlas::partition::Partition::Partition std::vector< unsigned long > &  f,
tags::UnnormalizedTag 
 

Like the previous one, but uses the actual values of f to number the classes.

NOTE: it is required that the range of |f| be of the form [0,a[ (without holes). The vector |d_classRep| is dimensioned to the _number_ of (distinct) values in the image of |f|, but indexed by those values themselves, which will overflow the vector bounds if there were any holes in the range of |f|.

Definition at line 74 of file partition.cpp.

References d_classRep.

atlas::partition::Partition::~Partition  )  [inline]
 

Definition at line 115 of file partition.h.


Member Function Documentation

void atlas::partition::Partition::addToClass unsigned long  c,
unsigned long  j
[inline]
 

Adds value j to class #c.

Assumes that class #c is already non-empty; that is, that j is not the first element of the class. For the first element of a class, use newClass(j) instead.

Definition at line 161 of file partition.h.

Referenced by atlas::graph::OrientedGraph::cells(), atlas::partition::makeOrbits(), and Partition().

unsigned long atlas::partition::Partition::classCount  )  const [inline]
 

Returns the number of classes in the partition.

Definition at line 132 of file partition.h.

References size().

Referenced by atlas::graph::OrientedGraph::cells(), atlas::cartanclass::Fiber::makeRealFormPartition(), atlas::cartanclass::CartanClass::numRealFormClasses(), atlas::cartanclass::Fiber::numRealForms(), and atlas::cartanset::CartanClassSet::updateStatus().

unsigned long atlas::partition::Partition::classRep unsigned long  c  )  const [inline]
 

Returns the number of an element belong to class # c.

Definition at line 139 of file partition.h.

Referenced by atlas::cartanclass::Fiber::class_base(), atlas::cartanset::CartanClassSet::correlateDualForms(), atlas::cartanset::CartanClassSet::correlateForms(), atlas::cartanset::CartanClassSet::dualRepresentative(), atlas::kgb::KGBHelp::grading_seed(), atlas::cartanclass::CartanClass::isMostSplit(), atlas::cartanclass::Fiber::makeRealFormPartition(), atlas::cartanclass::Fiber::makeStrongRepresentatives(), atlas::cartanset::CartanClassSet::noncompactRoots(), atlas::cartanset::CartanClassSet::representative(), and atlas::cartanclass::toMostSplit().

unsigned long atlas::partition::Partition::classSize unsigned long  c  )  const
 

Counts the number of elements in class #c.

NOTE: Straightforward implementation. Successively computing |classSize| for all classes would cost more time then necessary.

Definition at line 131 of file partition.cpp.

Referenced by atlas::cartanset::CartanClassSet::dualFiberSize(), atlas::cartanset::CartanClassSet::fiberSize(), and atlas::cartanclass::CartanClass::isMostSplit().

void atlas::partition::Partition::clear  )  [inline]
 

Clears all entries of d_classRep.

Definition at line 170 of file partition.h.

Referenced by atlas::partition::makeOrbits().

void atlas::partition::Partition::newClass unsigned long  j  ) 
 

Starts a new class at location j.

Previous classes are labelled 0 through d_classRep.size()-1, so the new class is labelled d_classRep.size(). The location j is added to the end of d_classRep, as the representative of this new class.

Definition at line 114 of file partition.cpp.

References d_class, and d_classRep.

Referenced by atlas::graph::OrientedGraph::cells(), atlas::partition::makeOrbits(), and Partition().

unsigned long atlas::partition::Partition::operator() unsigned long  j  )  const [inline]
 

Definition at line 121 of file partition.h.

bool atlas::partition::Partition::operator== const Partition other  )  const [inline]
 

Definition at line 125 of file partition.h.

References d_class.

void atlas::partition::Partition::resize unsigned long  n  )  [inline]
 

Resizes the class to be a partition of [0,n[.

Definition at line 179 of file partition.h.

Referenced by atlas::graph::OrientedGraph::cells(), and atlas::partition::makeOrbits().

unsigned long atlas::partition::Partition::size  )  const [inline]
 

Number of elements of the underlying set of the partition.

Definition at line 148 of file partition.h.

Referenced by atlas::kgb::KGBHelp::backtrack_seed(), atlas::graph::OrientedGraph::cells(), classCount(), atlas::interpreter::fiber_part_wrapper(), atlas::cartanclass::Fiber::makeRealFormPartition(), and atlas::interpreter::print_gradings_wrapper().

void atlas::partition::Partition::swap Partition  ) 
 

Definition at line 105 of file partition.cpp.

References d_class, and d_classRep.

Referenced by atlas::graph::OrientedGraph::cells(), and atlas::cartanclass::Fiber::swap().


Member Data Documentation

std::vector<unsigned long> atlas::partition::Partition::d_class [private]
 

The number d_class[j] labels the class containing the value j.

Definition at line 76 of file partition.h.

Referenced by newClass(), operator==(), and swap().

std::vector<unsigned long> atlas::partition::Partition::d_classRep [private]
 

The value d_classRep[i] is some element of class #i.

Definition at line 81 of file partition.h.

Referenced by newClass(), Partition(), and swap().


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