Changeset f11ea16 in git
- Timestamp:
- Aug 14, 2011, 6:11:52 PM (12 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- 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
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/ideals.cc
rd8c7a6 rf11ea16 9 9 /* includes */ 10 10 #include "mod2.h" 11 12 #include <omalloc/omalloc.h> 13 #include <misc/auxiliary.h> 11 14 12 15 … … 2541 2544 } 2542 2545 #endif 2546 2547 #if 0 2548 /*2 2549 * xx,q: arrays of length 0..rl-1 2550 * xx[i]: SB mod q[i] 2551 * assume: char=0 2552 * assume: q[i]!=0 2553 * destroys xx 2554 */ 2555 #ifdef HAVE_FACTORY 2556 ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring R) 2557 { 2558 int cnt=IDELEMS(xx[0])*xx[0]->nrows; 2559 ideal result=idInit(cnt,xx[0]->rank); 2560 result->nrows=xx[0]->nrows; // for lifting matrices 2561 result->ncols=xx[0]->ncols; // for lifting matrices 2562 int i,j; 2563 poly r,h,hh,res_p; 2564 number *x=(number *)omAlloc(rl*sizeof(number)); 2565 for(i=cnt-1;i>=0;i--) 2566 { 2567 res_p=NULL; 2568 loop 2569 { 2570 r=NULL; 2571 for(j=rl-1;j>=0;j--) 2572 { 2573 h=xx[j]->m[i]; 2574 if ((h!=NULL) 2575 &&((r==NULL)||(p_LmCmp(r,h,R)==-1))) 2576 r=h; 2577 } 2578 if (r==NULL) break; 2579 h=p_Head(r, R); 2580 for(j=rl-1;j>=0;j--) 2581 { 2582 hh=xx[j]->m[i]; 2583 if ((hh!=NULL) && (p_LmCmp(r,hh, R)==0)) 2584 { 2585 x[j]=p_GetCoeff(hh, R); 2586 hh=p_LmFreeAndNext(hh, R); 2587 xx[j]->m[i]=hh; 2588 } 2589 else 2590 x[j]=n_Init(0, R->cf); // is R->cf really n_Q???, yes! 2591 } 2592 2593 number n=nChineseRemainder(x,q,rl, R->cf); 2594 2595 for(j=rl-1;j>=0;j--) 2596 { 2597 x[j]=NULL; // nlInit(0...) takes no memory 2598 } 2599 if (n_IsZero(n, R->cf)) p_Delete(&h, R); 2600 else 2601 { 2602 p_SetCoeff(h,n, R); 2603 //Print("new mon:");pWrite(h); 2604 res_p=p_Add_q(res_p, h, R); 2605 } 2606 } 2607 result->m[i]=res_p; 2608 } 2609 omFree(x); 2610 for(i=rl-1;i>=0;i--) id_Delete(&(xx[i]), R); 2611 omFree(xx); 2612 return result; 2613 } 2614 #endif 2615 #endif 2543 2616 /* currently unsed: 2544 2617 ideal idChineseRemainder(ideal *xx, intvec *iv) -
libpolys/polys/simpleideals.cc
rd8c7a6 rf11ea16 1717 1717 #endif 1718 1718 1719 /*21720 * xx,q: arrays of length 0..rl-11721 * xx[i]: SB mod q[i]1722 * assume: char=01723 * assume: q[i]!=01724 * destroys xx1725 */1726 #ifdef HAVE_FACTORY1727 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 matrices1732 result->ncols=xx[0]->ncols; // for lifting matrices1733 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 loop1740 {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 else1761 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 memory1769 }1770 if (n_IsZero(n, R->cf)) p_Delete(&h, R);1771 else1772 {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 #endif1786 1719 1787 1720 /*2
Note: See TracChangeset
for help on using the changeset viewer.