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

/magnus/back_end/GAP/include/Permutation.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: Permutation.h,v 1.1 2000/09/26 21:31:57 bormotov Exp $
00003  */
00004 
00005 // Copyright (C) 2000 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 //
00008 // Contents: Definition of class Permutation
00009 //
00010 // Principal Author: Dmitry Bormotov
00011 //
00012 // Status: Under development
00013 //
00014 // Usage:
00015 //
00016 // Revision History:
00017 //
00018 
00019 
00020 #ifndef _Permutation_h_
00021 #define _Permutation_h_
00022 
00023 #include "IStreamPoll.h"
00024 #include "Vector.h"
00025 
00026 
00027 // ------------------------------ Permutation ------------------------------ //
00028 
00029 
00030 class Permutation
00031 {
00032   // There's no need to make rep: the only data member is VectorOf<int>,
00033   // which is reped, i.e., a pointer.
00034 
00035 public:
00036 
00037   struct GAPPermutation;
00038   friend struct GAPPermutation;
00039 
00040   //////////////////////////////////////////////////////////////
00041   //                                                          //
00042   // Constructors:                                            //
00043   //                                                          //
00044   //////////////////////////////////////////////////////////////
00045 
00046   Permutation::Permutation( VectorOf<int> v = VectorOf<int>() );
00047   // Initialize the permutation given its bottom row v; v must define
00048   // a permutation; there's no check for correctness; if you need to
00049   // check use operator >>.
00050 
00051   // CC, destructor and op = supplied by compiler.
00052 
00053 
00054   //////////////////////////////////////////////////////////////
00055   //                                                          //
00056   // Accessors:                                               //
00057   //                                                          //
00058   //////////////////////////////////////////////////////////////
00059 
00060   Permutation inverse( ) const;
00061   // computes the inverse of the permutation
00062 
00063 
00064   /////////////////////////////////////////////////////////////////////////
00065   //                                                                     //
00066   // I/O:                                                                //
00067   //                                                                     //
00068   /////////////////////////////////////////////////////////////////////////
00069 
00070   friend ostream& operator << ( ostream&, const Permutation& );
00071 
00072   friend IStreamPoll operator >> ( istream&, Permutation& );
00073 
00074   GAPPermutation inGAP( ) { return GAPPermutation(*this); }
00075   // Used to print permutations in GAP format; manipulator like.
00076   // Usage: 
00077   //         Permutation p;
00078   //         cout << p.inGAP() << endl;
00079   //         cout << p << p.inGAP() << p.inGAP() << p << ...;
00080  
00081 private:
00082   
00083   // the following is used only by inGAP()
00084 
00085   struct GAPPermutation {
00086     
00087     GAPPermutation( Permutation& p ) : perm(p) { }
00088 
00089     Permutation& perm;
00090   };
00091 
00092   friend ostream& operator << ( ostream& o, const GAPPermutation& gp );
00093   
00094   friend IStreamPoll operator >> ( istream& i, const GAPPermutation& gp );
00095   
00096 
00097   //////////////////////////////////////////////////////////////
00098   //                                                          //
00099   // Private functions:                                       //
00100   //                                                          //
00101   //////////////////////////////////////////////////////////////
00102 
00103   void printInGAP( ostream& ) const;
00104   // print permutation in GAP format; internal use only; use inGAP() instead
00105 
00106   void readInGAP( istream&, Chars& );
00107   // read permutation in GAP format; internal use only; use inGAP() instead
00108 
00109 
00110   //////////////////////////////////////////////////////////////
00111   //                                                          //
00112   // Data members:                                            //
00113   //                                                          //
00114   //////////////////////////////////////////////////////////////
00115 
00116   VectorOf<int> perm; // the bottom row of the permutation      
00117 };
00118 
00119 #endif
00120 
00121 
00122 

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