include/borderbasix/polspecial.cc File Reference

Go to the source code of this file.

Functions


Function Documentation

mon choice_dlex ( const pol< mon, T > &  p,
const Base b 
) [inline]

Definition at line 70 of file polspecial.cc.

References int2mon(), Iszero(), my_ord(), pol< mon, T >::nf, and pol< mon, T >::size.

00071 {
00072   list<mon> tmp;
00073   mon m; 
00074   int maxdeg=-1;
00075   //int maxtmpdeg=0;
00076   for(int i=0;i<p.size;i++)
00077     {
00078       if (!Iszero(p.nf[i]))
00079         {
00080           mon tmpmon;
00081           int2mon(i,tmpmon);
00082           if(tmpmon.GetDegree()>maxdeg)
00083             {
00084               tmp.erase(tmp.begin(),tmp.end());
00085               maxdeg=tmpmon.GetDegree();
00086             }
00087           if(tmpmon.GetDegree()==maxdeg)
00088             {
00089               tmpmon.SetCoeff(p.nf[i]);
00090               tmp.push_back(tmpmon);
00091             }
00092         }
00093     }
00094   m=tmp.front();
00095   for(typename list<mon>::iterator itertmp=tmp.begin();itertmp!=tmp.end();itertmp++)
00096     {
00097       if(my_ord(*itertmp,m)>0) {m=*itertmp;};
00098     }
00099   //  cout<<"monom choisi "<<m<<endl;
00100   return m;
00101 }

mon choice_fall ( const pol< mon, T > &  p,
const Base b 
) [inline]

Definition at line 175 of file polspecial.cc.

References Base< predicat >::begin(), choice_mac(), Degree(), Base< predicat >::end(), int2mon(), isdivisible(), Iszero(), lcm(), Base< predicat >::nbvar(), pol< mon, T >::nf, and pol< mon, T >::size.

00176 {
00177   int i;
00178   int maxi=-1;
00179   mon tmpmon;
00180   mon stockmon;
00181   mon res=choice_mac(p,b);
00182   typename Base::const_iterator iterb;
00183   list<mon> tmplist;
00184   int degp=Degree(p);
00185   
00186   for(i=0;i<p.size;i++)
00187     if(!Iszero(p.nf[i]))
00188       {
00189         int2mon(i,tmpmon);
00190         if(tmpmon.GetDegree()==degp)
00191           tmplist.push_back(tmpmon*p.nf[i]);
00192         //cout<<" k "<<i<<endl;
00193       }
00194   for(typename list<mon>::iterator iterlist=tmplist.begin()
00195         ;iterlist!=tmplist.end();iterlist++)
00196     {
00197       for(iterb=b.begin();iterb!=b.end();iterb++)
00198         {
00199           int isgood=0;
00200           for(int i=0;i<iterb->taille1;i++)
00201             if(isdivisible(iterb->accept[i],*iterlist,b))
00202               {isgood=1;break;}
00203           for(int i=0;i<iterb->taille2;i++)
00204             if(isdivisible(iterb->refuse[i],*iterlist,b))
00205               {isgood=0;break;}
00206           if(isgood)
00207             {
00208 
00209               for(int i=0;i<iterb->taille2;i++)
00210                 {
00211                   mon m=lcm(*iterlist,iterb->refuse[i]);
00212                   int dist=0;
00213                   for(int j=0;j<iterb->taille2;j++)
00214                     if ((j!=i) && (isdivisible(iterb->refuse[j],m,b)))
00215                       isgood=0;
00216                   if(isgood)
00217                     {
00218                       for(int j=0;j<b.nbvar();j++)
00219                         if(m.GetDegree(j)>iterb->refuse[i].GetDegree(j))
00220                           dist+=m.GetDegree(j)-iterb->refuse[i].GetDegree(j);
00221                       if(dist>maxi)
00222                         {
00223                           res=*iterlist;
00224                           maxi=dist;
00225                         }
00226                     }
00227                 }
00228             }
00229           
00230         }
00231     }
00232   //cout<<"le pol "<<invconv<Poly>(p)<<endl<<"le mon choisi "<<res<<endl;
00233   return res;
00234 }

mon choice_grevlex ( const pol< mon, T > &  p,
const Base b 
) [inline]

Definition at line 36 of file polspecial.cc.

References int2mon(), Iszero(), my_ord(), pol< mon, T >::nf, and pol< mon, T >::size.

