00001
00002
00003 using namespace std;
00004 #include<sys/time.h>
00005 struct timeval initclock,tmpclock;
00006 double tempsdssdp=0;
00007 double tempsCDSP=0;
00008
00009 #include<gmpxx.h>
00010 #include"borderbasix/arithm/bignum.H"
00011 #include"borderbasix/arithm/Zp.H"
00012 #include <iostream>
00013 #include<stdio.h>
00014 #include<list>
00015 #include<vector>
00016 #include<map>
00017 #include "borderbasix/mpoly.H"
00018 #include <time.h>
00019
00020 #ifdef mymod
00021 #include"Phtmod.cc"
00022 #endif
00023
00024
00025
00026
00027
00028
00029 #define nored
00030 #define REALSOLVE
00031 #define unimul
00032 #define uninf
00033
00034
00035 #ifndef NO_CHOICE
00036 #define choice_grevlex choice
00037 #endif
00038
00039
00040
00041 #define COMPUTE_MAT
00042 #define NBDIGITS 160
00043 #define MON_PREMIER 32051 //12007
00044 #ifndef NO_CHOICE
00045 #define COEFF Z<MON_PREMIER,short int> //Scl<MPF>//long double//Scl<MPF>//long double//Z<MON_PREMIER, short int>//long double
00046 #else
00047 #define COEFF QQ
00048 #endif
00049
00050 #define PETITFERMAT
00051 #define NEED_INIT_ELEM
00052
00053
00054
00055 #define sparse2
00056 #define GOTZMANN
00057
00058 #define WORKSPACE
00059
00060
00061
00062
00063 #ifdef RS_OUT
00064 #include "rs2.cc"
00065 #endif
00066
00067 typedef Monom<COEFF ,
00068 numexp<'x',7, long long > > Mon;
00069 typedef Mon mon;
00070 #include "borderbasix/dlexorder.cc"
00071 typedef MPoly<vector<Mon>, my_Dlex<Mon> > Poly;
00072
00073 #include"borderbasix/general.h"
00074 #include"borderbasix/arithm/zpspecial.cc"
00075 typedef Base<predicat<mon> > typB;
00076 typedef predicat<mon> typpredicat;
00077
00078
00079 #ifdef mymod
00080 #include"borderbasix/dpivmacrev_z.cc"
00081 #endif
00082
00083 #ifdef REALSOLVE
00084
00085
00086 #include"borderbasix/post_treatment/resolve2.cc"
00087
00088
00089 #endif
00090
00091 #ifdef dimpos
00092 #include "dimpos.cc"
00093 #endif
00094
00095 #ifdef SYMBO
00096 #include"post_treatment/symbo2.cc"
00097 #endif
00098
00099 int main(int argc,char** argv)
00100 {
00101 #ifdef tableop
00102 inittableop();
00103 #endif
00104 #ifdef mymod
00105 macrev_Z dummy;
00106 dummy.init_Z("32051");
00107 #endif
00108 list<harewell<COEFF> > lmat;
00109 list<mon> stockmon;
00110 #ifndef DENSE
00111 monomial_server<mon,pol<mon,COEFF> > serv;
00112 #endif
00113 FILE *fic;
00114 list<Poly> toto;
00115 list<dumpstruct<pol<mon,COEFF> > > dump;
00116 harewell<COEFF> m;
00117 Base<predicat<mon> > b;
00118
00119 mpai_set_prec(3);
00120 Precision(90);
00121 printf("%s\n",argv[1]);fflush(stdout);
00122 readfile(toto,argv[1]);
00123
00124 #ifndef DENSE
00125 algo<list<Poly>,list<pol<mon,COEFF> >,
00126 list<dumpstruct<pol<mon,COEFF> > >
00127 ,Base<predicat<mon> >, harewell >(toto,dump,b,serv);
00128 #else
00129 algo<list<Poly>,list<pol<mon,COEFF> >,
00130 list<dumpstruct<pol<mon,COEFF> > >
00131 ,Base<predicat<mon> >, harewell >(toto,dump,b);
00132 #endif
00133 #ifdef AFFICHE
00134
00135 int total=0;
00136 for(list<dumpstruct<pol<mon,COEFF> > >::iterator iter=dump.begin();
00137 iter!=dump.end();iter++)
00138 for(int i=0;i<iter->size;i++)
00139 {
00140
00141 int nbzero=0;
00142 for(int j=0;j<iter->nf[i].size;j++)
00143 if(Iszero(iter->nf[i].nf[j])) nbzero++;
00144 cout<<invconv<Poly>(iter->nf[i])<<","<<endl;
00145 total+=iter->nf[i].size;
00146 cout<<"taille "<<iter->nf[i].size<<"nbzero "<<nbzero<<endl;
00147 }
00148 cout<<"total place memoire "<<total<<endl;
00149
00150 #endif
00151 #ifndef DENSE
00152 cout<<"nb point dans quotient "<<countpoint(b,dump,serv)<<endl;
00153 #else
00154 cout<<"nb point dans quotient "<<countpoint(b,dump)<<endl;
00155 #endif
00156
00157 #ifndef DENSE
00158
00159 if(argc>2)
00160 {
00161 char nom[10];
00162 harewell<complex< long double> > tmp;
00163
00164 int i,j;
00165 list<mon>::iterator iterstock;
00166 computestockmon(stockmon,b,dump);
00167 cout<<"coputestockmon "<<stockmon.size()<<endl;
00168 list<harewell<mpq_t> > loclmat;
00169 harewell<mpq_t > tmploc;
00170 fic=fopen(argv[2],"w");
00171 for(int i=0;i<b.nbvar();i++)
00172 {
00173 #ifdef SYMBO
00174 tmploc= harewell<mpq_t >(stockmon.size(),stockmon.size());
00175 #endif
00176 matmul(m,i,dump,b,stockmon,serv);
00177 sprintf(nom,"m%d",i);
00178 printmatfile(m,nom,fic);
00179 #ifdef SYMBO
00180 for(int k=0;k<stockmon.size();k++)
00181 for(int l=0;l<stockmon.size();l++)
00182 harewell_set_coeff(tmploc,l,k,&m(k,l).rep());
00183 #endif
00184 lmat.push_back(m);
00185 loclmat.push_back(tmploc);
00186 }
00187 #ifdef SYMBO
00188 ptpol_t *res;
00189 res=(ptpol_t*)malloc((b.nbvar()+1)*sizeof(ptpol_t));
00190 for(int i=0;i<b.nbvar()+1;i++)
00191 ptpol_init(res[i]);
00192 symbo(res,loclmat, stockmon,dump,b);
00193 for(int i=0;i<b.nbvar()+1;i++)
00194 {
00195 ptpol_out_str(fic,res[i]);
00196 fprintf(fic,";\n");
00197 }
00198 #endif
00199 #ifdef REALSOLVE
00200
00201 if(argc>3)
00202 {
00203 realsolve2(lmat,b,tmp);
00204 printmatfile(tmp,"sol",fic);
00205 }
00206 #endif
00207 tmp.destroystore();m.destroystore();
00208 fprintf(fic,"mon:=[");
00209 iterstock=stockmon.begin();
00210 for(i=0;i<(int)(stockmon.size()-1);i++,iterstock++)
00211 {
00212 for( j=0;j<b.nbvar()-1;j++)
00213 fprintf(fic,"x%d^%d*",j,(int)iterstock->GetDegree(j));
00214 fprintf(fic,"x%d^%d,",j,(int)iterstock->GetDegree(j));
00215 }
00216 for(j=0;j<b.nbvar()-1;j++)
00217 fprintf(fic,"x%d^%d*",j,(int)iterstock->GetDegree(j));
00218 fprintf(fic,"x%d^%d];\n",j,(int)iterstock->GetDegree(j));
00219
00220 fclose(fic);
00221 }
00222
00223 #ifdef RS_OUT
00224 fic=fopen(argv[2],"w");
00225 rs_out(dump,b,fic);
00226 #endif
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242 sweep(dump,b);
00243
00244
00245
00246 cout<<"temps dans generickernel "<<tempsdssdp<<endl;
00247 cout<<"temps dans CSDP "<<tempsCDSP<<endl;
00248 #endif //DENSE
00249 }