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

/magnus/back_end/Group/include/Homology.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: Homology.h,v 1.2 1997/02/03 22:27:56 alex Exp $
00003  */
00004 
00005 // Copyright (C) 1995 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 //
00008 // Contents: Definition of utility class Homology, which wraps a
00009 //           BlackBox connected to the Homology C Library.
00010 //
00011 // Principal Author: Roger Needham
00012 //
00013 // Status: Under development
00014 //
00015 // Usage:
00016 //
00017 //   The Homology C Library is more efficient if it computes the entire
00018 // desired range of groups in one program run, instead of being invoked
00019 // separately for each dimension, but the latter is permitted.
00020 // 
00021 //   Pass a KBMachine for a finite, confluent and terminating rewrite
00022 // system, along with the desired range of dimensions, to the
00023 // constructor.
00024 //   To begin computing the first homology group, call workOnNextGroup().
00025 // It returns true iff the computation of the current group is complete,
00026 // and may be extracted with getTorsionFreeRank() and
00027 // getTorsionInvariants(). It is an error to call either of these if the
00028 // last call to workOnNextGroup() returned false, or has never been
00029 // called.
00030 //   After workOnNextGroup() returns true, the next call will start work
00031 // on the next group. The previous group may not be extracted at this
00032 // point.
00033 //   It is an error to call workOnNextGroup() more times than is
00034 // consistent with the indicated range of dimensions desired.
00035 //   To prepare for computing `all' homology, i.e. until the resources
00036 // are exhausted, pass a large number such as MAXINT for the upper
00037 // dimension. Note that the computation will finish only for fairly small
00038 // dimensions.
00039 //
00040 //
00041 // Revision History:
00042 //
00043 
00044 
00045 #ifndef _HOMOLOGY_UNIT_H_
00046 #define _HOMOLOGY_UNIT_H_
00047 
00048 
00049 #include "BlackBox.h"
00050 #include "KBMachine.h"
00051 #include "SmithNormalForm.h"
00052 
00053 
00054 class Homology {
00055 
00056 public:
00057 
00058   //////////////////////////////////////////////////////////////
00059   //                                                          //
00060   // Constructors:                                            //
00061   //                                                          //
00062   //////////////////////////////////////////////////////////////
00063 
00064   Homology(const KBMachine M, int start_dim, int end_dim);
00065   // M specifies the group of which we want the homology, and
00066   // 1 < start_dim <= end_dim are the dimensions we want.
00067 
00068   ~Homology( );
00069 
00070   /////////////////////////////////////////////////////////////////////////
00071   //                                                                     //
00072   // Activation members:                                                 //
00073   //                                                                     //
00074   /////////////////////////////////////////////////////////////////////////
00075 
00076   bool workOnNextGroup( );
00077   // See usage comments
00078 
00079   //////////////////////////////////////////////////////////////////////
00080   //                                                                  //
00081   // Accessors:                                                       //
00082   //                                                                  //
00083   //////////////////////////////////////////////////////////////////////
00084 
00085   int getTorsionFreeRank( ) const;
00086   // See usage comments
00087 
00088   VectorOf<Integer> getTorsionInvariants( ) const;
00089   // See usage comments
00090 
00091   // Could also allow queries on the status of the current computation.
00092 
00093 
00094 private:
00095 
00096   //////////////////////////////////////////////////////////////////////
00097   //                                                                  //
00098   // Data Members:                                                    //
00099   //                                                                  //
00100   //////////////////////////////////////////////////////////////////////
00101 
00102   char tempFileName[100];
00103   // The executable chom wants its input from a file; this is the name.
00104   
00105   BlackBox* chom;
00106   // Wraps the chom executable.
00107 
00108   enum State { READING, REDUCING, GOT_ONE };
00109   State myState;
00110 
00111   int dimensionToDo;
00112   // Calls to workOnNextGroup() work on this dimension.
00113 
00114   int lastDimension;
00115   // A check against runaway calls to workOnNextGroup().
00116 
00117   SmithNormalForm* SNF;
00118   // The current smith normal form computation, or NULL if none.
00119 
00120   bool booted;
00121   // true iff we have read and reduced the first, `bootstrap' matrix.
00122 
00123   int previousTorsionFreeRank;
00124   int columns;
00125 
00126   //////////////////////////////////////////////////////////////////////
00127   //                                                                  //
00128   // Private Members:                                                 //
00129   //                                                                  //
00130   //////////////////////////////////////////////////////////////////////
00131 
00132   Integer** readMatrix(int& rows, int& cols) const;
00133   // Read the next matrix from *chom's output.
00134 };
00135 
00136 #endif

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