FPGroup.h

Go to the documentation of this file.
00001 // Copyright (C) 2005 Alexander Ushakov
00002 // Contents: Definition of class FPGroup
00003 //
00004 // Principal Authors: Alexander Ushakov
00005 //
00006 // Revision History:
00007 //
00008 
00009 #ifndef _FPGROUP_H_
00010 #define _FPGROUP_H_
00011 
00012 
00013 #include <iostream>
00014 #include <vector>
00015 #include <string>
00016 #include <strstream>
00017 
00018 
00019 #include "Word.h"
00020 #include "Alphabet.h"
00021 
00022 using namespace std;
00023 
00024 
00025 //---------------------------------------------------------------------------//
00026 //--------------------------------- FPGroup ---------------------------------//
00027 //---------------------------------------------------------------------------//
00028 
00029 
00031 
00032 class FPGroup
00033 {
00034   
00036   //                                                     //
00037   //  Constructors                                       //
00038   //                                                     //
00040 
00041  public:
00042   
00043   FPGroup( int num=0 );
00044   //  FPGroup( const vector< string >& genNames );
00045   //  FPGroup( const vector< string >& genNames , const vector< Word >& relators );
00046   FPGroup( int numOfGen , const vector< Word >& relators );
00047   FPGroup( const FiniteAlphabet& a );
00048   FPGroup( const FiniteAlphabet& a, const vector< Word >& relators );  
00049   
00051   //                                                     //
00052   //  Accessors:                                         //
00053   //                                                     //
00055 
00056  public:
00057 
00059   inline int numberOfGenerators( ) const { return numOfGenerators; }
00061   inline const vector< string >& getGeneratorsNames( ) const { return theAlphabet.getLetters(); }
00063   inline const FiniteAlphabet& getAlphabet( ) const { return theAlphabet; }  
00064   // Get the relators
00065   inline const vector< Word >& relators( ) const { return theRelators; }
00066 
00067   
00069 
00076   Word randomEqWord_Baltimore( const Word& w , int length , float conj_param ) const;
00077 
00078   
00079   
00081 
00087   Word randomIdentity_Stack( int length ) const;
00088 
00090 
00098   Word randomIdentity_Classic( int length , float conj_param ) const;
00099   
00101   Word randomIdentity_Baltimore( int length , float conj_param ) const;
00102 
00104 
00110   FPGroup triangulatePresentation( ) const;
00111 
00112  
00114   //                                                     //
00115   //  I/O                                                //
00116   //                                                     //
00118 
00119  public:
00120   
00121 
00123   //                                                     //
00124   //  SWIG functions:                                    //
00125   //                                                     //
00127 
00128    /*
00129 #ifdef SWIG
00130 %extend {
00131 
00132   char* __str__( ) const {
00133     strstream ostr;
00134     ostr << *self << ends;
00135     return ostr.str( );
00136   }
00137 
00138   Word read( const char* str ) {
00139     Word result;
00140     self->readWord( str , result );
00141     return result;
00142   }
00143 
00144   char* write( const Word& word ) const {
00145     strstream ostr;
00146     self->writeWord( ostr , word ) << ends;
00147     return ostr.str( );
00148   }
00149 
00150   char* write( const Mapping& m ) const {
00151     strstream ostr;
00152     self->writeMapping( ostr , m ) << ends;
00153     return ostr.str( );
00154   }
00155 
00156 }
00157 #endif
00158    */
00159 
00161   //                                                     //
00162   //  Internal functions                                 //
00163   //                                                     //
00165   
00166  public:
00167   
00168   static vector< string > initializeGenNames( int num );
00169   
00170  private:
00171   
00172   friend ostream& operator << ( ostream& os , const FPGroup& group );
00173   friend istream& operator >> ( istream& is , FPGroup& group );
00174   
00175   
00177   //                                                     //
00178   //  Data members                                       //
00179   //                                                     //
00181   
00182  protected:
00183   
00184   int numOfGenerators;
00185   // does it make sense to have this variable? You can change it by generatorsNames.size( )
00186   //  vector< string > generatorsNames;
00187   vector< Word > theRelators;
00188   
00189   FiniteAlphabet theAlphabet;
00190   bool useDefaultAlphabet;  
00191 };
00192 
00193 
00194 #endif
00195 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Mon Sep 26 18:43:45 2011 for CRyptography And Groups (CRAG) by  doxygen 1.6.1