rep.cpp

00001 #include <fstream>
00002 #include <iostream>
00003 #include "cmdline.H"
00004 #include "my_gmp.H"
00005 #include "algebras.H"
00006 #include "repring.H"
00007 #include "ftwo.H"
00008 #include "exp_classes.H"
00009 #include "sw_maker.H"
00010 #include "chern_maker.H"
00011 using namespace std;
00012 
00013 
00014 int main(int argc, char** argv){
00015 
00016   CommandLine::init(argc, argv);
00017   // if no parameter is given, display this and exit
00018   if(CommandLine::parameters.size() != 1){
00019     cout << "Usage: rep <name> [options]" << endl
00020          << "This will create 'name.W' and "
00021          << "'name.W.res.elemab' based on " << endl
00022          << "information contained in 'name.gaprep', "
00023          << "'name.gaprep.real', " << endl 
00024          <<"and 'name.res.elemab'."
00025          << endl
00026          << "Options:" << endl
00027          << "         -quiet: displays less messages" 
00028          << endl
00029          << "         -silent: displays no " 
00030          << "messages at all."
00031          << endl;
00032     return 1;
00033   }
00034 
00036   RepresentationRing R_CG;
00037   RealRepresentationRing R_RG;  
00038   
00039   // checks if the file name is valid
00040   string name= CommandLine::parameters[0];
00041   
00042   // sets up the order
00043   PowProd::use_order(LEX);
00044 
00045   // sets verbosity
00046   R_CG.verbose= R_RG.verbose= true;
00047   R_CG.very_verbose= R_RG.very_verbose= true;
00048   if(CommandLine::has_tag("-quiet")) 
00049     R_CG.very_verbose= R_RG.very_verbose= false;
00050   if(CommandLine::has_tag("-silent")){
00051     R_CG.verbose= R_RG.verbose= false;
00052     R_CG.very_verbose= R_RG.very_verbose= false;
00053   }
00054   
00056   // part one: read info on the reprings //////
00058   
00059   if(R_CG.verbose)
00060     cout << "\\bigskip {\\large\\bf Computing a presentation"
00061          << " of the complex representation ring}"
00062          << endl << endl;
00063   
00064   
00065   R_CG.read_from_GAP_file(name + ".gaprep");
00066   
00067   
00068   // finally display the thing
00069   if(R_CG.very_verbose)
00070     cout << endl << "Current presentation:" 
00071          << endl << endl
00072          << R_CG << endl;
00073   
00074   if(R_CG.verbose)
00075     cout << "\\bigskip {\\large\\bf Computing a presentation"
00076          << " of the real representation ring}"
00077          << endl << endl;
00078 
00079   
00080   R_RG.read_from_GAP_file(name + ".gaprep.real");
00081   //R_RG.find_unitary_redundancies();
00082 
00083   // finally display the thing
00084   if(R_CG.very_verbose)
00085     cout << endl << "Current presentation:" 
00086          << endl << endl
00087          << R_RG << endl;
00088 
00089 
00090   
00092   // part two: computing exp classes ////////
00094 
00095   GradedAlgebra<F_2> H_ch;  //chern ring
00096   UnstableAlgebra H_sw; // stiefel whitney ring
00097   Chern_Maker chern;
00098   SW_Maker sw;
00099   // verbosity according to that of A
00100   H_ch.verbose= H_sw.verbose= R_CG.verbose;
00101   H_ch.very_verbose= H_sw.very_verbose= R_CG.very_verbose;
00102   
00103   if(R_CG.verbose)
00104     cout << "\\bigskip {\\large\\bf Computing"
00105          << " Chern classes}"
00106          << endl << endl;
00107   //this computes the formal ring of Chern classes
00108   //and writes the answer in H_ch  
00109   chern.start(&R_CG, &H_ch);
00110 
00111   if(R_CG.very_verbose)
00112     cout << H_ch << endl;
00113   
00114   if(R_CG.verbose)
00115     cout << "\\bigskip {\\large\\bf Computing"
00116          << " Stiefel-Whitney classes}"
00117          << endl << endl;
00118   //this computes the formal ring of sw classes,
00119   //taking H_ch into account, and writes the
00120   //answer in H_sw
00121   sw.start(&R_RG, &H_sw, &H_ch);
00122   //sw.start(&R_RG, &H_sw, 0);
00123   
00124 
00125   //f is the natural homomorphisms from the chern ring
00126   // to the sw ring.
00127   AffineHomomorphism<F_2> f( &H_ch, &H_sw );
00128   // in fact f has been computed by the SW_Maker sw
00129   // during start(), and stored as an AbstractHomomorphism<F_2>
00130   // in sw.chern_sw
00131   f.get_data_from(sw.chern_sw);
00132   
00133   if(R_CG.very_verbose)
00134     cout << "Correspondence between Chern and " 
00135          <<"Stiefel-Whitney classes: " 
00136          << endl << f << endl;
00137 
00138   
00140   // part three: reduction homomorphisms ///////
00142   
00143   //H_reduced will be defined from H_sw by saturating
00144   //the ideal of relations with respect to Steenrod
00145   //operations, and also finding a minimal presentation.
00146   UnstableAlgebra H_reduced;
00147   H_reduced= H_sw;
00148   H_reduced.fix_alphabets();
00149   //in order to save memory, we erase the relations in H_sw
00150   H_sw.relations.generators.clear();
00151   //the following does the reduction and creates the
00152   //reduction homomorphism in g
00153   AffineHomomorphism<F_2> g( &H_sw, &H_reduced);
00154   g.get_data_from( H_reduced.saturate_and_reduce() );
00155   f= g * f;
00156   
00157   if(R_CG.verbose){
00158     H_reduced.display();
00159     cout << "Reduction homomorphism: " << endl
00160          << g << endl;
00161     
00162     cout << "Chern classes in the reduced ring: " << endl
00163          <<  f << endl;
00164   }
00165 
00166   // write to files ///////
00167   string out_W= name + ".W";
00168   ofstream W_file(out_W.c_str());
00169   W_file << H_reduced;
00170 
00171   string out_sw= name + ".sw";
00172   ofstream sw_file(out_sw.c_str());
00173   sw_file << H_sw;
00174   sw_file << g;
00175 
00176   string out_chern= name + ".chern";
00177   ofstream chern_file(out_chern.c_str());
00178   chern_file << H_ch;
00179   chern_file << f;
00180 
00181   
00182   //it will be convenient to compute a "section" s for
00183   //g. Explanation: in most cases, g is an isomorphism
00184   //and s is going to be its inverse. However if the 
00185   //Steenrod operations have added relations in H_reduced
00186   //which were not present in H_sw, then s will be a
00187   //homomorphism from H_reduced to H_sw such that g*s=id,
00188   //and which... is mathematically ill-defined !! in the
00189   //sense that s(relation) != 0 for some relation. This is
00190   //not important, as s will be well-defined when we compose
00191   //it with the restriction homomorphisms H_sw -> H_sw(subgroup)
00192   //that we care about.
00193   AffineHomomorphism<F_2> s(&H_reduced, &H_sw);
00194   long i, j;
00195   Tuple< Polynomial<F_2> > var= H_sw.get_variables();
00196 
00197   for(i=1; i<= H_reduced.variables_in_use(); i++){
00198     //we look for a variable in H_sw with the right name
00199     for(j=1; j<= H_sw.variables_in_use(); j++)
00200       if( H_sw.nameof(j) == H_reduced.nameof(i) )
00201         break;//done!
00202     s.set_image(i, var[j] );
00203   }
00204 
00205   //  cout << "section found: " << endl << s << endl;  
00206 
00208   // part four: reduction to elementary abelian subgroups // 
00210 
00211   if(R_CG.verbose)
00212     cout << "Computing the restrictions to "
00213          << "elementary abelian subgroups" << endl;
00214 
00215 
00216 
00217   //the information on this is in the following file:
00218   string res_name= name + ".res.elemab";// produced by GAP
00219   string save_name=name + ".W.res.elemab"; //this will be the output
00220   ifstream res_file(res_name.c_str());
00221   ofstream save_res(save_name.c_str());
00222   long nb_elemab;
00223   string rank, prev_rank;;
00224   RealRepresentationRing R_elemab, empty_ring;
00225   UnstableAlgebra H_elemab, H_elemab_red, empty_unstable;
00226   AffineHomomorphism<QQ> res_hom(&R_RG, &R_elemab);
00227   AffineHomomorphism<F_2> restriction( &H_sw, &H_elemab);
00228   AffineHomomorphism<F_2> reduc( &H_elemab, &H_elemab_red);
00229 //final answer which will be saved:
00230   AffineHomomorphism<F_2> save_hom(&H_reduced, &H_elemab_red);
00231   SW_Maker sw_elemab, sw_empty;;
00232 
00233   res_file >> nb_elemab;
00234   save_res << nb_elemab << " ";
00235 
00236   prev_rank="";
00237 
00238   for(i=0; i< nb_elemab; i++){
00239     res_file >> rank;
00240     save_res << rank << " ";
00241 
00242     if( rank != prev_rank ){
00243       res_name= "elemab-rank" + rank + ".gaprep.real";
00244       R_elemab= empty_ring; //quickest way to erase data
00245       R_elemab.read_from_GAP_file(res_name);
00246       sw_elemab= sw_empty; //ditto
00247       H_elemab= empty_unstable; //ditto
00248       sw_elemab.start(&R_elemab, &H_elemab);
00249       H_elemab_red= H_elemab;
00250       H_elemab_red.fix_alphabets();
00251       reduc.get_data_from( H_elemab_red.find_redundancies() );
00252     }
00253     prev_rank= rank;
00254     res_hom.read_from_GAP_file(res_file); // !
00255 
00256     //    cout << R_elemab << endl;
00257     //cout << res_hom << endl;
00258 
00259     restriction= sw.translate_homomorphism(res_hom, sw_elemab); // !!!
00260     //now we have the restriction homomorphisms
00261     //display it, save it, etc...
00262     save_hom= reduc * restriction * s; 
00263 
00264     if(R_CG.very_verbose){
00265       cout << "restriction to elementary abelian subgroup "
00266            << i << endl;
00267       cout << save_hom << endl;
00268     }
00269     save_res << save_hom;
00270   }
00271 
00272   
00273   /*
00274     cout << "debug: what we read from the file" << endl;
00275     sw_out.close();
00276     ifstream debug(out_name.c_str());
00277     debug >> H_reduced;
00278     H_reduced.display();
00279   */
00280   
00281   return 0;
00282 }

Generated on Fri Jun 13 15:48:17 2008 for Pierre Guillot by  doxygen 1.3.9.1