Changeset 994197 in git
- Timestamp:
- Mar 2, 2009, 4:43:24 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 19a0637d5afa08bfef5ba5ad9b199cd5ee3ab1e4
- Parents:
- 4a1764827ceed5ebcbbce2b9e29ff72366b509ed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/iparith.cc
r4a1764 r994197 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: iparith.cc,v 1.49 8 2009-03-02 15:30:17Singular Exp $ */4 /* $Id: iparith.cc,v 1.499 2009-03-02 15:43:24 Singular Exp $ */ 5 5 6 6 /* … … 3844 3844 ideal_list p,h; 3845 3845 h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL); 3846 p=h;3847 int l=0;3848 while (p!=NULL) { p=p->next;l++; }3849 3846 lists L=(lists)omAllocBin(slists_bin); 3850 L->Init(l); 3851 l=0; 3852 while(h!=NULL) 3853 { 3854 L->m[l].data=(char *)h->d; 3855 L->m[l].rtyp=IDEAL_CMD; 3856 p=h->next; 3857 omFreeSize(h,sizeof(*h)); 3858 h=p; 3859 l++; 3847 if (h==NULL) 3848 { 3849 L->Init(1); 3850 L->m[0].data=(char *)idInit(0,1); 3851 L->m[0].rtyp=IDEAL_CMD; 3852 } 3853 else 3854 { 3855 p=h; 3856 int l=0; 3857 while (p!=NULL) { p=p->next;l++; } 3858 L->Init(l); 3859 l=0; 3860 while(h!=NULL) 3861 { 3862 L->m[l].data=(char *)h->d; 3863 L->m[l].rtyp=IDEAL_CMD; 3864 p=h->next; 3865 omFreeSize(h,sizeof(*h)); 3866 h=p; 3867 l++; 3868 } 3860 3869 } 3861 3870 res->data=(void *)L; … … 4374 4383 } 4375 4384 return FALSE; 4385 } 4386 static BOOLEAN jjP2BI(leftv res, leftv v) 4387 { 4388 poly p=(poly)v->Data(); 4389 if (p==NULL) { res->data=(char *)nlInit(0); return FALSE; } 4390 if ((pNext(p)!=NULL)|| (!pIsConstant(p))) 4391 { 4392 WerrorS("poly must be constant"); 4393 return TRUE; 4394 } 4395 number i=pGetCoeff(p); 4396 number n; 4397 if (rField_is_Zp()) 4398 { 4399 if (((long)i)>(npPrimeM>>1)) 4400 n=nlInit((int)(((long)i)-npPrimeM)); 4401 else 4402 n=nlInit((int)(long)i); 4403 } 4404 else if (rField_is_Q()) n=nlBigInt(i); 4405 #ifdef HAVE_RINGS 4406 else if (rField_is_Ring_Z() || rField_is_Ring_ModN() || rField_is_Ring_PtoM()) n=nlMapGMP(i); 4407 else if (rField_is_Ring_2toM()) n=nlInit((unsigned long) i); 4408 #endif 4409 else goto err; 4410 res->data=(void *)n; 4411 return FALSE; 4412 err: 4413 WerrorS("cannot convert to bigint"); return TRUE; 4376 4414 } 4377 4415 static BOOLEAN jjP2I(leftv res, leftv v) … … 5059 5097 ,{jjDUMMY, BIGINT_CMD, BIGINT_CMD, BIGINT_CMD ALLOW_PLURAL} 5060 5098 ,{jjN2BI, BIGINT_CMD, BIGINT_CMD, NUMBER_CMD ALLOW_PLURAL} 5099 ,{jjP2BI, BIGINT_CMD, BIGINT_CMD, POLY_CMD ALLOW_PLURAL} 5061 5100 ,{jjCHAR, CHARACTERISTIC_CMD, INT_CMD, RING_CMD ALLOW_PLURAL} 5062 5101 ,{jjCHAR, CHARACTERISTIC_CMD, INT_CMD, QRING_CMD ALLOW_PLURAL}
Note: See TracChangeset
for help on using the changeset viewer.