Changeset e9989f in git for libpolys/polys/simpleideals.cc


Ignore:
Timestamp:
Aug 12, 2015, 2:13:42 PM (9 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
9a124249fa498488e7fe6c086eea551c001e016f
Parents:
7507543ae55ceb8b299a44ac7f671d67fa837d45
Message:
fix tr. #732
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/simpleideals.cc

    r750754 re9989f  
    17211721ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)
    17221722{
    1723   int cnt=IDELEMS(xx[0])*xx[0]->nrows;
     1723  int cnt=0;int rw=0; int cl=0;
     1724  int i,j;
     1725  // find max. size of xx[.]:
     1726  for(j=rl-1;j>=0;j--)
     1727  {
     1728    i=IDELEMS(xx[j])*xx[j]->nrows;
     1729    if (i>cnt) cnt=i;
     1730    if (xx[j]->nrows >rw) rw=xx[j]->nrows; // for lifting matrices
     1731    if (xx[j]->ncols >cl) cl=xx[j]->ncols; // for lifting matrices
     1732  }
     1733  if (rw*cl !=cnt)
     1734  {
     1735    WerrorS("format mismatch in CRT");
     1736    return NULL;
     1737  }
    17241738  ideal result=idInit(cnt,xx[0]->rank);
    1725   result->nrows=xx[0]->nrows; // for lifting matrices
    1726   result->ncols=xx[0]->ncols; // for lifting matrices
    1727   int i,j;
     1739  result->nrows=rw; // for lifting matrices
     1740  result->ncols=cl; // for lifting matrices
    17281741  number *x=(number *)omAlloc(rl*sizeof(number));
    17291742  poly *p=(poly *)omAlloc(rl*sizeof(poly));
    1730   CFArray inv_cache(rl);;
     1743  CFArray inv_cache(rl);
    17311744  for(i=cnt-1;i>=0;i--)
    17321745  {
    17331746    for(j=rl-1;j>=0;j--)
    17341747    {
    1735       p[j]=xx[j]->m[i];
     1748      if(i>=IDELEMS(xx[j])*xx[j]->nrows) // out of range of this ideal
     1749        p[j]=NULL;
     1750      else
     1751        p[j]=xx[j]->m[i];
    17361752    }
    17371753    result->m[i]=p_ChineseRemainder(p,x,q,rl,inv_cache,r);
    17381754    for(j=rl-1;j>=0;j--)
    17391755    {
    1740       xx[j]->m[i]=p[j];
     1756      if(i<IDELEMS(xx[j])*xx[j]->nrows) xx[j]->m[i]=p[j];
    17411757    }
    17421758  }
Note: See TracChangeset for help on using the changeset viewer.