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 #define MINMarta
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 cout<<"que pasa"<<endl;
00143 readfile(toto,argv[1]);
00144 #ifdef MINMarta
00145 cout<<"entra a leer funcion"<<endl;
00146 list<Poly> fun;
00147 printf("%s\n",argv[4]);fflush(stdout);
00148 cout<<"error antes de leer"<<endl;
00149 readfile(fun,argv[4]);
00150 cout<<"sale de leer funcion"<<endl;
00151 #endif
00152
00153 #ifndef DENSE
00154 #ifndef MINMarta
00155 algo<list<Poly>,list<pol<mon,COEFF> >,
00156 list<dumpstruct<pol<mon,COEFF> > >
00157 ,Base<predicat<mon> >, harewell >(toto,dump,b,serv);
00158 #else
00159 cout<<"entra en MinMarta "<<endl;
00160 algo<list<Poly>,list<pol<mon,COEFF> >,
00161 list<dumpstruct<pol<mon,COEFF> > >
00162 ,Base<predicat<mon> >, harewell>(toto,dump,b,serv,fun);
00163 #endif
00164 #else
00165 algo<list<Poly>,list<pol<mon,COEFF> >,
00166 list<dumpstruct<pol<mon,COEFF> > >
00167 ,Base<predicat<mon> >, harewell >(toto,dump,b);
00168 #endif
00169 cout<<"coucou"<<endl;
00170
00171 #ifdef AFFICHE
00172
00173 int total=0;
00174 for(list<dumpstruct<pol<mon,COEFF> > >::iterator iter=dump.begin();
00175 iter!=dump.end();iter++)
00176 for(int i=0;i<iter->size;i++)
00177 {
00178
00179 int nbzero=0;
00180 for(int j=0;j<iter->nf[i].size;j++)
00181 if(Iszero(iter->nf[i].nf[j])) nbzero++;
00182 cout<<invconv<Poly>(iter->nf[i])<<","<<endl;
00183 total+=iter->nf[i].size;
00184 cout<<" Size "<<iter->nf[i].size<<"nbzero "<<nbzero<<endl;
00185 }
00186 cout<<" Total memory size"<<total<<endl;
00187
00188 #endif
00189
00190 #ifndef DENSE
00191 cout<<"Number of solutions (with multiplicity): "<<countpoint(b,dump,serv)<<endl;
00192 #else
00193 cout<<"Number of solutions (with multiplicity): "<<countpoint(b,dump)<<endl;
00194 #endif
00195 cout <<"multi"<<endl;
00196 #ifndef DENSE
00197
00198 if(argc>2)
00199 {
00200 char nom[10];
00201 harewell<complex< long double> > tmp;
00202
00203 int i,j;
00204 list<mon>::iterator iterstock;
00205 computestockmon(stockmon,b,dump);
00206 cout<<"coputestockmon "<<stockmon.size()<<endl;
00207 list<harewell<mpq_t> > loclmat;
00208 harewell<mpq_t > tmploc;
00209 fic=fopen(argv[2],"w");
00210 fprintf(fic,"basis:=[");
00211
00212 iterstock=stockmon.begin();
00213 for(i=0;i<stockmon.size();i++,iterstock++)
00214 {
00215 bool mult=false;
00216 for( j=0;j<b.nbvar();j++) {
00217 if (iterstock->GetDegree(j)>1) {
00218 if (mult) fprintf(fic,"*");
00219 fprintf(fic,"x%d^%d",j,iterstock->GetDegree(j));
00220 mult=true;
00221 }
00222 else if (iterstock->GetDegree(j)>0) {
00223 if (mult) fprintf(fic,"*");
00224 fprintf(fic,"x%d",j);
00225 mult=true;
00226 } else if (!mult && j == b.nbvar()-1)
00227 fprintf(fic,"1");
00228 }
00229 if (i < stockmon.size()-1)
00230 fprintf(fic,",");
00231 else
00232 fprintf(fic,"];\n");
00233 }
00234
00235 for(int i=0;i<b.nbvar();i++)
00236 {
00237 #ifdef SYMBO
00238 tmploc= harewell<mpq_t >(stockmon.size(),stockmon.size());
00239 #endif
00240 matmul(m,i,dump,b,stockmon,serv);
00241 sprintf(nom,"m%d",i);
00242 printmatfile(m,nom,fic);
00243 #ifdef SYMBO
00244 for(int k=0;k<stockmon.size();k++)
00245 for(int l=0;l<stockmon.size();l++)
00246 harewell_set_coeff(tmploc,l,k,&m(k,l).rep());
00247 #endif
00248 lmat.push_back(m);
00249 loclmat.push_back(tmploc);
00250 }
00251 #ifdef SYMBO
00252 ptpol_t *res;
00253 res=(ptpol_t*)malloc((b.nbvar()+1)*sizeof(ptpol_t));
00254 for(int i=0;i<b.nbvar()+1;i++)
00255 ptpol_init(res[i]);
00256 symbo(res,loclmat, stockmon,dump,b);
00257 for(int i=0;i<b.nbvar()+1;i++)
00258 {
00259 ptpol_out_str(fic,res[i]);
00260 fprintf(fic,";\n");
00261 }
00262 #endif
00263
00264 #ifdef REALSOLVE
00265 if(argc>3)
00266 {
00267 cout<<"argv[3]"<<argv[3]<<endl;
00268 FILE *fic2;
00269 fic2=fopen(argv[3],"w");
00270 realsolve2(lmat,b,tmp);
00271 printmatfile(tmp,"sol",fic2);
00272 fclose(fic2);
00273 }
00274 #endif
00275 tmp.destroystore();m.destroystore();
00276
00277 }
00278
00279 #ifdef RS_OUT
00280 fic=fopen(argv[2],"w");
00281 rs_out(dump,b,fic);
00282 #endif
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298 sweep(dump,b);
00299
00300
00301
00302
00303 #ifdef WITH_TIMING
00304 cout<<"time in generickernel "<<tempsdssdp<<endl;
00305 cout<<"time in CSDP "<<tempsCDSP<<endl;
00306 #endif //WITH_TIMING
00307
00308 #endif //DENSE
00309 cout<<"argc"<<argc<<endl;
00310 }