Changeset e9989f in git for libpolys/polys/simpleideals.cc
- Timestamp:
- Aug 12, 2015, 2:13:42 PM (9 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 9a124249fa498488e7fe6c086eea551c001e016f
- Parents:
- 7507543ae55ceb8b299a44ac7f671d67fa837d45
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/simpleideals.cc
r750754 re9989f 1721 1721 ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r) 1722 1722 { 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 } 1724 1738 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 1728 1741 number *x=(number *)omAlloc(rl*sizeof(number)); 1729 1742 poly *p=(poly *)omAlloc(rl*sizeof(poly)); 1730 CFArray inv_cache(rl); ;1743 CFArray inv_cache(rl); 1731 1744 for(i=cnt-1;i>=0;i--) 1732 1745 { 1733 1746 for(j=rl-1;j>=0;j--) 1734 1747 { 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]; 1736 1752 } 1737 1753 result->m[i]=p_ChineseRemainder(p,x,q,rl,inv_cache,r); 1738 1754 for(j=rl-1;j>=0;j--) 1739 1755 { 1740 xx[j]->m[i]=p[j];1756 if(i<IDELEMS(xx[j])*xx[j]->nrows) xx[j]->m[i]=p[j]; 1741 1757 } 1742 1758 }
Note: See TracChangeset
for help on using the changeset viewer.