00037 {
00038   list<mon> tmp;
00039   mon m; 
00040   int maxdeg=-1;
00041   //int maxtmpdeg=0;
00042   for(int i=0;i<p.size;i++)
00043     {
00044       if (!Iszero(p.nf[i]))
00045         {
00046           mon tmpmon;
00047           int2mon(i,tmpmon);
00048           if(tmpmon.GetDegree()>maxdeg)
00049             {
00050               tmp.erase(tmp.begin(),tmp.end());
00051               maxdeg=tmpmon.GetDegree();
00052             }
00053           if(tmpmon.GetDegree()==maxdeg)
00054             {
00055               tmpmon.SetCoeff(p.nf[i]);
00056               tmp.push_back(tmpmon);
00057             }
00058         }
00059     }
00060   m=tmp.front();
00061   for(typename list<mon>::iterator itertmp=tmp.begin();itertmp!=tmp.end();itertmp++)
00062     {
00063       if(my_ord(*itertmp,m)<0) {m=*itertmp;};
00064     }
00065   // cout<<"monom choisi "<<m<<endl;
00066   return m;
00067 }

mon choice_mac ( const pol< mon, T > &  p,
const Base b 
) [inline]

Definition at line 105 of file polspecial.cc.

References int2mon(), Iszero(), pol< mon, T >::nf, and pol< mon, T >::size.

00106 {
00107   list<mon> tmp;
00108   mon m; 
00109   int maxdeg=-1;
00110   int maxtmpdeg=0;
00111   for(int i=0;i<p.size;i++)
00112     {
00113       if (!Iszero(p.nf[i]))
00114         {
00115           mon tmpmon;
00116           int2mon(i,tmpmon);
00117           if(tmpmon.GetDegree()>maxdeg)
00118             {
00119               tmp.erase(tmp.begin(),tmp.end());
00120               maxdeg=tmpmon.GetDegree();
00121             }
00122           if(tmpmon.GetDegree()==maxdeg)
00123             {
00124               tmpmon.SetCoeff(p.nf[i]);
00125               tmp.push_back(tmpmon);
00126             }
00127         }
00128     }
00129   m=tmp.front();
00130   for(typename list<mon>::iterator itertmp=tmp.begin();itertmp!=tmp.end();itertmp++)
00131     {
00132       //cout<<"monomes regarde "<<*itertmp<<" Lavr  "<<lvar(itertmp->rep)<<endl;
00133       for(int i=0;i<=lvar(itertmp->rep);i++)
00134         {
00135           if(itertmp->GetDegree(i)>=maxtmpdeg)
00136             {
00137               maxtmpdeg=itertmp->GetDegree(i);
00138               m=*itertmp;
00139             }
00140         }
00141     }
00142   return m;
00143 }

mon choice_mpq ( const pol< mon, T > &  p,
const Base b 
) [inline]

Definition at line 147 of file polspecial.cc.

References Degree(), int2mon(), Iszero(), pol< mon, T >::nf, and pol< mon, T >::size.

00148 {
00149   int i,degp=Degree(p);
00150   int mini=INT_MAX;
00151   mon tmpmon;
00152   mon stockmon;
00153   for(i=0;i<p.size;i++)
00154     if(!Iszero(p.nf[i]))
00155       {
00156         int2mon(i,tmpmon);
00157         if(tmpmon.GetDegree()==degp)
00158           {
00159             if(mpz_size(mpq_numref(&(p.nf[i].rep())))+
00160                mpz_size(mpq_denref(&(p.nf[i].rep())))<mini) 
00161               {
00162                 mini=mpz_size(mpq_numref(&(p.nf[i].rep())))+
00163                   mpz_size(mpq_denref(&(p.nf[i].rep())));
00164                 //cout<<"newmax "<<max<<endl;
00165                 //cout<<" les monomes "<<*iter<<endl;
00166                 stockmon=tmpmon*p.nf[i];
00167               }
00168           }
00169       }
00170   //cout<<"je retourne "<<stockmon<<endl;
00171   return stockmon;
00172 }

mon choice_naif ( const pol< mon, T > &  p,
const Base b 
) [inline]

Definition at line 2 of file polspecial.cc.

References int2mon(), Iszero(), pol< mon, T >::nf, and pol< mon, T >::size.

00003 {
00004   list<mon> tmp;
00005   mon m; 
00006   int maxdeg=-1;
00007   //int maxtmpdeg=0;
00008   for(int i=0;i<p.size;i++)
00009     {
00010       if (!Iszero(p.nf[i]))
00011         {
00012           mon tmpmon;
00013           int2mon(i,tmpmon);
00014           if(tmpmon.GetDegree()>maxdeg)
00015             {
00016               tmp.erase(tmp.begin(),tmp.end());
00017               maxdeg=tmpmon.GetDegree();
00018             }
00019           if(tmpmon.GetDegree()==maxdeg)
00020             {
00021               tmpmon.SetCoeff(p.nf[i]);
00022               tmp.push_back(tmpmon);
00023             }
00024         }
00025     }
00026   m=tmp.front();
00027   for(typename list<mon>::iterator itertmp=tmp.begin();itertmp!=tmp.end();itertmp++)
00028     {
00029       if(m.GetCoeff()<itertmp->GetCoeff()) {m=*itertmp;};
00030     }
00031   //  cout<<"monom choisi "<<m<<endl;
00032   return m;
00033 }


Generated on 6 Dec 2012 for borderbasix by  doxygen 1.6.1