1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
// Copyright (C) 1995 The New York Group Theory Cooperative
// See magnus/doc/COPYRIGHT for the full notice.
//
// Contents: Definition of class MapEnum, for enumerating Maps,
// and helper class IntTuples
//
// Principal Author: Roger Needham
//
// Status: In development
//
// Further Implementation Steps:
//
// * Need to deal with 1-generator domains.
//
// Revision History:
//
#ifndef _MAP_ENUM_H_
#define _MAP_ENUM_H_
#include "Map.h"
//------------------------------------------------------------------------//
//----------------------------- IntTuples --------------------------------//
//---------------------------- helper class ------------------------------//
class IntTuples
{
// Objects in this class enumerate all tuples of non-negative integers.
// Pass the length of tuple desired, and the starting radius in the
// taxicab metric.
public:
/////////////////////////////////////////////////////////////////////////
// //
// Constructors: //
// //
/////////////////////////////////////////////////////////////////////////
IntTuples(const int tupleLength, const int startRadius = 1);
// tupleLength >= 1, startRadius >= 1
~IntTuples( ) { delete [] tuple; }
/////////////////////////////////////////////////////////////////////////
// //
// Accessors: //
// //
/////////////////////////////////////////////////////////////////////////
const int* nextTuple( );
// You know how long the tuple is.
// This retains custody of the int*.
private:
/////////////////////////////////////////////////////////////////////////
// //
// Data Members: //
// //
/////////////////////////////////////////////////////////////////////////
int r;
// Current radius, i.e., for n == 2:
//
// . . . . . . * . .
// . . . r == 0, * . . r == 1, . * . r == 2, etc.
// * . . . * . . . *
//
// Notice that the entries in a tuple add up to r.
int* tuple;
// The tuple we return.
int* end;
// Points to last entry of tuple
int* sp;
// The `stack' pointer.
};
//------------------------------------------------------------------------//
//------------------------------ MapEnum ---------------------------------//
//------------------------------------------------------------------------//
class MapEnum
{
public:
/////////////////////////////////////////////////////////////////////////
// //
// Constructors: //
// //
/////////////////////////////////////////////////////////////////////////
MapEnum(const FGGroup& domain, const FGGroup& range, int radius = 1);
/////////////////////////////////////////////////////////////////////////
// //
// Accessors: //
// //
/////////////////////////////////////////////////////////////////////////
Map nextMap(int jump = 1);
private:
/////////////////////////////////////////////////////////////////////////
// //
// Private Members: //
// //
/////////////////////////////////////////////////////////////////////////
Word kthWord(int k, int n);
// Returns the kth freely reduced word on n semigroup generators.
/////////////////////////////////////////////////////////////////////////
// //
// Data Members: //
// //
/////////////////////////////////////////////////////////////////////////
int domainRank;
int rangeRank;
const FGGroup& theDomain;
const FGGroup& theRange;
IntTuples theTuples;
};
#endif
|