- Timestamp:
- Feb 26, 2003, 4:40:51 PM (21 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- d6f4d943dc9e5df16732b62b38b67a0be4f90de3
- Parents:
- d9ddf538a2046f81d0acb90982bf1ff0e91e71f1
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/gring.cc
rd9ddf53 r2a97b3 7 7 * Author: levandov (Viktor Levandovsky) 8 8 * Created: 8/00 - 11/00 9 * Version: $Id: gring.cc,v 1.2 3 2003-01-30 21:41:01 levandov Exp $9 * Version: $Id: gring.cc,v 1.24 2003-02-26 15:40:51 levandov Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" … … 90 90 { 91 91 v=p_Head(p,r); 92 #ifdef PDEBUG 92 93 p_Test(v,r); 93 94 p_Test(p,r); 95 #endif 94 96 95 97 expP=p_GetComp(v,r); … … 128 130 int len=pLength(out); 129 131 sBucketDestroyAdd(bu_out, &out, &len); 132 #ifdef PDEBUG 130 133 p_Test(out,r); 134 #endif 131 135 return(out); 132 136 } … … 163 167 { 164 168 v=p_Head(p,r); 169 #ifdef PDEBUG 165 170 p_Test(v,r); 166 171 p_Test(p,r); 167 172 #endif 168 173 expP=p_GetComp(v,r); 169 174 if (expP==0) … … 200 205 int len=pLength(out); 201 206 sBucketDestroyAdd(bu_out, &out, &len ); 207 #ifdef PDEBUG 202 208 p_Test(out,r); 209 #endif 203 210 return(out); 204 211 } … … 328 335 p_SetExpV(Pn,On,r); 329 336 p_Setm(Pn,r); 337 #ifdef PDEBUG 330 338 p_Test(Pn,r); 339 #endif 331 340 332 341 // if (pNext(D)==0) … … 366 375 p_SetExpV(Rout,U,r); 367 376 p_Setm(Rout,r); /* use again this name Rout */ 377 #ifdef PDEBUG 368 378 p_Test(Rout,r); 379 #endif 369 380 p_SetCoeff(Rout,c[cnt-1],r); 370 381 out=p_Add_q(out,Rout,r); … … 377 388 p_SetExpV(Rout,Prv,r); 378 389 p_Setm(Rout,r); 390 #ifdef PDEBUG 379 391 p_Test(Rout,r); 392 #endif 380 393 out=nc_mm_Mult_p(Rout,out,r); /* getting the final result */ 381 394 freeT(Prv,r->N); … … 456 469 p_SetExpV(Rout,Prv,r); 457 470 p_Setm(Rout,r); 471 #ifdef PDEBUG 458 472 p_Test(Rout,r); 473 #endif 459 474 freeT(Prv,r->N); 460 475 out=nc_mm_Mult_p(Rout,out,r); /* getting the final result */ … … 530 545 Rout=nc_p_Mult_mm(D,Pn,r); 531 546 } 547 #ifdef PDEBUG 532 548 p_Test(Pp,r); 549 #endif 533 550 p_Delete(&Pn,r); 534 551 } … … 537 554 Rout=nc_mm_Mult_p(Pp,D,r); 538 555 } 539 556 #ifdef PDEBUG 540 557 p_Test(Pp,r); 558 #endif 541 559 p_Delete(&Pp,r); 542 560 num=n_Mult(c[cnt+1],c[cnt],r); … … 582 600 poly nc_uu_Mult_ww_vert (int i, int a, int j, int b, const ring r) 583 601 { 584 poly out=pOne(); 585 number tmp_number=NULL; 586 587 /* Now check zero exeptions, commutativity and should we do something at all? */ 588 if (i==j) 589 { 590 p_SetExp(out,j,a+b,r); 591 } 592 else 593 { 594 p_SetExp(out,j,b,r); 595 p_SetExp(out,i,a,r); 596 } 597 p_Setm(out,r); 598 if ((a==0)||(b==0)||(i<=j)) return(out);/* zero exeptions and usual case */ 599 600 if (MATELEM(r->nc->COM,j,i)!=NULL) 601 /* commutative or quasicommutative case */ 602 { 603 if (r->cf->nIsOne(p_GetCoeff(MATELEM(r->nc->COM,j,i),r))) /* commutative case */ 604 { 605 return(out); 606 } 607 else 608 { 609 tmp_number=p_GetCoeff(MATELEM(r->nc->COM,j,i),r); /* quasicommutative case */ 610 nPower(tmp_number,a*b,&tmp_number); 611 p_SetCoeff(out,tmp_number,r); 612 return(out); 613 } 614 }/* end_of commutative or quasicommutative case */ 615 616 /* we are here if i>j and variables do not commute or quasicommute */ 617 /* in fact, now a>=1 and b>=1; and j<i */ 618 /* now check wether the polynom is alredy computed */ 619 int vik = UPMATELEM(j,i,r->N); 620 matrix cMT=r->nc->MT[vik]; 621 int cMTsize=r->nc->MTsize[vik]; 622 p_Delete(&out,r); 623 624 if (((a<cMTsize)&&(b<cMTsize))&&(MATELEM(cMT,a,b)!=NULL)) 625 { 626 out = nc_p_CopyGet(MATELEM(cMT,a,b),r); 627 // out=p_Copy(MATELEM(cMT,a,b),r); 628 return (out); 629 } 630 631 int newcMTsize=0; 632 int k,l,m; 633 634 if (a>=b) {newcMTsize=a;} else {newcMTsize=b;} 635 if (newcMTsize>cMTsize) 636 { 637 newcMTsize = newcMTsize+cMTsize; 638 matrix tmp = mpNew(newcMTsize,newcMTsize); 639 l=UPMATELEM(j,i,r->N); 640 for (k=1;k<=cMTsize;k++) 641 { 642 for (m=1;m<=cMTsize;m++) 643 { 644 MATELEM(tmp,k,m) = nc_p_CopyPut(MATELEM(r->nc->MT[l],k,m),r); 645 // MATELEM(tmp,k,m) = MATELEM(r->nc->MT[l],k,m); 646 // omCheckAddr(tmp->m); 647 // MATELEM(r->nc->MT[l],k,m)=NULL; 648 p_Delete(&MATELEM(r->nc->MT[l],k,m),r); 649 // omCheckAddr(r->nc->MT[UPMATELEM(j,i,r->N)]->m); 650 } 651 } 652 id_Delete((ideal *)&(r->nc->MT[l]),r->nc->basering); 653 r->nc->MT[l] = tmp; 654 r->nc->MTsize[l] = newcMTsize; 655 } /* The update of multiplication matrix is finished */ 656 657 cMT=r->nc->MT[UPMATELEM(j,i,r->N)]; /* cMT=current MT */ 658 659 poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r);p_Test(x,r);/* var(j); */ 660 poly y=pOne();p_SetExp(y,i,1,r);p_Setm(y,r);p_Test(y,r);/*var(i); for convenience */ 661 602 int k,m; 603 matrix cMT=r->nc->MT[UPMATELEM(j,i,r->N)]; /* cMT=current MT */ 604 605 poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r); 606 /* var(j); */ 607 poly y=pOne();p_SetExp(y,i,1,r);p_Setm(y,r); 608 /*var(i); for convenience */ 609 #ifdef PDEBUG 610 p_Test(x,r); 611 p_Test(y,r); 612 #endif 662 613 poly t=NULL; 663 614 /* ------------ Main Cycles ----------------------------*/ … … 704 655 } 705 656 706 poly nc_uu_Mult_ww _horvert(int i, int a, int j, int b, const ring r)657 poly nc_uu_Mult_ww (int i, int a, int j, int b, const ring r) 707 658 /* (x_i)^a times (x_j)^b */ 708 659 /* x_i = y, x_j = x ! */ 709 660 { 710 /* Check zero ex eptions, (q-)commutativity and should we do something at all?*/661 /* Check zero exceptions, (q-)commutativity and is there something to do? */ 711 662 assume(a!=0); 712 663 assume(b!=0); … … 798 749 tmp=NULL; 799 750 r->nc->MTsize[UPMATELEM(j,i,r->N)] = newcMTsize; 800 } /* The update of multiplication matrix is finished */ 801 751 } 752 /* The update of multiplication matrix is finished */ 753 pDelete(&out); 754 out = nc_uu_Mult_ww_vert(i, a, j, b, r); 755 // out = nc_uu_Mult_ww_horvert(i, a, j, b, r); 756 return(out); 757 } 758 759 poly nc_uu_Mult_ww_horvert (int i, int a, int j, int b, const ring r) 760 761 { 762 int k,m; 802 763 matrix cMT=r->nc->MT[UPMATELEM(j,i,r->N)]; /* cMT=current MT */ 803 764 804 poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r);p_Test(x,r); /* var(j); */ 805 poly y=pOne();p_SetExp(y,i,1,r);p_Setm(y,r);p_Test(y,r); /*var(i); for convenience */ 765 poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r);/* var(j); */ 766 poly y=pOne();p_SetExp(y,i,1,r);p_Setm(y,r); /*var(i); for convenience */ 767 #ifdef PDEBUG 768 p_Test(x,r); 769 p_Test(y,r); 770 #endif 806 771 807 772 poly t=NULL; … … 978 943 p_Delete(&y,r); 979 944 t=p_Copy(MATELEM(cMT,a,b),r); 980 return(t); /* asthe last computed element was cMT[a,b] */945 return(t); /* since the last computed element was cMT[a,b] */ 981 946 } 982 947 … … 1000 965 p_ExpVectorDiff(m,p2,p1,r); 1001 966 p_Setm(m,r); 967 #ifdef PDEBUG 1002 968 p_Test(m,r); 969 #endif 1003 970 /* pSetComp(m,r)=0? */ 1004 971 poly N=nc_mm_Mult_p(m,p_Head(p1,r),r); … … 1053 1020 pLcm(p1,p2,pL); 1054 1021 p_Setm(pL,r); 1022 #ifdef PDEBUG 1055 1023 p_Test(pL,r); 1024 #endif 1056 1025 p_ExpVectorDiff(m1,pL,p1,r); 1057 1026 p_SetComp(m1,0,r); 1058 1027 p_Setm(m1,r); 1028 #ifdef PDEBUG 1059 1029 p_Test(m1,r); 1030 #endif 1060 1031 p_ExpVectorDiff(m2,pL,p2,r); 1061 1032 p_SetComp(m2,0,r); 1062 1033 p_Setm(m2,r); 1034 #ifdef PDEBUG 1063 1035 p_Test(m2,r); 1036 #endif 1064 1037 p_Delete(&pL,r); 1065 1038 /* zero exponents ! */ … … 1096 1069 // n_Delete(&C2,r); 1097 1070 n_Delete(&MinusOne,r); 1071 #ifdef PDEBUG 1098 1072 p_Test(M2,r); 1073 #endif 1099 1074 return(M2); 1100 1075 } … … 1114 1089 p_SetComp(m,0,r); 1115 1090 p_Setm(m,r); 1091 #ifdef PDEBUG 1116 1092 p_Test(m,r); 1093 #endif 1117 1094 /* pSetComp(m,r)=0? */ 1118 1095 poly M=nc_mm_Mult_p(m,p_Copy(p1,r),r); … … 1150 1127 pLcm(p1,p2,m); 1151 1128 p_Setm(m,r); 1129 #ifdef PDEBUG 1152 1130 p_Test(m,r); 1131 #endif 1153 1132 return(m); 1154 1133 } … … 1162 1141 pExpVectorDiff(m,kBucketGetLm(b),p); 1163 1142 pSetm(m); 1143 #ifdef PDEBUG 1164 1144 pTest(m); 1145 #endif 1165 1146 poly pp=nc_mm_Mult_p(m,pCopy(p),currRing); 1166 1147 pDelete(&m); … … 1192 1173 pExpVectorDiff(m,pHead(b),p); 1193 1174 pSetm(m); 1175 #ifdef PDEBUG 1194 1176 pTest(m); 1177 #endif 1195 1178 poly pp=nc_mm_Mult_p(m,pCopy(p),currRing); 1196 1179 pDelete(&m); … … 1291 1274 pSetCoeff(bres,nTmp); /* only lc ! */ 1292 1275 } 1276 #ifdef PDEBUG 1293 1277 pTest(bres); 1278 #endif 1294 1279 if (i>j) bres=p_Mult_nn(bres, MinusOne,currRing); 1295 1280 } … … 1484 1469 1485 1470 void ncKill(ring r) 1471 /* kills the nc extension of ring r */ 1486 1472 { 1487 1473 int i,j; -
Singular/gring.h
rd9ddf53 r2a97b3 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: gring.h,v 1.1 7 2003-01-29 19:13:36levandov Exp $ */6 /* $Id: gring.h,v 1.18 2003-02-26 15:40:51 levandov Exp $ */ 7 7 /* 8 8 * ABSTRACT additional defines etc for --with-plural … … 24 24 poly nc_mm_Mult_uu (Exponent_t *F,int jG,int bG, const ring r); 25 25 26 #define nc_uu_Mult_ww nc_uu_Mult_ww_vert 27 poly nc_uu_Mult_ww_vert (int i, int a, int j, int b, const ring r); 28 poly nc_uu_Mult_ww_horvert (int i, int a, int j, int b, const ring r); 29 poly nc_uu_Mult_ww_hvdiag (int i, int a, int j, int b, const ring r); 30 26 /* #define nc_uu_Mult_ww nc_uu_Mult_ww_vert */ 27 poly nc_uu_Mult_ww (int i, int a, int j, int b, const ring r); 28 /* poly nc_uu_Mult_ww_vert (int i, int a, int j, int b, const ring r); */ 29 /* poly nc_uu_Mult_ww_horvert (int i, int a, int j, int b, const ring r); */ 30 /* poly nc_uu_Mult_ww_hvdiag (int i, int a, int j, int b, const ring r); */ 31 /* not written yet */ 31 32 32 33 poly _nc_p_Mult_q(poly p, poly q, const int copy, const ring r);
Note: See TracChangeset
for help on using the changeset viewer.