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

/magnus/back_end/Group/include/GeneralWhitehead.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: GeneralWhitehead.h,v 1.4 1999/11/23 20:28:19 bormotov Exp $
00003  */
00004 
00005 // Copyright (C) 1994 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 //
00008 // Contents: Definition of the GeneralWhitehead class.
00009 //
00010 // Principal Authors: Dmitry Bormotov
00011 //
00012 // Status: 
00013 //
00014 // Revision History:
00015 //
00016 // Special Remarks:
00017 //
00018 
00019 
00020 #ifndef _GENERAL_WHITEHEAD_H_
00021 #define _GENERAL_WHITEHEAD_H_
00022 
00023 
00024 #include "Map.h"
00025 #include "FreeGroup.h"
00026 #include "Timer.h"
00027 #include "File.h"
00028 
00029 
00030 //#define debug_GeneralWhitehead
00031 
00032 
00033 // -------------------------- GeneralWhitehead ---------------------------- //
00034 
00035 
00036 class GeneralWhitehead 
00037 {
00038 
00039 public:
00040 
00041   
00042   /////////////////////////////////////////////////////////////////////////
00043   //                                                                     //
00044   // Constructors:                                                       //
00045   //                                                                     //
00046   /////////////////////////////////////////////////////////////////////////
00047 
00048   GeneralWhitehead( const FreeGroup& F, bool keepDetails = false );
00049 
00050   ~GeneralWhitehead( );
00051       
00052 
00053   /////////////////////////////////////////////////////////////////////////
00054   //                                                                     //
00055   // Activation members:                                                 //
00056   //                                                                     //
00057   /////////////////////////////////////////////////////////////////////////
00058 
00059   void startComputation( const VectorOf<Word>& );
00060   // Start the computation. 
00061   // You shouldn't call this more than ones.
00062 
00063   void startComputation( const Word& );
00064   // The same as previsious one, but for one word only.
00065              
00066   bool continueComputation( );
00067   // Advance the computation. 
00068   // You have to call startComputation() before.
00069   // This function returns true if the computation is done.
00070 
00071 
00072   /////////////////////////////////////////////////////////////////////////
00073   //                                                                     //
00074   // Status Queries:                                                     //
00075   //                                                                     //
00076   /////////////////////////////////////////////////////////////////////////
00077 
00078   bool done( ) const { return bDone; }
00079   // true only when the computation is finished.
00080 
00081 
00082   /////////////////////////////////////////////////////////////////////////
00083   //                                                                     //
00084   // Accessors:                                                          //
00085   //                                                                     //
00086   /////////////////////////////////////////////////////////////////////////
00087 
00088   // You can call all these functions iff the computation is finished
00089   // ( when the done() functions returns true ).
00090 
00091   bool extendsToFreeBasis( ) 
00092   {
00093   #if SAFETY > 0
00094     if ( !bDone )
00095       error("bool WhiteheadAutomorphisms::extendToFreeBasis( ) : "
00096             "tried to get result before the computation is finished.");
00097   #endif
00098 
00099     return doesExtend;
00100   }
00101 
00102   Map getAutomorphism( )
00103   {
00104   #if SAFETY > 0
00105     if( !extendsToFreeBasis() )
00106       error("Map WhiteheadAutomorphisms::getAutomorphism( ) : "
00107             "the automorphism doesn't exist.");
00108   #endif
00109 
00110     return automorphism;
00111   }
00112 
00113   Chars getFileName( )
00114   {
00115    #if SAFETY > 0
00116     if( !file )
00117       error("Chars GeneralWhitehead::getFileName( ) : "
00118             "The file has not been created.");
00119   #endif
00120 
00121     return file->getFileName();
00122   }
00123   // Returns name of the file with computation details
00124   
00125 
00126 private:
00127 
00128 
00129   /////////////////////////////////////////////////////////////////////////
00130   //                                                                     //
00131   // Data Members:                                                       //
00132   //                                                                     //
00133   /////////////////////////////////////////////////////////////////////////
00134 
00135   static const int timerValue = 1000;
00136 
00137   bool bDone;
00138   bool bStart;
00139   bool doesExtend;
00140   bool itIsInterrupted;
00141   Timer timer;
00142 
00143   const FreeGroup theGroup;
00144   int numberOfGenerators;
00145   VectorOf<Word> images;
00146   int *numOfAuto;
00147   Map automorphism;
00148   VectorOf<Word> theVector;
00149   int theVectorLen;
00150   int theVectorCommonLength;
00151   int saveN;
00152 
00153   File* file;
00154 
00155   bool hasOneWordOnly;
00156 
00157   /////////////////////////////////////////////////////////////////////////
00158   //                                                                     //
00159   // Private methods:                                                    //
00160   //                                                                     //
00161   /////////////////////////////////////////////////////////////////////////
00162 
00163   GeneralWhitehead( const GeneralWhitehead& );
00164   // It is hidden, not implemented.
00165 
00166   GeneralWhitehead& operator = ( const GeneralWhitehead& );
00167   // It is hidden, not implemented.
00168 
00169   Word makeWhiteheadAutomorpism( Generator, int, Generator ) const;
00170 
00171   void prepareAutomorphism( Map& automorphism ) const;
00172 
00173   void setResult( bool DoesExtend );
00174 
00175   void finishComputation( bool DoesExtend );
00176 
00177   int commonLength( const VectorOf<Word>& );
00178   
00179   
00180   /////////////////////////////////////////////////////////////////////////
00181   //                                                                     //
00182   // Debugging stuff:                                                    //
00183   //                                                                     //
00184   /////////////////////////////////////////////////////////////////////////
00185 
00186 #ifdef debug_GeneralWhitehead
00187 
00188   int numOfShortenings;
00189 
00190   friend int main( );
00191 
00192 #endif
00193 
00194 };
00195 
00196 
00197 inline void GeneralWhitehead::finishComputation( bool DoesExtend )
00198 {
00199   delete [] numOfAuto;
00200   numOfAuto = 0;
00201   setResult( DoesExtend );
00202 }
00203 
00204 #endif
00205 

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