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