Changeset 51c163 in git for Singular/polys1.cc
- Timestamp:
- Dec 3, 1997, 5:59:09 PM (26 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 60b6009c05103f2e0954313a9eaf4212fbfb177c
- Parents:
- 97eb91d6ede7d98085ea363e0cde94fa6a6913be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/polys1.cc
r97eb91 r51c163 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys1.cc,v 1. 7 1997-10-20 10:52:03 SingularExp $ */4 /* $Id: polys1.cc,v 1.8 1997-12-03 16:59:00 obachman Exp $ */ 5 5 6 6 /* … … 35 35 int i; 36 36 37 for (i=pVariables;i >=0;i--)37 for (i=pVariables;i;i--) 38 38 { 39 39 if (pGetExp(p,i)!=0) return FALSE; 40 40 } 41 if (pGetComp(p)) return FALSE; 41 42 return TRUE; 42 43 } … … 83 84 p->coef = nInit(1); 84 85 return p; 85 }86 87 /*288 * creates a copy of p89 */90 #ifdef MDEBUG91 poly pDBCopy(poly p,char *f,int l)92 #else93 poly pCopy(poly p)94 #endif95 {96 poly w, a;97 98 if (p==NULL) return NULL;99 pDBTest(p,f,l);100 #ifdef MDEBUG101 w = a = pDBNew(f,l);102 #else103 w = a = pNew();104 #endif105 memcpy(w,p,pMonomSize);106 w->coef=nCopy(p->coef);107 if (pNext(p)!=NULL)108 {109 pIter(p);110 do111 {112 #ifdef MDEBUG113 a = pNext(a) = pDBNew(f,l);114 #else115 a = pNext(a) = pNew();116 #endif117 memcpy(a,p,pMonomSize);118 a->coef=nCopy(p->coef);119 pIter(p);120 }121 while (p!=NULL);122 }123 pNext(a) = NULL;124 return w;125 86 } 126 87 … … 319 280 for (i=pVariables; i!=0; i--) 320 281 { 321 p GetExp(p,i) *= exp;282 pMultExp(p,i, exp); 322 283 } 323 284 p->Order *= exp; … … 340 301 for (i=pVariables; i!=0; i--) 341 302 { 342 p GetExp(p,i) += pGetExp(q,i);303 pAddExp(p,i, pGetExp(q,i)); 343 304 } 344 305 p->Order += q->Order; … … 357 318 x = nMult(pGetCoeff(p),pGetCoeff(q)); 358 319 pSetCoeff0(r,x); 359 p GetComp(r) = pGetComp(p);320 pSetComp(r, pGetComp(p)); 360 321 for (i=pVariables; i!=0; i--) 361 322 { 362 p GetExp(r,i) = pGetExp(p,i) + pGetExp(q,i);323 pSetExp(r,i, pGetExp(p,i) + pGetExp(q,i)); 363 324 } 364 325 r->Order = p->Order + q->Order; … … 494 455 for(j=1;j<=pdK;j++) 495 456 { 496 if(p ->exp[pdY(j)]!=0)457 if(pGetExp(p,pdY(j))!=0) 497 458 { 498 459 pDelete(&rc); … … 502 463 for(j=1;j<=pdN;j++) 503 464 { 504 t=p ->exp[pdX(j)];505 p ->exp[pdX(j)]=p->exp[pdIX(j)];506 p ->exp[pdIX(j)]=t;465 t=pGetExp(p,pdX(j)); 466 pGetExp(p,pdX(j)]=pGetExp(p,pdIX(j)); 467 pGetExp(p,pdIX(j))=t; 507 468 } 508 469 pIter(p); … … 559 520 { 560 521 f = pNew(); 522 pCopy2(f,a); 561 523 pNext(f)=NULL; 562 524 t = nInit(pGetExp(a,k)); … … 567 529 else 568 530 { 569 memcpy4(f->exp,a->exp,(pVariables + 1) * sizeof(short)); 570 f->exp[k]--; 531 pDecrExp(f,k); 571 532 pSetm(f); 572 533 if (res==NULL) … … 662 623 663 624 /*2 664 * returns (a copy of) the head term of a665 */666 #ifdef MDEBUG667 poly pDBHead(poly p,char *f, int l)668 #else669 poly pHead(poly p)670 #endif671 {672 poly w=NULL;673 674 if (p!=NULL)675 {676 #ifdef MDEBUG677 w = pDBNew(f,l);678 #else679 w = pNew();680 #endif681 memcpy4(w,p,pMonomSize);682 pSetCoeff0(w,nCopy(pGetCoeff(p)));683 pNext(w) = NULL;684 }685 return w;686 }687 688 /*2689 * returns (a copy of) the head term of a without the coef690 */691 #ifdef MDEBUG692 poly pDBHead0(poly p,char *f, int l)693 #else694 poly pHead0(poly p)695 #endif696 {697 poly w=NULL;698 699 if (p!=NULL)700 {701 #ifdef MDEBUG702 w = pDBNew(f,l);703 #else704 w = pNew();705 #endif706 memcpy4(w,p,pMonomSize);707 pSetCoeff0(w,NULL);708 pNext(w) = NULL;709 }710 return w;711 }712 713 /*2714 625 * returns maximal column number in the modul element a (or 0) 715 626 */ … … 757 668 do 758 669 { 759 pSetComp(p, ( short)i);670 pSetComp(p, (Exponent_t)i); 760 671 pIter(p); 761 672 } while (p!=NULL); … … 1007 918 pTest(aq); 1008 919 } 1009 qq->exp[0]=p->exp[0];920 pSetComp(qq, pGetComp(p)); 1010 921 if (nIsZero(pGetCoeff(qq))) 1011 922 { … … 1016 927 for(i=1; i<=OldpVariables; i++) 1017 928 { 1018 if (p ->exp[i]!=0)929 if (pGetExp(p,i)!=0) 1019 930 { 1020 931 if (perm==NULL) 1021 932 { 1022 qq->exp[i]=p->exp[i];933 pSetExp(qq,i, pGetExp(p,i)); 1023 934 } 1024 935 else if (perm[i]>0) 1025 qq->exp[perm[i]]+=p->exp[i];936 pAddExp(qq,perm[i], pGetExp(p,i)); 1026 937 else if (perm[i]<0) 1027 938 { 1028 939 lnumber c=(lnumber)pGetCoeff(qq); 1029 c->z->e[-perm[i]-1]+=p ->exp[i];940 c->z->e[-perm[i]-1]+=pGetExp(p,i); 1030 941 } 1031 942 else … … 1307 1218 while ((p1 != NULL) /*&& (p2 != NULL)*/) 1308 1219 { 1309 for (i= 0; i<=pVariables; i++)1220 for (i=1; i<=pVariables; i++) 1310 1221 { 1311 1222 if (pGetExp(p1,i)!=pGetExp(p2,i)) … … 1314 1225 return FALSE; 1315 1226 } 1227 } 1228 if (pGetComp(p1) != pGetComp(p2)) 1229 { 1230 nDelete(&n); 1231 return FALSE; 1316 1232 } 1317 1233 if (!nEqual(pGetCoeff(p1),nn=nMult(pGetCoeff(p2),n)))
Note: See TracChangeset
for help on using the changeset viewer.