Borderbasix

pol2bisspecial.hpp
Go to the documentation of this file.
1 #ifndef ALREADY_pol2bisspecial
2 #define ALREADY_pol2bisspecial
3 #ifndef LEVELSELECT
4 #define LEVELSELECT 1e-6
5 #endif
6 
7 using std::list;
8 using std::vector;
9 using std::cout;
10 using std::endl;
11 
12 void inverse(int*&, int);
13 template<typename mon, typename T,typename Base ,typename monomial_server>
14 mon choice_naif(const polbis<mon,T> & p, const Base &b, monomial_server &serv)
15 {
16  list<mon> tmp;
17  mon m;
18  int maxdeg=-1,k=0;
19  //int maxtmpdeg=0;
20  for(int i=0;i<p.sizenf;i++)
21  {
22  if (p.nfind[i])
23  for(int j=0;j<8;j++)
24  if(p.nfind[i]>>j&1)
25  {
26  mon tmpmon;
27  serv.int2mon(8*i+j,tmpmon);
28  if(tmpmon.GetDegree()>maxdeg)
29  {
30  tmp.erase(tmp.begin(),tmp.end());
31  maxdeg=tmpmon.GetDegree();
32  }
33  if(tmpmon.GetDegree()==maxdeg)
34  {
35  tmpmon.SetCoeff(p.nf[k]);
36  tmp.push_back(tmpmon);
37  }
38  k++;
39  }
40  }
41  m=tmp.front();
42  // cout<<"monom choisi "<<m<<endl;
43  return m;
44 }
45 
46 template<typename mon, typename T,typename Base, typename monomial_server>
47 mon choice_num(const polbis<mon,T> & p, const Base &b, monomial_server &serv)
48 {
49  list<mon> tmp;
50  mon m;
51  int maxdeg=-1,k=0;
52  //int maxtmpdeg=0;
53  for(int i=0;i<p.sizenf;i++)
54  {
55  if (p.nfind[i])
56  for(int j=0;j<8;j++)
57  if(p.nfind[i]>>j&1)
58  {
59  mon tmpmon;
60  serv.int2mon(8*i+j,tmpmon);
61  if(tmpmon.GetDegree()>maxdeg)
62  {
63  tmp.erase(tmp.begin(),tmp.end());
64  maxdeg=tmpmon.GetDegree();
65  }
66  if(tmpmon.GetDegree()==maxdeg)
67  {
68  tmpmon.SetCoeff(p.nf[k]);
69  tmp.push_back(tmpmon);
70  }
71  k++;
72  }
73  }
74  m=tmp.front();
75  for(typename list<mon>::iterator itertmp=tmp.begin();itertmp!=tmp.end();itertmp++)
76  {
77  if(m.GetCoeff()<itertmp->GetCoeff()) {m=*itertmp;};
78  }
79  // cout<<"monom choisi "<<m<<endl;
80  return m;
81 }
82 
83 template<typename mon, typename T,typename Base, typename monomial_server>
84 mon choice_grevlex(const polbis<mon,T> & p,const Base &b,
85  monomial_server &serv)
86 {
87  list<mon> tmp;
88  mon m;
89  int maxdeg=-1,k=0;
90  //int maxtmpdeg=0;
91  for(int i=0;i<p.sizenf;i++)
92  {
93  if (p.nfind[i])
94  for(int j=0;j<8;j++)
95  if(p.nfind[i]>>j&1)
96 
97  {
98  mon tmpmon;
99  serv.int2mon(8*i+j,tmpmon);
100  if(tmpmon.GetDegree()>maxdeg)
101  {
102  tmp.erase(tmp.begin(),tmp.end());
103  maxdeg=tmpmon.GetDegree();
104  }
105  if(tmpmon.GetDegree()==maxdeg)
106  {
107  tmpmon.SetCoeff(p.nf[k]);
108  tmp.push_back(tmpmon);
109  }
110  k++;
111  }
112  }
113  m=tmp.front();
114  for(typename list<mon>::iterator itertmp=tmp.begin();itertmp!=tmp.end();itertmp++)
115  {
116  if(my_ord(*itertmp,m)<0) {m=*itertmp;};
117  }
118  // cout<<"monom choisi "<<m<<endl;
119  return m;
120 }
121 
122 template<typename mon, typename T,typename Base, typename monomial_server>
124 {
125  list<mon> tmp;
126  mon m;
127  int maxdeg=-1,k=0;
128  //int maxtmpdeg=0;
129  for(int i=0;i<p.sizenf;i++)
130  {
131  if (p.nfind[i])
132  for(int j=0;j<8;j++)
133  if(p.nfind[i]>>j&1)
134  {
135  mon tmpmon;
136  serv.int2mon(8*i+j,tmpmon);
137  if(tmpmon.GetDegree()>maxdeg)
138  {
139  tmp.erase(tmp.begin(),tmp.end());
140  maxdeg=tmpmon.GetDegree();
141  }
142  if(tmpmon.GetDegree()==maxdeg)
143  {
144  tmpmon.SetCoeff(p.nf[k]);
145  tmp.push_back(tmpmon);
146  }
147  k++;
148  }
149  }
150  m=tmp.front();
151  for(typename list<mon>::iterator itertmp=tmp.begin();itertmp!=tmp.end();itertmp++)
152  {
153  if(my_ord(*itertmp,m)>0) {m=*itertmp;};
154  }
155  // cout<<"monom choisi "<<m<<endl;
156  return m;
157 }
158 
159 
160 template<typename mon, typename T,typename Base, typename monomial_server>
161 mon choice_mac(const polbis<mon,T> & p,const Base &b, monomial_server &serv)
162 {
163  list<mon> tmp;
164  mon m;
165  int maxdeg=-1,k=0;
166  int maxtmpdeg=0;
167  for(int i=0;i<p.sizenf;i++)
168  {
169  if (p.nfind[i])
170  for(int j=0;j<8;j++)
171  if(p.nfind[i]>>j&1)
172  {
173  mon tmpmon;
174  serv.int2mon(8*i+j,tmpmon);
175  if(tmpmon.GetDegree()>maxdeg)
176  {
177  tmp.erase(tmp.begin(),tmp.end());
178  maxdeg=tmpmon.GetDegree();
179  }
180  if(tmpmon.GetDegree()==maxdeg)
181  {
182  tmpmon.SetCoeff(p.nf[k]);
183  tmp.push_back(tmpmon);
184  }
185  k++;
186  }
187  }
188  m=tmp.front();
189  for(typename list<mon>::iterator itertmp=tmp.begin();itertmp!=tmp.end();itertmp++)
190  {
191  //cout<<"monomes regarde "<<*itertmp<<" Lavr "<<lvar(itertmp->rep)<<endl;
192  for(int i=0;i<=lvar(itertmp->rep);i++)
193  {
194  if(itertmp->GetDegree(i)>=maxtmpdeg)
195  {
196  maxtmpdeg=itertmp->GetDegree(i);
197  m=*itertmp;
198  }
199  }
200  }
201  return m;
202 }
203 
204 
205 template<typename mon, typename T,typename Base, typename monomial_server>
206 mon choice_mpq(const polbis<mon,T> & p,const Base &b, monomial_server &serv)
207 {
208  int i,degp=Degree(p),k=0;
209  int mini=INT_MAX;
210  mon tmpmon;
211  mon stockmon;
212  for(i=0;i<p.sizenf;i++)
213  if(p.nfind[i])
214  for(int j=0;j<8;j++)
215  if(p.nfind[i]>>j&1)
216  {
217  serv.int2mon(8*i+j,tmpmon);
218  if(tmpmon.GetDegree()==degp)
219  {
220  __mpz_struct *numref,*denref;
221  numref=mpq_numref(&(p.nf[k].rep()));
222  denref=mpq_denref(&(p.nf[k].rep()));
223  if(mpz_size(numref)+
224  mpz_size(denref)<mini)
225  {
226  mini=mpz_size(mpq_numref(&(p.nf[k].rep())))+
227  mpz_size(mpq_denref(&(p.nf[k].rep())));
228  //cout<<"newmax "<<max<<endl;
229  //cout<<" les monomes "<<*iter<<endl;
230  stockmon=tmpmon*p.nf[k];
231  }
232  }
233  k++;
234  }
235  //cout<<"je retourne "<<stockmon<<endl;
236  return stockmon;
237 }
238 
239 template<typename mon, typename T, typename Base, typename monomial_server>
240 mon choice_fall(const polbis<mon,T> & p, const Base &b, monomial_server &serv)
241 {
242  int i,k=0;
243  int maxi=-1;
244  mon tmpmon;
245  mon stockmon;
246  mon res=choice_mac(p,b,serv);
247  typename Base::const_iterator iterb;
248  list<mon> tmplist;
249  int degp=Degree(p,serv);
250 #ifdef DEB
251  cout<<"Degree(p) "<<degp<<endl;
252 #endif
253  for(i=0;i<p.sizenf;i++)
254  if(p.nfind[i])
255  for(int j=0;j<8;j++)
256  if((p.nfind[i]>>j)&1)
257  {
258  serv.int2mon(8*i+j,tmpmon);
259  if (tmpmon.GetDegree()==degp)// && (!Iszero(p.nf[k])))
260  tmplist.push_back(tmpmon*p.nf[k]);
261  k++;
262  // cout<<"k "<<k<<" "<<tmpmon<<endl;
263  }
264  for(typename list<mon>::iterator iterlist=tmplist.begin()
265  ;iterlist!=tmplist.end();iterlist++)
266  {
267  for(iterb=b.begin();iterb!=b.end();iterb++)
268  {
269  int isgood=0;
270  for(int i=0;i<iterb->taille1;i++)
271  if(isdivisible(iterb->accept[i],*iterlist,b))
272  {isgood=1;break;}
273  for(int i=0;i<iterb->taille2;i++)
274  if(isdivisible(iterb->refuse[i],*iterlist,b))
275  {isgood=0;break;}
276  if(isgood)
277  {
278 
279  for(int i=0;i<iterb->taille2;i++)
280  {
281  mon m=lcm(*iterlist,iterb->refuse[i]);
282  int dist=0;
283  for(int j=0;j<iterb->taille2;j++)
284  if ((j!=i) && (isdivisible(iterb->refuse[j],m,b)))
285  isgood=0;
286  if(isgood)
287  {
288  for(int j=0;j<b.nbvar();j++)
289  if(m.GetDegree(j)>iterb->refuse[i].GetDegree(j))
290  dist+=m.GetDegree(j)-iterb->refuse[i].GetDegree(j);
291  if(dist>maxi)
292  {
293  res=*iterlist;
294  maxi=dist;
295  }
296  }
297  }
298  }
299 
300  }
301  }
302 #ifdef BONRAJOUT
303  cout<<"le pol "<<invconv<Poly>(p)<<endl<<"le mon choisi "<<res<<endl;
304 #endif
305  return res;
306 }
307 
308 
309 template<typename mon, typename T, int alpha,typename Base, typename monomial_server>
311 const Base &b, monomial_server &serv)
312 {
313  return choice_fall(pol,b,serv);
314 }
315 template<typename mon, typename T, typename Base, typename monomial_server>
317 {
318  int i,k=0;
319  int maxi=-1;
320  mon tmpmon;
321  mon stockmon;
322  mon res=choice_mac(p,b,serv);
323  //cout<<"monome choisi "<<res<<endl;
324  typename Base::const_iterator iterb;
325  list<mon> tmplist;
326  int degp=Degree(p,serv);
327  typename mon::coeff_t maxcoeff=0;
328  for(i=0;i<p.sizenf;i++)
329  if(p.nfind[i])
330  for(int j=0;j<8;j++)
331  if((p.nfind[i]>>j)&1)
332  {
333  serv.int2mon(8*i+j,tmpmon);
334  if (tmpmon.GetDegree()==degp)// && (!Iszero(p.nf[k])))
335  tmplist.push_back(tmpmon*p.nf[k]);
336  k++;
337  // cout<<"k "<<k<<" "<<tmpmon<<endl;
338  }
339  for(typename list<mon>::iterator iterlist=tmplist.begin()
340  ;iterlist!=tmplist.end();iterlist++)
341  {
342  if(maxcoeff<iterlist->GetCoeff())
343  maxcoeff=iterlist->GetCoeff();
344  if(maxcoeff<-1*iterlist->GetCoeff())
345  maxcoeff=-1*iterlist->GetCoeff();
346 
347  }
348  for(typename list<mon>::iterator iterlist=tmplist.begin()
349  ;iterlist!=tmplist.end();iterlist++)
350  {
351  if((iterlist->GetCoeff()<0?-1*iterlist->GetCoeff():iterlist->GetCoeff())
352  <LEVELSELECT*maxcoeff)
353  continue;
354 
355  for(iterb=b.begin();iterb!=b.end();iterb++)
356  {
357  int isgood=0;
358  for(int i=0;i<iterb->taille1;i++)
359  if(isdivisible(iterb->accept[i],*iterlist,b))
360  {isgood=1;break;}
361  for(int i=0;i<iterb->taille2;i++)
362  if(isdivisible(iterb->refuse[i],*iterlist,b))
363  {isgood=0;break;}
364  if(isgood)
365  {
366 
367  for(int i=0;i<iterb->taille2;i++)
368  {
369  mon m=lcm(*iterlist,iterb->refuse[i]);
370  int dist=0;
371  for(int j=0;j<iterb->taille2;j++)
372  if ((j!=i) && (isdivisible(iterb->refuse[j],m,b)))
373  isgood=0;
374  if(isgood)
375  {
376  for(int j=0;j<b.nbvar();j++)
377  if(m.GetDegree(j)>iterb->refuse[i].GetDegree(j))
378  dist+=m.GetDegree(j)-iterb->refuse[i].GetDegree(j);
379  if(dist>maxi)
380  {
381  res=*iterlist;
382  maxi=dist;
383  }
384  }
385  }
386  }
387 
388  }
389  }
390  // cout<<"pol especial"<<invconv<Poly>(p,serv)<<endl;
391  // cout<<"le mon choisi "<<res<<endl;
392  return res;
393 }
394 
395 template <typename T,typename mono, typename workspace>
396 list<polbis<mono,T> >& SolveUold(const harewell<T> & u ,list<polbis<mono,T> > &Pk
397  ,workspace &w)
398 {
399  typedef list<polbis<mono,T> > typPk;
400  typedef typename typPk::value_type elem_typ;
401  typedef typename elem_typ::monom_t mon;
402  typedef typename elem_typ::coeff_t coeff;
403  int t;
404  vector<polbis<mono,T> > tmpPk;
405  for(typename typPk::iterator iter=Pk.begin();iter!=Pk.end();iter++)
406  tmpPk.push_back(*iter);
407  Pk.erase(Pk.begin(),Pk.end());
408 
409  for(int i=u.ncol-1;i>=0;i--)
410  // if (!Iszero(u(i,i)))
411  {
412  T mult_coeff=(T)1;
413  for (int j=(t=(i==(u.ncol-1))?(u.nnz-1):(u.colptr[i+1]-1))
414  ;(j>=(u.colptr)[i]);j--)
415  if (i==u.rowind[j])
416  {
417  mult_coeff=((T*)u.nzval)[j];
418  // cout<<"mult_coeff "<<i<<" "<<mult_coeff<<endl;
419  }
420  if(Iszero(mult_coeff)) continue;
421  mult_coeff=((coeff)1)/mult_coeff;
422  for (int j=(t=(i==(u.ncol-1))?(u.nnz-1):(u.colptr[i+1]-1))
423  ;(j>=(u.colptr)[i]);j--)
424  {
425  //cout<<"j "<<j<<" i "<<i<<" rowind[j] "<<u.rowind[j]<<endl;
426  if (i==u.rowind[j])//t==j
427  {
428  if (Iszero(((T*)u.nzval)[j]))
429  //le system est il "degenere"?
430  {//elemwrite(Pk,u.rowind[j],(elem_typ)(0));continue;}
431  //cout<<"M#rde ici ligne "<<i<<endl;
432  //exit(-1);
433  break;
434  }
435  //oui on met 0 et on a
436  //plus rien a faire pour cette colonne
437  else//non on calcule
438  {
439  //cout<<"Dans solveU le coeff vaut"
440  // <<((coeff*)u.nzval)[j]<<endl;
441  mult_coeff=coeff(1);
442  //elemwrite(Pk,u.rowind[j],
443  //elemread(Pk,u.rowind[j])=
444 
445  // elemread(Pk,u.rowind[j])*
446  //cout<<"rowind[i] "<<u.rowind[i]<<endl;
447  tmpPk[u.rowind[j]]*
448  (coeff)(((coeff)(1)/((coeff*)u.nzval)[j]));
449  }
450  }
451  else {
452  if(((T*)u.nzval)[j]!=(coeff)0)
453  {
454  //cout<<"((coeff*)u.nzval)[j]"<<((coeff*)u.nzval)[j]<<endl;
455  //elemread(Pk,i)=
456  //elemread(Pk,i)*mon((coeff)(((coeff*)u.nzval)[j]/mult_coeff));
457  my_plus(tmpPk[u.rowind[j]],
458  tmpPk[i],((coeff)(((coeff*)u.nzval)[j]*mult_coeff))
459  ,&w);
460  //elemread(Pk,i)=
461  // elemread(Pk,i)*((coeff)(mult_coeff/(((coeff*)u.nzval)[j])));
462  }
463  }
464  }
465  }
466  typename list<polbis<mono, T> >::iterator iterPk=Pk.begin();
467  for(typename vector<polbis<mono , T> >::iterator iter=tmpPk.begin()
468  ;iter!=tmpPk.end();iter++)
469  Pk.push_back(*iter);
470 
471 //cout<<"exit SolveU"<<endl;
472  return Pk;
473 }
474 template <typename T,typename mono, typename workspace>
475 list<polbis<mono,T> >& SolveU(const harewell<T> & u ,list<polbis<mono,T> > &Pk
476  ,workspace &w)
477 {
478  typedef list<polbis<mono,T> > typPk;
479  typedef typename typPk::value_type elem_typ;
480  typedef typename elem_typ::monom_t mon;
481  typedef typename elem_typ::coeff_t coeff;
482  int t;
483  vector<polbis<mono,T> > tmpPk;
484  for(typename typPk::iterator iter=Pk.begin();iter!=Pk.end();iter++)
485  tmpPk.push_back(*iter);
486  Pk.erase(Pk.begin(),Pk.end());
487 
488  for(int i=u.ncol-1;i>=0;i--)
489  {
490  T mult_coeff=(T)1;
491  for (int j=(t=(i==(u.ncol-1))?(u.nnz-1):(u.colptr[i+1]-1))
492  ;(j>=(u.colptr)[i]);j--)
493  if (i==u.rowind[j])
494  {
495  mult_coeff=((T*)u.nzval)[j];
496  }
497  if(Iszero(mult_coeff)) continue;
498  mult_coeff=((coeff)1)/mult_coeff;
499  tmpPk[i]*mult_coeff;
500  for (int j=(t=(i==(u.ncol-1))?(u.nnz-1):(u.colptr[i+1]-1))
501  ;(j>=(u.colptr)[i]);j--)
502  {
503  if (i!=u.rowind[j])//t==j
504  if(((T*)u.nzval)[j]!=(coeff)0)
505  {
506  my_plus(tmpPk[u.rowind[j]],
507  tmpPk[i],((coeff*)u.nzval)[j]
508  ,&w);
509  }
510  }
511  }
512  typename list<polbis<mono, T> >::iterator iterPk=Pk.begin();
513  for(typename vector<polbis<mono , T> >::iterator iter=tmpPk.begin()
514  ;iter!=tmpPk.end();iter++)
515  Pk.push_back(*iter);
516  return Pk;
517 }
518 
519 template <typename T,typename mono, typename workspace>
520 list<polbis<mono,T> >& SolveL(const harewell<T> &l,list<polbis<mono,T> > &Pk
521  ,workspace &w)
522 {
523  typedef list<polbis<mono,T> > typPk;
524  typedef typename typPk::value_type elem_typ;
525  typedef typename elem_typ::monom_t mon;
526  typedef typename elem_typ::coeff_t coeff;
527  // elem_typ tmp;
528  //cout<<"l.nnz "<<l.nnz<<endl;
529  //cout<<"l.nzval "<<l.nzval<<endl;
530  //cout<<"l.rowind "<<l.rowind<<endl;
531  // affdebug(l);
532  vector<polbis<mono,T> > tmpPk;
533  for(typename typPk::iterator iter=Pk.begin();iter!=Pk.end();iter++)
534  tmpPk.push_back(*iter);
535  Pk.erase(Pk.begin(),Pk.end());
536 
537  for(int i=0;i<l.ncol;i++)
538  {
539  int j=l.colptr[i];
540 #if 0
541  for (;(j<l.nnz-1)&&(j<(l.colptr)[i+1]-1);j+=2)
542  {
543  if (i==l.rowind[j])
544  {
545  my_plus(tmpPk[l.rowind[j+1]]
546  ,tmpPk[i],(((coeff*)l.nzval)[j+1]));
547  }
548  else
549  if (i==l.rowind[j+1])
550  {
551  my_plus(tmpPk[l.rowind[j]]
552  ,tmpPk[i],(((coeff*)l.nzval)[j]));
553  }
554  else
555  {
556  //if((((coeff*)l.nzval)[j])!=(coeff)0)
557  {
558  my_plus2(tmpPk[l.rowind[j]],tmpPk[l.rowind[j+1]]
559  ,tmpPk[i],(((coeff*)l.nzval)[j])
560  ,(((coeff*)l.nzval)[j+1]));
561  //cout<<"pointeurs apres "<<elemread(Pk,l.rowind[j]).nfind<<endl;
562  //elemread(Pk,i)*(coeff)((coeff)1/((coeff*)l.nzval)[j]);
563  }
564  }
565  }
566 #endif
567  for (;(j<l.nnz)&&(j<(l.colptr)[i+1]);j++)
568  {
569  if (i==l.rowind[j])
570  {
571  //cout<<"j vaut "<<j<<endl;
572  //cout<<"l.rowind["<<j<<"] "<<l.rowind[j]<<endl;
573  //cout<<"l.nzval[j] "<<(((coeff *)l.nzval))[j]<<endl;
574  //tmp=elemread(Pk,l.rowind[j]);
575  // cout<<"Dans SolveL le coeff vaut "<< (1)/((((coeff *)l.nzval))[j])
576  // <<endl;
577  //elemwrite(Pk,l.rowind[j],
578  // tmp=tmp*(coeff)((coeff)(1)/((((coeff *)l.nzval))[j]));
579  }
580  else
581  {
582  if((((coeff*)l.nzval)[j])!=(coeff)0)
583  {
584  // cout<<"I vaut "<<i<<endl;
585  //cout<<"j vaut "<<j<<endl;
586  // cout<<"l.rowind["<<j<<"] "<<l.rowind[j]<<endl;
587  //cout<<"l.nzval[j]"<<((coeff*)l.nzval)[j]<<endl;
588 // cout<<"Q.size vaut "<<(elemread(Pk,i).size)<<endl;
589  //cout<<"pointeurs avant "<<elemread(Pk,l.rowind[j]).nfind<<endl;
590  my_plus(tmpPk[l.rowind[j]]
591  ,tmpPk[i],(((coeff*)l.nzval)[j]),&w);
592  //cout<<"pointeurs apres "<<elemread(Pk,l.rowind[j]).nfind<<endl;
593  //elemread(Pk,i)*(coeff)((coeff)1/((coeff*)l.nzval)[j]);
594  }
595  }
596  }
597  }
598  typename list<polbis<mono, T> >::iterator iterPk=Pk.begin();
599  for(typename vector<polbis<mono , T> >::iterator iter=tmpPk.begin()
600  ;iter!=tmpPk.end();iter++,iterPk++)
601  Pk.push_back(*iter);
602  //*iterPk=*iter;
603  return Pk;
604 }
605 
606 
607 template<typename typmat ,typename T, typename mono, typename workspace>
608 list<polbis<mono,T> > &
609 Solve(typmat &S, std::list< polbis<mono,T> > &TildePk,int **pr,int **pc
610  ,workspace &w)
611 {
612  typmat L,U;
613  typedef list< polbis<mono,T> > typPk;
614  int *Pr,*Pc;
615  LUdecomp(S,&L,&U,&Pr,&Pc);
616  inverse(Pr,L.nrow);
617  Dopermu(TildePk,Pr);
618  SolveL(L,TildePk,w);
619  SolveU(S,TildePk,w);//SolveU(S,TildePk);
620  *pc=Pc;*pr=Pr;
621  L.destroystore();
622  return TildePk;
623 }
624 
625 template<typename typmat ,typename T, typename mono, typename workspace>
626 list<polbis<mono,T> > &
627 Solve(typmat &S, typmat &L,
628  std::list< polbis<mono,T> > &TildePk,int **pr,int **pc
629  ,workspace &w)
630 {
631  typmat U;
632  typedef list< polbis<mono,T> > typPk;
633  int *Pr,*Pc;//,maxsize=0;
634  std::vector< polbis<mono,T> > localPk(TildePk.size());
635  copy(TildePk.begin(),TildePk.end(),localPk.begin());
636  //cout<<"M en entree"<<endl;
637  //affdebug(S);
638  //cout<<"apres aff"<<endl;
639  LUdecomp(S,&L,&U,&Pr,&Pc);
640 // cout<<"perm row"<<endl;
641 // for(int i=0;i<L.nrow;i++)
642 // cout<<Pr[i]<<" ";
643 // cout<<endl;
644 // cout<<"perm col"<<endl;
645 // for(int i=0;i<S.ncol;i++)
646 // cout<<Pc[i]<<" ";
647 // cout<<endl;
648 
649  inverse(Pr,L.nrow);
650  //cout<<"error inerse"<<endl;
651  // Dopermu(TildePk,Pr);
652  Dopermu(localPk,Pr);
653  //cout<<"error perm"<<endl;
654  //SolveL(L,TildePk,w);
655  SolveL(L,localPk,w);
656  //cout<<"error solveL"<<endl;
657  SolveU(S,localPk,w);//SolveU(S,TildePk);
658  // SolveU(S,TildePk,w);//SolveU(S,TildePk);
659  // cout<<"L"<<endl;
660  //affdebug(L);
661  //cout<<"S"<<endl;
662  //affdebug(S);
663  *pc=Pc;*pr=Pr;
664  copy(localPk.begin(),localPk.end(),TildePk.begin());
665  return TildePk;
666 }
667 
668 
669 
670 #endif //ALREADY_pol2bisspecial
void int2mon(const int &i, mon &res)
Definition: placemon3.hpp:664
Definition: workspace.hpp:11
void my_plus2(pol &res1, pol &res2, const pol &nf, const coeff &toto1, const coeff &toto2)
Definition: corealgo.hpp:377
list< polbis< mono, T > > & Solve(typmat &S, std::list< polbis< mono, T > > &TildePk, int **pr, int **pc, workspace &w)
Definition: pol2bisspecial.hpp:609
void my_plus(pol &res, const pol &nf, const coeff toto)
Definition: corealgo.hpp:543
int isdivisible(const mon &m1, const mon &m2, int nbvar)
Definition: isdivisible.hpp:5
int lvar(const dynamicexp< X, E > &A)
Definition: dynamicexp.hpp:178
T * nf
Definition: pol2bis.hpp:17
C GetCoeff() const
Definition: Monom.hpp:67
Definition: pol.hpp:6
int my_ord(const mon &m1, const mon &m2)
Definition: ord.hpp:2
void inverse(int *&, int)
list< predicat >::const_iterator const_iterator
Definition: types.hpp:21
#define LEVELSELECT
Definition: pol2bisspecial.hpp:4
mon choice_naif(const polbis< mon, T > &p, const Base &b, monomial_server &serv)
Definition: pol2bisspecial.hpp:14
int nbvar()
Definition: types.hpp:37
mon choice_grevlex(const polbis< mon, T > &p, const Base &b, monomial_server &serv)
Definition: pol2bisspecial.hpp:84
MSKconetypee MSKrealt MSKint32t MSKint32t j
Definition: mosek.h:2421
MSKint32t k
Definition: mosek.h:2713
Definition: Zp.hpp:19
C coeff_t
Definition: Monom.hpp:26
Definition: placemon3.hpp:14
dynamicexp< X, E >::degree_t Degree(const dynamicexp< X, E > &t)
Definition: dynamicexp.hpp:91
iterator end()
Definition: types.hpp:30
list< polbis< mono, T > > & SolveL(const harewell< T > &l, list< polbis< mono, T > > &Pk, workspace &w)
Definition: pol2bisspecial.hpp:520
Mon mon
Definition: solver_bb_floating.cpp:136
Definition: types.hpp:14
exponent_t GetDegree() const
Definition: Monom.hpp:70
mon choice_num(const polbis< mon, T > &p, const Base &b, monomial_server &serv)
Definition: pol2bisspecial.hpp:47
mon choice_fall(const polbis< mon, T > &p, const Base &b, monomial_server &serv)
Definition: pol2bisspecial.hpp:240
MSKint32t MSKint32t MSKint32t i
Definition: mosek.h:2278
mon choice_mac(const polbis< mon, T > &p, const Base &b, monomial_server &serv)
Definition: pol2bisspecial.hpp:161
int Iszero(const Scl< MPQ > &c)
Definition: Iszero.hpp:14
mon choice_dlex(const polbis< mon, T > &p, const Base &b, monomial_server &serv)
Definition: pol2bisspecial.hpp:123
list< polbis< mono, T > > & SolveU(const harewell< T > &u, list< polbis< mono, T > > &Pk, workspace &w)
Definition: pol2bisspecial.hpp:475
mon lcm(const mon &m1, const mon &m2)
Definition: corealgo.hpp:43
mon choice_fall_num(const polbis< mon, Z< alpha, T > > &pol, const Base &b, monomial_server &serv)
Definition: pol2bisspecial.hpp:310
iterator begin()
Definition: types.hpp:25
Definition: pol2bis.hpp:12
void SetCoeff(const C &c)
Definition: Monom.hpp:68
Multivariate monomials.
Definition: Monom.hpp:21
unsigned char * nfind
Definition: pol2bis.hpp:18
list< polbis< mono, T > > & SolveUold(const harewell< T > &u, list< polbis< mono, T > > &Pk, workspace &w)
Definition: pol2bisspecial.hpp:396
int sizenf
Definition: pol2bis.hpp:19
mon choice_mpq(const polbis< mon, T > &p, const Base &b, monomial_server &serv)
Definition: pol2bisspecial.hpp:206
Home  |  Download & InstallContributions