Changeset f11ea16 in git for libpolys/polys


Ignore:
Timestamp:
Aug 14, 2011, 6:11:52 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
2cae9214dc99498e560e328e02d738ab9e013739
Parents:
d8c7a64f3bcb71205b5fc350abe3a065f1b1576b
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-08-14 18:11:52+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:12:19+01:00
Message:
FIX: duplicate of id_ChineseRemainder
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/simpleideals.cc

    rd8c7a6 rf11ea16  
    17171717#endif
    17181718
    1719 /*2
    1720 * xx,q: arrays of length 0..rl-1
    1721 * xx[i]: SB mod q[i]
    1722 * assume: char=0
    1723 * assume: q[i]!=0
    1724 * destroys xx
    1725 */
    1726 #ifdef HAVE_FACTORY
    1727 ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring R)
    1728 {
    1729   int cnt=IDELEMS(xx[0])*xx[0]->nrows;
    1730   ideal result=idInit(cnt,xx[0]->rank);
    1731   result->nrows=xx[0]->nrows; // for lifting matrices
    1732   result->ncols=xx[0]->ncols; // for lifting matrices
    1733   int i,j;
    1734   poly r,h,hh,res_p;
    1735   number *x=(number *)omAlloc(rl*sizeof(number));
    1736   for(i=cnt-1;i>=0;i--)
    1737   {
    1738     res_p=NULL;
    1739     loop
    1740     {
    1741       r=NULL;
    1742       for(j=rl-1;j>=0;j--)
    1743       {
    1744         h=xx[j]->m[i];
    1745         if ((h!=NULL)
    1746         &&((r==NULL)||(p_LmCmp(r,h,R)==-1)))
    1747           r=h;
    1748       }
    1749       if (r==NULL) break;
    1750       h=p_Head(r, R);
    1751       for(j=rl-1;j>=0;j--)
    1752       {
    1753         hh=xx[j]->m[i];
    1754         if ((hh!=NULL) && (p_LmCmp(r,hh, R)==0))
    1755         {
    1756           x[j]=p_GetCoeff(hh, R);
    1757           hh=p_LmFreeAndNext(hh, R);
    1758           xx[j]->m[i]=hh;
    1759         }
    1760         else
    1761           x[j]=n_Init(0, R->cf); // is R->cf really n_Q???, yes!
    1762       }
    1763        
    1764       number n=nChineseRemainder(x,q,rl, R->cf);
    1765 
    1766       for(j=rl-1;j>=0;j--)
    1767       {
    1768         x[j]=NULL; // nlInit(0...) takes no memory
    1769       }
    1770       if (n_IsZero(n, R->cf)) p_Delete(&h, R);
    1771       else
    1772       {
    1773         p_SetCoeff(h,n, R);
    1774         //Print("new mon:");pWrite(h);
    1775         res_p=p_Add_q(res_p, h, R);
    1776       }
    1777     }
    1778     result->m[i]=res_p;
    1779   }
    1780   omFree(x);
    1781   for(i=rl-1;i>=0;i--) id_Delete(&(xx[i]), R);
    1782   omFree(xx);
    1783   return result;
    1784 }
    1785 #endif
    17861719
    17871720/*2
Note: See TracChangeset for help on using the changeset viewer.