Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

/magnus/back_end/Group/include/WordEnumerator.h

Go to the documentation of this file.
00001 /*
00002  *   $Id:
00003  */
00004  
00005 // Copyright (C) 1997 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 //
00008 // Contents: Declarations of classe WordEnumerator
00009 //
00010 // Principal Author: Alexei Myasnikov
00011 //
00012 // Status: in progress
00013 //
00014 // Revision History:
00015 //
00016 // Notes:
00017 //
00018 //
00019 
00020 #ifndef _WORDENUMERATOR_H_
00021 #define _WORDENUMERATOR_H_
00022 
00023 #include "FreeGroup.h"
00024 
00025 // ------------------------ VectorEnumerator -------------------
00026 
00027 class VectorEnumerator
00028 {
00029  public:
00030   VectorEnumerator( int n = 2) :
00031     current(0) {
00032     if ( n < 2)
00033       error("VectorEnumerator( int n = 2) :"
00034             " length of vectors can not be less than 2");
00035     lengthOfVectors = n;
00036   }
00037 
00038   // Iteration functions
00039   void reset(int c = 0) { current = c; }
00040   void next() { current++; }  
00041   VectorOf<Integer> vector() const {
00042     return getVectorOf( current );
00043   }
00044 
00045   // Coding functions
00046   VectorOf<Integer> getVectorOf ( Integer c ) const;
00047   
00048   Integer getNumberOfVector(VectorOf<Integer> v) const;
00049 
00050   int vectorsLength() const { return lengthOfVectors; }
00051 
00052  private:
00053   VectorOf<Integer> getPairOf ( Integer c ) const;
00054   
00055   Integer getNumberOfPair(const Integer& n,const Integer& m ) const{
00056     
00057     return ((n + m)*(n + m + 1))/2 + m;
00058   }
00059 
00060   int current;
00061   int lengthOfVectors;
00062 };
00063 
00064 
00065 // ------------------------ WordEnumerator -------------------
00066 
00067 class WordEnumerator
00068 {
00069 public:
00070   WordEnumerator( const FreeGroup& f, int n = 2):
00071     ve( n ),
00072     theGroup( f )
00073     { }
00074   
00075   void reset(int c = 0) { ve.reset( c ); }
00076   void next() { ve.next(); }
00077   
00078   VectorOf<Word> getWords();
00079     
00080 private:
00081   FreeGroup theGroup;
00082   VectorEnumerator ve;
00083 };
00084 
00085 
00086 #endif

Generated at Tue Jun 19 09:49:36 2001 for Magnus Classes by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001