Changeset bba835 in git for kernel/ideals.cc
- Timestamp:
- May 3, 2007, 3:27:45 PM (16 years ago)
- Branches:
- (u'spielwiese', '91fdef05f09f54b8d58d92a472e9c4a43aa4656f')
- Children:
- 75ae36afc86628e8325b039c42ab23fe91876b39
- Parents:
- 52e38fce6d01c11b7934d7b1830db574af0f6983
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/ideals.cc
r52e38fc rbba835 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ideals.cc,v 1.4 1 2007-04-03 15:16:39Singular Exp $ */4 /* $Id: ideals.cc,v 1.42 2007-05-03 13:27:44 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT - all basic methods to manipulate ideals … … 13 13 #include "febase.h" 14 14 #include "numbers.h" 15 #include "longrat.h" 15 16 #include "polys.h" 16 17 #include "ring.h" … … 3694 3695 return gcd_p; 3695 3696 } 3697 3698 /*2 3699 * xx,q: arrays of length 0..rl-1 3700 * xx[i]: SB mod q[i] 3701 * assume: char=0 3702 * assume: q[i]!=0 3703 * destroys xx 3704 */ 3705 ideal idChineseRemainder(ideal *xx, number *q, int rl) 3706 { 3707 ideal result=idInit(IDELEMS(xx[0]),1); 3708 int i,j; 3709 poly r,h,res_p; 3710 number *x=(number *)omAlloc(rl*sizeof(number)); 3711 for(i=IDELEMS(result)-1;i>=0;i--) 3712 { 3713 res_p=NULL; 3714 loop 3715 { 3716 r=NULL; 3717 for(j=rl-1;j>=0;j--) 3718 { 3719 h=xx[j]->m[i]; 3720 if ((r==NULL)||(pLmCmp(r,h)==-1)) r=h; 3721 } 3722 if (r==NULL) break; 3723 for(j=rl-1;j>=0;j--) 3724 { 3725 h=xx[j]->m[i]; 3726 if (pLmCmp(r,h)==0) 3727 { 3728 x[j]=pGetCoeff(h); 3729 h=pLmFreeAndNext(h); 3730 xx[j]->m[i]=h; 3731 } 3732 else 3733 x[j]=nlInit(0); 3734 } 3735 number n=nlChineseRemainder(x,q,rl); 3736 for(j=rl-1;j>=0;j--) 3737 { 3738 nlDelete(&(x[j]),currRing); 3739 } 3740 h=pHead(r); 3741 pSetCoeff(h,n); 3742 res_p=pAdd(res_p,h); 3743 } 3744 result->m[i]=res_p; 3745 } 3746 omFree(x); 3747 for(i=rl-1;i>=0;i--) idDelete(&(xx[i])); 3748 omFree(xx); 3749 return result; 3750 }
Note: See TracChangeset
for help on using the changeset viewer.