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
00010
00011
00012 #include <gmpxx.h>
00013 #include "borderbasix/arithm/bignum.H"
00014 #include "borderbasix/arithm/Zp.H"
00015 #include <iostream>
00016 #include <stdio.h>
00017 #include <list>
00018 #include <vector>
00019 #include <map>
00020 #include "borderbasix/mpoly.H"
00021 #include <time.h>
00022
00023 #ifdef mymod
00024 #include"Phtmod.cc"
00025 #endif
00026
00027
00028
00029
00030
00031
00032
00033
00034 #define nored
00035 #define RATIONAL
00036 #define REALSOLVE
00037 #define unimul
00038 #define uninf
00039
00040
00041
00042 #ifndef NO_CHOICE
00043 #define choice_fall choice
00044 #endif
00045
00046
00047
00048
00049 #define COMPUTE_MAT
00050 #define NBDIGITS 160
00051 #define MON_PREMIER 32051//12007
00052
00053
00054 #ifndef RATIONAL
00055 #define COEFF Z<MON_PREMIER,short int>//Scl<MPF>//long double//Scl<MPF>//long double//Z<MON_PREMIER, short int>//long double
00056 #endif
00057
00058 #ifdef RATIONAL
00059 #define COEFF RR
00060 #endif
00061
00062 #define PETITFERMAT
00063 #define NEED_INIT_ELEM
00064
00065
00066
00067
00068
00069 #define sdp sdp
00070 #define WORKSPACE
00071
00072
00073
00074
00075
00076 #define DEBUGSDP
00077
00078
00079 #ifdef RS_OUT
00080 #include "rs2.cc"
00081 #endif
00082
00083 typedef Monom<COEFF ,
00084 numexp<'x',7, long long > > Mon;
00085 typedef Mon mon;
00086 #include "borderbasix/dlexorder.cc"
00087 typedef MPoly<vector<Mon>, my_Dlex<Mon> > Poly;
00088
00089 #include"borderbasix/general.h"
00090 #include"borderbasix/arithm/zpspecial.cc"
00091 typedef Base<predicat<mon> > typB;
00092 typedef predicat<mon> typpredicat;
00093
00094
00095 #ifdef mymod
00096 #include"borderbasix/dpivmacrev_z.cc"
00097 #endif
00098
00099 #ifdef REALSOLVE
00100
00101
00102 #include"borderbasix/post_treatment/resolve2.cc"
00103
00104
00105 #endif
00106
00107 #ifdef dimpos
00108 #include "dimpos.cc"
00109 #endif
00110
00111 #ifdef SYMBO
00112 #include"post_treatment/symbo2.cc"
00113 #endif
00114
00115
00116
00117
00118 int main(int argc,char** argv)
00119 {
00120 #ifdef tableop
00121 inittableop();
00122 #endif
00123 #ifdef mymod
00124 macrev_Z dummy;
00125 dummy.init_Z("32051");
00126 #endif
00127 list<harewell<COEFF> > lmat;
00128 list<mon> stockmon;
00129 #ifndef DENSE
00130 monomial_server<mon,pol<mon,COEFF> > serv;
00131 #endif
00132 FILE *fic;
00133 list<Poly> toto;
00134 list<dumpstruct<pol<mon,COEFF> > > dump;
00135 harewell<COEFF> m;
00136 Base<predicat<mon> > b;
00137 cout<<"argc"<<argc<<endl;
00138
00139 mpai_set_prec(3);
00140 Precision(90);
00141 printf("%s\n",argv[1]);fflush(stdout);
00142 readfile(toto,argv[1]);
00143 #ifdef MINMarta
00144 cout<<"entra a leer funcion"<<endl;
00145 list<Poly> fun;
00146 printf("%s\n",argv[4]);fflush(stdout);
00147 cout<<"error antes de leer"<<endl;
00148 readfile(fun,argv[4]);
00149 cout<<"sale de leer funcion"<<endl;
00150 #endif
00151
00152 #ifndef DENSE
00153 #ifndef MINMarta
00154 algo<list<Poly>,list<pol<mon,COEFF> >,
00155 list<dumpstruct<pol<mon,COEFF> > >
00156 ,Base<predicat<mon> >, harewell >(toto,dump,b,serv);
00157 #else
00158 cout<<"entra en MinMarta "<<endl;
00159 algo<list<Poly>,list<pol<mon,COEFF> >,
00160 list<dumpstruct<pol<mon,COEFF> > >
00161 ,Base<predicat<mon> >, harewell>(toto,dump,b,serv,fun);
00162 #endif
00163 #else
00164 algo<list<Poly>,list<pol<mon,COEFF> >,
00165 list<dumpstruct<pol<mon,COEFF> > >
00166 ,Base<predicat<mon> >, harewell >(toto,dump,b);
00167 #endif
00168 cout<<"coucou"<<endl;
00169
00170 #ifdef AFFICHE
00171
00172 int total=0;
00173 for(list<dumpstruct<pol<mon,COEFF> > >::iterator iter=dump.begin();
00174 iter!=dump.end();iter++)
00175 for(int i=0;i<iter->size;i++)
00176 {
00177
00178 int nbzero=0;
00179 for(int j=0;j<iter->nf[i].size;j++)
00180 if(Iszero(iter->nf[i].nf[j])) nbzero++;
00181 cout<<invconv<Poly>(iter->nf[i])<<","<<endl;
00182 total+=iter->nf[i].size;
00183 cout<<" Size "<<iter->nf[i].size<<"nbzero "<<nbzero<<endl;
00184 }
00185 cout<<" Total memory size"<<total<<endl;
00186
00187 #endif
00188
00189 #ifndef DENSE
00190 cout<<"Number of solutions (with multiplicity): "<<countpoint(b,dump,serv)<<endl;
00191 #else
00192 cout<<"Number of solutions (with multiplicity): "<<countpoint(b,dump)<<endl;
00193 #endif
00194 cout <<"multi"<<endl;
00195 #ifndef DENSE
00196
00197 if(argc>2)
00198 {
00199 char nom[10];
00200 harewell<complex< long double> > tmp;
00201
00202 int i,j;
00203 list<mon>::iterator iterstock;
00204 computestockmon(stockmon,b,dump);
00205 cout<<"coputestockmon "<<stockmon.size()<<endl;
00206 list<harewell<mpq_t> > loclmat;
00207 harewell<mpq_t > tmploc;
00208 fic=fopen(argv[2],"w");
00209 fprintf(fic,"basis:=[");
00210
00211 iterstock=stockmon.begin();
00212 for(i=0;i<stockmon.size();i++,iterstock++)
00213 {
00214 bool mult=false;
00215 for( j=0;j<b.nbvar();j++) {
00216 if (iterstock->GetDegree(j)>1) {
00217 if (mult) fprintf(fic,"*");
00218 fprintf(fic,"x%d^%d",j,iterstock->GetDegree(j));
00219 mult=true;
00220 }
00221 else if (iterstock->GetDegree(j)>0) {
00222 if (mult) fprintf(fic,"*");
00223 fprintf(fic,"x%d",j);
00224 mult=true;
00225 } else if (!mult && j == b.nbvar()-1)
00226 fprintf(fic,"1");
00227 }
00228 if (i < stockmon.size()-1)
00229 fprintf(fic,",");
00230 else
00231 fprintf(fic,"];\n");
00232 }
00233
00234 for(int i=0;i<b.nbvar();i++)
00235 {
00236 #ifdef SYMBO
00237 tmploc= harewell<mpq_t >(stockmon.size(),stockmon.size());
00238 #endif
00239 matmul(m,i,dump,b,stockmon,serv);
00240 sprintf(nom,"m%d",i);
00241 printmatfile(m,nom,fic);
00242 #ifdef SYMBO
00243 for(int k=0;k<stockmon.size();k++)
00244 for(int l=0;l<stockmon.size();l++)
00245 harewell_set_coeff(tmploc,l,k,&m(k,l).rep());
00246 #endif
00247 lmat.push_back(m);
00248 loclmat.push_back(tmploc);
00249 }
00250 #ifdef SYMBO
00251 ptpol_t *res;
00252 res=(ptpol_t*)malloc((b.nbvar()+1)*sizeof(ptpol_t));
00253 for(int i=0;i<b.nbvar()+1;i++)
00254 ptpol_init(res[i]);
00255 symbo(res,loclmat, stockmon,dump,b);
00256 for(int i=0;i<b.nbvar()+1;i++)
00257 {
00258 ptpol_out_str(fic,res[i]);
00259 fprintf(fic,";\n");
00260 }
00261 #endif
00262
00263 #ifdef REALSOLVE
00264 if(argc>3)
00265 {
00266 cout<<"argv[3]"<<argv[3]<<endl;
00267 FILE *fic2;
00268 fic2=fopen(argv[3],"w");
00269 realsolve2(lmat,b,tmp);
00270 printmatfile(tmp,"sol",fic2);
00271 fclose(fic2);
00272 }
00273 #endif
00274 tmp.destroystore();m.destroystore();
00275
00276 }
00277
00278 #ifdef RS_OUT
00279 fic=fopen(argv[2],"w");
00280 rs_out(dump,b,fic);
00281 #endif
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297 sweep(dump,b);
00298
00299
00300
00301
00302 #ifdef WITH_TIMING
00303 cout<<"time in generickernel "<<tempsdssdp<<endl;
00304 cout<<"time in CSDP "<<tempsCDSP<<endl;
00305 #endif //WITH_TIMING
00306
00307 #endif //DENSE
00308 cout<<"argc"<<argc<<endl;
00309 }