Changeset d14712 in git
- Timestamp:
- Sep 29, 1999, 12:59:43 PM (25 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- 4f011a3b4ee2de9e079fb1b3ff36483e9f1f0511
- Parents:
- c88c949ab8d0ed79f5fe01cd33e526815d5e041f
- Location:
- Singular
- Files:
-
- 3 added
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/Makefile.in
rc88c949 rd14712 74 74 ipassign.cc ipconv.cc ipid.cc iplib.cc \ 75 75 ipprint.cc ipshell.cc khstd.cc kstdfac.cc \ 76 comm.cckstd1.cc kstd2.cc kutil.cc lists.cc \76 kstd1.cc kstd2.cc kutil.cc lists.cc \ 77 77 longalg.cc longrat.cc longrat0.cc \ 78 78 maps.cc matpol.cc misc.cc sdb.cc gnumpfl.cc gnumpc.cc \ … … 81 81 numbers.cc polys.cc polys0.cc polys1.cc polys-impl.cc \ 82 82 ring.cc shortfl.cc silink.cc sing_mp.cc\ 83 sing_dld.cc sing_dbm.cc spolys.cc spolys0.cc \83 sing_dld.cc sing_dbm.cc kspoly.cc \ 84 84 subexpr.cc syz.cc syz0.cc syz1.cc \ 85 85 timer.cc weight.cc \ … … 87 87 mpsr_Get.cc mpsr_GetMisc.cc mpsr_Error.cc \ 88 88 GMPrat.cc multicnt.cc npolygon.cc semic.cc spectrum.cc splist.cc \ 89 ndbm.cc spSpolyLoop.cclibparse.cc mod_raw.cc\90 pcv.cc kbuckets.cc kbPolyProcs.cc \89 ndbm.cc libparse.cc mod_raw.cc\ 90 pcv.cc kbuckets.cc pProcs.cc \ 91 91 mpr_inout.cc mpr_base.cc mpr_numeric.cc 92 92 # normal C source files … … 97 97 ESOURCES=iparith.cc gmalloc.c tesths.cc mpsr_Tok.cc claptmpl.cc 98 98 99 SOURCES=${CSOURCES} ${CXXSOURCES} grammar.y scanner.l libparse.l spSpolyLoop.pl generate.pl99 SOURCES=${CSOURCES} ${CXXSOURCES} grammar.y scanner.l libparse.l 100 100 101 101 SOURCES=${CSOURCES} ${CXXSOURCES} ${ESOURCES} \ 102 grammar.y scanner.l libparse.l spSpolyLoop.pl generate.pl102 grammar.y scanner.l libparse.l 103 103 104 104 HEADERS=algmap.h hutil.h lists.h stairc.h attrib.h ideals.h \ … … 110 110 mmemory.h mmprivate.h mmheap.h mmpage.h page.h \ 111 111 ffields.h khstd.h silink.h sparsmat.h gnumpfl.h gnumpc.h \ 112 fglm.h comm.hkstd1.h modulop.h sing_dbm.h weight.h \113 fglmgauss.h fglmvec.h kstd2.hmpsr.h sing_mp.h \114 kstdfac.h mpsr_Get.h spolys.h\115 kutil.h mpsr_Put.h s polys0.h sing_dld.h\116 ndbm.h spSpolyLoop.hpolys-impl.h polys-comp.h libparse.h \112 fglm.h kstd1.h modulop.h sing_dbm.h weight.h \ 113 fglmgauss.h fglmvec.h mpsr.h sing_mp.h \ 114 kstdfac.h mpsr_Get.h \ 115 kutil.h mpsr_Put.h sing_dld.h\ 116 ndbm.h polys-impl.h polys-comp.h libparse.h \ 117 117 GMPrat.h multicnt.h npolygon.h semic.h spectrum.h splist.h multicnt.h \ 118 pcv.h mod_raw.h kbuckets.h kbPolyProcs.h \118 pcv.h mod_raw.h kbuckets.h pProcs.h \ 119 119 mpr_global.h mpr_inout.h mpr_base.h mpr_numeric.h \ 120 120 feOpt.h fegetopt.h 121 121 122 INCS=febase.inc polys.inc iparith.inc mpsr_Tok.inc spSpolyLoop.incfeOpt.inc122 INCS=febase.inc polys.inc iparith.inc mpsr_Tok.inc feOpt.inc 123 123 124 124 TESTS=${testdir}/comparecheck ${testdir}/fac_test.in ${testdir}/fac_test.out\ … … 211 211 echo unsigned long feVersionId = `date '+%Y%m%d%H'`\; >version.h 212 212 213 kbPolyProcs.cc kbPolyProcs.dd : kbPolyProcs.pin214 215 kbPolyProcs.pin : generate.pl216 @if test "x${PERL5}" = x; then \217 echo Error: no perl5 given. Can not rebuild $@;\218 exit 1;\219 fi220 ${PERL5} generate.pl kb_n_Mult_p kb_p_Mult_m kb_p_Add_q kb_p_Minus_m_Mult_q > $@221 222 spSpolyLoop.cc spSpolyLoop.dd : spSpolyLoop.inc223 224 spSpolyLoop.inc: spSpolyLoop.pl225 @if test "x${PERL5}" = x; then \226 echo Error: no perl5 given. Can not rebuild spSpolyLoop.inc;\227 exit 1;\228 fi229 ${PERL5} spSpolyLoop.pl > spSpolyLoop.inc230 231 232 213 libparse: libparse_main.o utils.o fegetopt.o 233 214 ${CXX} -o libparse libparse_main.o utils.o fegetopt.o … … 259 240 rm a.out 260 241 261 src: scanner.cc grammar.h grammar.cc libparse.cc spSpolyLoop.inc242 src: scanner.cc grammar.h grammar.cc libparse.cc 262 243 263 244 mod2.h: stamp-h … … 322 303 @echo "Rebuilding the deleted files requires flex" 323 304 @echo "bison, perl" 324 -rm -f scanner.cc grammar.h grammar.cc libparse.cc spSpolyLoop.inc305 -rm -f scanner.cc grammar.h grammar.cc libparse.cc 325 306 326 307 maintainer-clean: distclean srcclean … … 450 431 gnumpc.op longrat.op longrat0.op misc.op ring.op numbers.op maps.op\ 451 432 hilb.op comm.op kstd1.op kstd2.op kutil.op khstd.op kstdfac.op modulop.op \ 452 spolys.opideals.op subexpr.op hdegree.op hutil.op ffields.op shortfl.op \453 longalg.op spolys0.op syz.op syz0.op syz1.op weight.op \433 ideals.op subexpr.op hdegree.op hutil.op ffields.op shortfl.op \ 434 longalg.op kspoly.op syz.op syz0.op syz1.op weight.op \ 454 435 ipid.op ipshell.op iplib.op ipassign.op ipconv.op ipprint.op\ 455 436 polys.op polys0.op polys1.op polys-impl.op extra.op\ … … 460 441 mpsr_Error.op mpsr_Put.op mpsr_PutPoly.op mpsr_GetPoly.op \ 461 442 mpsr_Get.op mpsr_GetMisc.op \ 462 ndbm.op spSpolyLoop.oplibparse.op mod_raw.op \443 ndbm.op libparse.op mod_raw.op \ 463 444 mpr_inout.op mpr_base.op mpr_numeric.op \ 464 445 GMPrat.op multicnt.op npolygon.op semic.op spectrum.op splist.op \ … … 479 460 hilb.ob comm.ob kstd1.ob kstd2.ob kutil.ob khstd.ob kstdfac.ob modulop.ob \ 480 461 spolys.ob ideals.ob subexpr.ob hdegree.ob hutil.ob ffields.ob shortfl.ob \ 481 longalg.ob spolys0.ob syz.ob syz0.ob syz1.ob weight.ob \462 longalg.ob kspoly.ob syz.ob syz0.ob syz1.ob weight.ob \ 482 463 ipid.ob ipshell.ob iplib.ob ipassign.ob ipconv.ob ipprint.ob\ 483 464 polys.ob polys0.ob polys1.ob polys-impl.ob extra.ob\ … … 488 469 mpsr_Error.ob mpsr_Put.ob mpsr_PutPoly.ob mpsr_GetPoly.ob \ 489 470 mpsr_Get.ob mpsr_GetMisc.ob \ 490 ndbm.ob spSpolyLoop.oblibparse.ob mod-${SINGUNAME}.ob \471 ndbm.ob libparse.ob mod-${SINGUNAME}.ob \ 491 472 pcv.ob kbuckets.ob kbPolyProcs.ob 492 473 -
Singular/attrib.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: attrib.cc,v 1.1 4 1999-09-17 11:42:22 SingularExp $ */4 /* $Id: attrib.cc,v 1.15 1999-09-29 10:59:27 obachman Exp $ */ 5 5 6 6 /* … … 350 350 I->rank=max(I->rank,(int)c->Data()); 351 351 } 352 #ifdef DRING353 else if (strcmp(name,"D")==0)354 {355 if (c->Typ()!=INT_CMD)356 {357 WerrorS("attrib `D` must be int");358 return TRUE;359 }360 switch (v->Typ())361 {362 case POLY_CMD:363 case VECTOR_CMD:364 pdSetDFlagP((poly)v->Data(),(int)c->Data());365 break;366 case IDEAL_CMD:367 case MODUL_CMD:368 {369 ideal I=(ideal)v->Data();370 int i=IDELEMS(I)-1;371 int cc=(int)c->Data();372 while (i>=0) { pdSetDFlagP(I->m[i],cc); i--; }373 break;374 }375 default:376 WerrorS("cannot set attrib `D` for this type");377 }378 }379 #endif380 352 else 381 353 { … … 418 390 resetFlag((idhdl)a->data,FLAG_STD); 419 391 } 420 #ifdef DRING421 else if (strcmp(name,"D")==0)422 {423 resetFlag(a,FLAG_DOPERATOR);424 resetFlag((idhdl)a->data,FLAG_DOPERATOR);425 }426 #endif427 392 else 428 393 { -
Singular/extra.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.10 7 1999-09-27 15:32:54obachman Exp $ */4 /* $Id: extra.cc,v 1.108 1999-09-29 10:59:28 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 57 57 #endif 58 58 59 #ifdef STDTRACE60 //#include "comm.h"61 #endif62 63 59 #ifdef HAVE_FACTORY 64 60 #define SI_DONT_HAVE_GLOBAL_VARS … … 192 188 char *s=(char *)h->Data(); 193 189 res->rtyp=INT_CMD; 194 #ifdef DRING195 TEST_FOR("DRING")196 #endif197 190 #ifdef HAVE_DBM 198 191 TEST_FOR("DBM") … … 216 209 TEST_FOR("tcl") 217 210 #endif 218 #ifdef SRING219 TEST_FOR("SRING")220 #endif221 211 #ifdef TEST_MAC_ORDER 222 212 TEST_FOR("MAC_ORDER"); … … 705 695 } 706 696 else 707 /*==================== trace =============================*/708 #ifdef STDTRACE709 /* Parameter : Ideal, Liste mit Links. */710 if(strcmp(sys_cmd,"stdtrace")==0)711 {712 if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))713 {714 leftv root = NULL,715 ptr = NULL,716 lv = NULL;717 lists l = NULL;718 ideal I = (ideal)(h->Data());719 lists links = (lists)(h->next->Data());720 tHomog hom = testHomog;721 int rw = (int)(h->next->next->Data());722 723 if(I==NULL)724 PrintS("I==NULL\n");725 for(int i=0; i <= links->nr ; i++)726 {727 lv = (leftv)Alloc0(sizeof(sleftv));728 lv->Copy(&(links->m[i]));729 if(root==NULL)730 root=lv;731 if(ptr==NULL)732 {733 ptr=lv;734 ptr->next=NULL;735 }736 else737 {738 ptr->next=lv;739 ptr=lv;740 }741 }742 ptr->next=NULL;743 l=TraceStd(root,rw,I,currQuotient,testHomog,NULL);744 idSkipZeroes(((ideal)l->m[0].Data()));745 res->rtyp=LIST_CMD;746 res->data=(void *) l;747 res->next=NULL;748 root->CleanUp();749 Free(root,sizeof(sleftv));750 return FALSE;751 }752 else753 WerrorS("ideal expected");754 }755 else756 #endif757 697 #ifdef HAVE_FACTORY 758 698 /*==================== fastcomb =============================*/ -
Singular/fglmcomb.cc
rc88c949 rd14712 1 1 // emacs edit mode for this file is -*- C++ -*- 2 // $Id: fglmcomb.cc,v 1.1 4 1998-10-28 12:43:29 SingularExp $2 // $Id: fglmcomb.cc,v 1.15 1999-09-29 10:59:28 obachman Exp $ 3 3 4 4 /**************************************** … … 21 21 #include "ideals.h" 22 22 #include "ring.h" 23 #include "spolys.h"24 23 #include "ipid.h" 25 24 #include "ipshell.h" -
Singular/kbuckets.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kbuckets.cc,v 1. 4 1999-09-27 14:57:12obachman Exp $ */4 /* $Id: kbuckets.cc,v 1.5 1999-09-29 10:59:29 obachman Exp $ */ 5 5 6 6 #include "mod2.h" … … 10 10 #include "polys.h" 11 11 #include "febase.h" 12 #include " spolys0.h"12 #include "pProcs.h" 13 13 #include "kbuckets.h" 14 14 #include "numbers.h" … … 290 290 for (i=2; i<=bucket->buckets_used; i++) 291 291 { 292 kb_p_Add_q(&p, &pl,293 &(bucket->buckets[i]),&(bucket->buckets_length[i]),294 bucket->heap);292 p = p_Add_q(p, bucket->buckets[i], 293 &pl, bucket->buckets_length[i], 294 bucket->heap); 295 295 } 296 296 … … 418 418 for (i=0; i<= bucket->buckets_used; i++) 419 419 if (bucket->buckets[i] != NULL) 420 kb_n_Mult_p(n, bucket->buckets[i]);420 bucket->buckets[i] = p_Mult_n(bucket->buckets[i], n); 421 421 #else 422 kb_n_Mult_p(n, bucket->p);422 bucket->p = p_Mult_n(bucket->p, n); 423 423 #endif 424 424 } … … 452 452 if (i <= bucket->buckets_used && bucket->buckets[i] != NULL) 453 453 { 454 kb_p_Minus_m_Mult_q 455 (&(bucket->buckets[i]), &(bucket->buckets_length[i]), 456 m, 457 p1, l1, 458 spNoether, 459 bucket->heap); 460 p1 = bucket->buckets[i]; 454 p1 = p_Minus_m_Mult_q(bucket->buckets[i], m, p1, 455 spNoether, 456 &(bucket->buckets_length[i]), l1, 457 bucket->heap); 461 458 l1 = bucket->buckets_length[i]; 462 459 bucket->buckets[i] = NULL; … … 465 462 while (bucket->buckets[i] != NULL) 466 463 { 467 kb_p_Add_q(&p1, &l1, 468 &(bucket->buckets[i]), 469 &(bucket->buckets_length[i]), 470 bucket->heap); 464 p1 = p_Add_q(p1, bucket->buckets[i], 465 &l1, bucket->buckets_length[i], 466 bucket->heap); 471 467 i = pLogLength(l1); 472 468 } … … 475 471 { 476 472 pSetCoeff0(m, nNeg(pGetCoeff(m))); 477 kb_p_Mult_m(p1, m, spNoether, bucket->heap);473 p1 = p_Mult_m(p1, m, spNoether, bucket->heap); 478 474 pSetCoeff0(m, nNeg(pGetCoeff(m))); 479 475 } … … 486 482 kBucketAdjustBucketsUsed(bucket); 487 483 #else // HAVE_PSEUDO_BUCKETS 488 kb_p_Minus_m_Mult_q(&(bucket->p), &(bucket->l),489 m, p, l1, spNoether,490 484 bucket->p = p_Minus_m_Mult_q(bucket->p, m, p, 485 &(bucket->l), l1, 486 spNoether, bucket->heap); 491 487 #endif 492 488 kbTests(bucket); … … 520 516 bucket->buckets_length[i] -= lq; 521 517 assume(pLength(bucket->buckets[i]) == bucket->buckets_length[i]); 522 kb_p_Add_q(&p, &lp, &q, &lq, bucket->heap);518 p = p_Add_q(p, q, &lp, lq, bucket->heap); 523 519 } 524 520 } … … 552 548 { 553 549 bucket->buckets_length[i] -= lq; 554 kb_p_Add_q(&p, &lp, &q, &lq, bucket->heap);550 p = p_Add_q(p, q, &lp, lq, bucket->heap); 555 551 } 556 552 } … … 570 566 // 571 567 572 extern int spCheckCoeff(number *a, number *b);568 extern int ksCheckCoeff(number *a, number *b); 573 569 574 570 number kBucketPolyRed(kBucket_pt bucket, … … 593 589 { 594 590 number an = pGetCoeff(p1), bn = pGetCoeff(lm); 595 int ct = spCheckCoeff(&an, &bn);591 int ct = ksCheckCoeff(&an, &bn); 596 592 pSetCoeff(lm, bn); 597 593 if ((ct == 0) || (ct == 2)) kBucket_Mult_n(bucket, an); … … 611 607 } 612 608 613 spMonSub(lm,p1);609 pMonSubFrom(lm,p1); 614 610 l1--; 615 611 … … 617 613 618 614 kb_pDelete1(lm, bucket->heap); 619 if (reset_vec) spModuleToPoly(a1);615 if (reset_vec) pSetCompP(a1, 0); 620 616 kbTests(bucket); 621 617 return rn; -
Singular/kbuckets.h
rc88c949 rd14712 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: kbuckets.h,v 1. 4 1999-09-27 14:34:18obachman Exp $ */6 /* $Id: kbuckets.h,v 1.5 1999-09-29 10:59:29 obachman Exp $ */ 7 7 #include "mod2.h" 8 8 #include "mmheap.h" 9 #include "kbPolyProcs.h"10 9 11 10 ///////////////////////////////////////////////////////////////////////// -
Singular/kstd1.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd1.cc,v 1.3 7 1999-09-13 08:16:20 SingularExp $ */4 /* $Id: kstd1.cc,v 1.38 1999-09-29 10:59:30 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: … … 14 14 #include "kutil.h" 15 15 #include "kstd1.h" 16 #include "kstd2.h"17 16 #include "khstd.h" 18 #include "spolys.h"19 17 #include "stairc.h" 20 18 #include "weight.h" … … 26 24 #include "timer.h" 27 25 #include "lists.h" 28 #ifdef STDTRACE29 #include "comm.h"30 #endif31 #include "spSpolyLoop.h"32 26 33 27 //#include "ipprint.h" … … 108 102 if (intoT) 109 103 { 110 hp = spSpolyRedNew(*with,(*h).p,strat->kNoether, strat->spSpolyLoop);104 hp = ksOldSpolyRedNew(*with,(*h).p,strat->kNoether); 111 105 enterT(*h,strat); 112 106 (*h).p = hp; … … 114 108 else 115 109 { 116 (*h).p = spSpolyRed(*with,(*h).p,strat->kNoether, strat->spSpolyLoop);110 (*h).p = ksOldSpolyRed(*with,(*h).p,strat->kNoether); 117 111 } 118 112 if (TEST_OPT_DEBUG) … … 216 210 if (at <= strat->Ll) 217 211 { 212 /*test if h is already standardbasis element*/ 213 #ifdef HAVE_HOMOG_T 214 i=strat->tl+1; 215 #else 218 216 i=strat->sl+1; 217 #endif 219 218 do 220 219 { 221 220 i--; 222 221 if (i<0) return; 222 #ifdef HAVE_HOMOG_T 223 } while (!pDivisibleBy1(strat->T[i].p,(*h).p)); 224 #else 223 225 } while (!pDivisibleBy1(strat->S[i],(*h).p)); 226 #endif 224 227 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); 225 228 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at); … … 367 370 if (at <= strat->Ll) 368 371 { 372 #ifdef HAVE_HOMOG_T 373 i=strat->tl+1; 374 #else 369 375 i=strat->sl+1; 376 #endif 370 377 do 371 378 { 372 379 i--; 373 380 if (i<0) return; 381 #ifdef HAVE_HOMOG_T 382 } while (!pDivisibleBy1(strat->T[i].p,(*h).p)); 383 #else 374 384 } while (!pDivisibleBy1(strat->S[i],(*h).p)); 385 #endif 375 386 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); 376 387 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at); … … 429 440 wrp(strat->T[j].p); 430 441 } 431 (*h).p = spSpolyRed(strat->T[j].p,(*h).p,strat->kNoether, 432 strat->spSpolyLoop); 442 (*h).p = ksOldSpolyRed(strat->T[j].p,(*h).p,strat->kNoether); 433 443 if (TEST_OPT_DEBUG) 434 444 { … … 468 478 if (at <= strat->Ll) 469 479 { 480 #ifdef HAVE_HOMOG_T 481 i=strat->tl+1; 482 #else 470 483 i=strat->sl+1; 484 #endif 471 485 do 472 486 { 473 487 i--; 474 488 if (i<0) return; 489 #ifdef HAVE_HOMOG_T 490 } while (!pDivisibleBy1(strat->T[i].p,(*h).p)); 491 #else 475 492 } while (!pDivisibleBy1(strat->S[i],(*h).p)); 493 #endif 476 494 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); 477 495 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at); … … 617 635 if (at <= strat->Ll) 618 636 { 637 #ifdef HAVE_HOMOG_T 638 i=strat->tl+1; 639 #else 619 640 i=strat->sl+1; 641 #endif 620 642 do 621 643 { 622 644 i--; 623 645 if (i<0) return; 646 #ifdef HAVE_HOMOG_T 647 } while (!pDivisibleBy1(strat->T[i].p,(*h).p)); 648 #else 624 649 } while (!pDivisibleBy1(strat->S[i],(*h).p)); 650 #endif 625 651 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); 626 652 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at); … … 910 936 { 911 937 pFree1(strat->L[j].p); /*deletes the short spoly and computes*/ 912 strat->L[j].p= spSpolyCreate(strat->L[j].p1,938 strat->L[j].p=ksOldCreateSpoly(strat->L[j].p1, 913 939 strat->L[j].p2, 914 strat->kNoether, 915 strat->spSpolyLoop); /*the real one*/ 940 strat->kNoether); /*the real one*/ 916 941 if (!strat->honey) 917 942 strat->initEcart(&strat->L[j]); … … 951 976 { 952 977 pFree1(strat->L[i].p); 953 strat->L[i].p = spSpolyCreate(strat->L[i].p1, 954 strat->L[i].p2, 955 strat->kNoether, 956 strat->spSpolyLoop); 978 strat->L[i].p = ksOldCreateSpoly(strat->L[i].p1, 979 strat->L[i].p2, 980 strat->kNoether); 981 982 957 983 strat->L[i].ecart = pLDeg(strat->L[i].p,&strat->L[i].length)-pFDeg(strat->L[i].p); 958 984 } … … 1041 1067 int i; 1042 1068 1043 #ifdef SDRING1044 if (pSDRING1045 && (atS<=strat->sl)1046 && pComparePolys(p.p,strat->S[atS]))1047 {1048 if (TEST_OPT_PROT)1049 PrintS("m");1050 p.p=NULL;1051 return;1052 }1053 if (pSDRING1054 && (atS<strat->sl)1055 && pComparePolys(p.p,strat->S[atS+1]))1056 {1057 if (TEST_OPT_PROT)1058 PrintS("m");1059 p.p=NULL;1060 return;1061 }1062 if (pSDRING1063 && (atS>0)1064 && pComparePolys(p.p,strat->S[atS-1]))1065 {1066 if (TEST_OPT_PROT)1067 PrintS("m");1068 p.p=NULL;1069 return;1070 }1071 #endif1072 1069 strat->news = TRUE; 1073 1070 /*- puts p to the standardbasis s at position atS -*/ … … 1248 1245 int hilbeledeg=1,hilbcount=0; 1249 1246 1250 #ifdef SDRING1251 polyset aug=(polyset)Alloc(setmax*sizeof(poly));1252 int augmax=setmax, augl=-1;1253 poly oldLcm;1254 #endif1255 1256 1247 strat->update = TRUE; 1257 1248 /*- setting global variables ------------------- -*/ … … 1315 1306 { 1316 1307 pFree1(strat->P.p);/*- deletes the short spoly and computes -*/ 1317 strat->P.p = spSpolyCreate(strat->P.p1, 1318 strat->P.p2, 1319 strat->kNoether, 1320 strat->spSpolyLoop);/*- the real one -*/ 1308 strat->P.p = ksOldCreateSpoly(strat->P.p1, 1309 strat->P.p2, 1310 strat->kNoether);/*- the real one -*/ 1321 1311 if (!strat->honey) 1322 1312 strat->initEcart(&strat->P); … … 1324 1314 strat->P.length = pLength(strat->P.p); 1325 1315 } 1326 #ifdef SDRING1327 if (strat->P.p != NULL)1328 #endif1329 1316 { 1330 1317 if (TEST_OPT_PROT) message(strat->P.ecart+pFDeg(strat->P.p),&olddeg,&reduc,strat); … … 1333 1320 if (strat->P.p != NULL) 1334 1321 { 1335 #ifdef SDRING1336 aug[0]=strat->P.p;1337 augl=0;1338 if (pSDRING)1339 {1340 oldLcm=strat->P.lcm;1341 #ifdef SRING1342 if (pSRING) psAug(pCopy(strat->P.p),pOne(),&aug,&augl,&augmax);1343 #endif1344 #ifdef DRING1345 if (pDRING) pdAug(pCopy(strat->P.p),&aug,&augl,&augmax);1346 #endif1347 }1348 for (augl++;augl != 0;)1349 {1350 strat->P.p=aug[--augl];1351 if (pSDRING)1352 {1353 if (oldLcm==NULL) strat->P.lcm=NULL;1354 else strat->P.lcm=pCopy1(oldLcm);1355 }1356 if ((augl!=0) && (strat->P.p!=NULL)) strat->red(&strat->P,strat);1357 if (strat->P.p != NULL)1358 {1359 #endif1360 1322 if (TEST_OPT_PROT) PrintS("s");/*- statistic -*/ 1361 1323 /*- enter P.p into s and b: -*/ … … 1378 1340 { 1379 1341 int pos; 1380 #ifdef SDRING1381 pos = posInS(strat->S,strat->sl,strat->P.p);1382 if (pSDRING && (pos<=strat->sl)1383 && (pComparePolys(strat->P.p,strat->S[pos])))1384 {1385 if (TEST_OPT_PROT)1386 PrintS("d");1387 }1388 else1389 #endif1390 1342 { 1391 1343 enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat); … … 1404 1356 if (strat->P.lcm!=NULL) pFree1(strat->P.lcm); 1405 1357 strat->P.lcm=NULL; 1406 #ifdef SDRING1407 }1408 }1409 /* delete the old pair */1410 if (pSDRING &&(oldLcm!=NULL)) pFree1(oldLcm);1411 #endif1412 1358 #ifdef KDEBUG 1413 1359 memset(&strat->P,0,sizeof(strat->P)); … … 1450 1396 pDelete(&strat->kNoether); 1451 1397 Free((ADDRESS)strat->NotUsedAxis,(pVariables+1)*sizeof(BOOLEAN)); 1452 #ifdef SDRING1453 Free((ADDRESS)aug,augmax*sizeof(poly));1454 #endif1455 1398 if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat); 1456 1399 if (TEST_OPT_WEIGHTM) … … 1499 1442 initBuchMoraPos(strat); 1500 1443 initMora(F,strat); 1501 strat->spSpolyLoop = spGetSpolyLoop(currRing,1502 max(strat->ak,pMaxComp(q)),1503 strat->syzComp, FALSE);1504 1444 strat->enterS = enterSMoraNF; 1505 1445 /*- set T -*/ … … 1597 1537 strat->enterS = enterSMoraNF; 1598 1538 /*- set T -*/ 1599 strat->spSpolyLoop = spGetSpolyLoop(currRing,1600 max(strat->ak,idRankFreeModule(q)),1601 strat->syzComp, FALSE);1602 1539 strat->tl = -1; 1603 1540 strat->tmax = setmax; … … 1723 1660 } 1724 1661 if ((h==testHomog) 1725 #ifdef DRING1726 && (!pDRING)1727 #endif1728 1662 ) 1729 1663 { … … 1746 1680 } 1747 1681 pLexOrder=b; 1748 #ifdef DRING1749 if (pDRING) h=isNotHomog;1750 #endif1751 1682 if (h==isHomog) 1752 1683 { … … 1765 1696 } 1766 1697 strat->homog=h; 1767 spSet(currRing);1768 strat->spSpolyLoop = spGetSpolyLoop(currRing, strat, syzComp);1769 1698 if (pOrdSgn==-1) 1770 1699 { … … 1776 1705 else 1777 1706 { 1778 #ifdef STDTRACE1779 lists l;1780 if (w!=NULL)1781 l=bbaLink(F,Q,*w,hilb,strat);1782 else1783 l=bbaLink(F,Q,NULL,hilb,strat);1784 r=(ideal)(l->m[0].data);1785 l->m[0].data=NULL;1786 l->Clean();1787 #else1788 1707 if (w!=NULL) 1789 1708 r=bba(F,Q,*w,hilb,strat); 1790 1709 else 1791 1710 r=bba(F,Q,NULL,hilb,strat); 1792 #endif1793 1711 } 1794 1712 #ifdef KDEBUG … … 1813 1731 //############################################################## 1814 1732 //############################################################## 1815 1816 #ifdef STDTRACE1817 lists TraceStd(leftv lv,int rw, ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,1818 int newIdeal)1819 {1820 lists l;1821 ideal r;1822 stdLink stdTrace=(stdLink) Alloc0(sizeof(skstdLink));1823 BOOLEAN b=pLexOrder,toReset=FALSE;1824 BOOLEAN delete_w=(w==NULL);1825 kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy));1826 1827 if(!TEST_OPT_RETURN_SB)1828 strat->syzComp = syzComp;1829 if (TEST_OPT_SB_1)1830 strat->newIdeal = newIdeal;1831 strat->LazyPass=32000;1832 strat->LazyDegree = 10;1833 strat->ak = idRankFreeModule(F);1834 // if(stdTrace!=NULL)1835 // stdTrace->GetPrimes(F,primes); // Array mit Primzahlen muß geordnet sein !1836 1837 if ((h==testHomog)1838 #ifdef DRING1839 && (!pDRING)1840 #endif1841 )1842 {1843 if (strat->ak == 0)1844 {1845 h = (tHomog)idHomIdeal(F,Q);1846 w=NULL;1847 }1848 else1849 h = (tHomog)idHomModule(F,Q,w);1850 }1851 #ifdef DRING1852 if (pDRING) h=isNotHomog;1853 #endif1854 if (h==isHomog)1855 {1856 if ((w!=NULL) && (*w!=NULL))1857 {1858 kModW = *w;1859 strat->kModW = *w;1860 pOldFDeg = pFDeg;1861 pFDeg = kModDeg;1862 toReset = TRUE;1863 }1864 pLexOrder = TRUE;1865 if (hilb==NULL) strat->LazyPass*=2;1866 }1867 strat->homog=h;1868 spSet(currRing);1869 strat->spSpolyLoop = spGetSpolyLoop(currRing, strat syzComp);1870 // if (pOrdSgn==-1)1871 // {1872 // if (w!=NULL)1873 // r=mora(F,Q,*w,hilb,strat);1874 // else1875 // r=mora(F,Q,NULL,hilb,strat);1876 // }1877 // else1878 {1879 stdTrace->Init(lv,rw);1880 if(w==NULL)1881 l=bbaLink(F,Q,NULL,hilb,strat,stdTrace);1882 else1883 l=bbaLink(F,Q,*w,hilb,strat,stdTrace);1884 r=(ideal) (l->m[0].Data());1885 }1886 #ifdef KDEBUG1887 int i;1888 for (i=0; i<IDELEMS(r); i++) pTest(r->m[i]);1889 #endif1890 if (toReset)1891 {1892 kModW = NULL;1893 pFDeg = pOldFDeg;1894 }1895 pLexOrder = b;1896 //Print("%d reductions canceled \n",strat->cel);1897 HCord=strat->HCord;1898 Free((ADDRESS)strat,sizeof(skStrategy));1899 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;1900 if(stdTrace!=NULL)1901 {1902 stdTrace->Kill();1903 Free(stdTrace, sizeof(skstdLink));1904 }1905 1906 return l;1907 }1908 #endif1909 1733 1910 1734 lists min_std(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp, … … 1928 1752 strat->ak = idRankFreeModule(F); 1929 1753 if ((h==testHomog) 1930 #ifdef DRING1931 && (!pDRING)1932 #endif1933 1754 ) 1934 1755 { … … 1943 1764 } 1944 1765 } 1945 #ifdef DRING1946 if (pDRING) h=isNotHomog;1947 #endif1948 1766 if (h==isHomog) 1949 1767 { … … 1970 1788 } 1971 1789 strat->homog=h; 1972 spSet(currRing);1973 strat->spSpolyLoop = spGetSpolyLoop(currRing, strat, syzComp);1974 1790 if (pOrdSgn==-1) 1975 1791 { … … 1981 1797 else 1982 1798 { 1983 #ifdef STDTRACE1984 lists rl;1985 if (w!=NULL)1986 rl=bbaLink(F, Q, *w, hilb, strat, NULL);1987 else1988 rl=bbaLink(F, Q, NULL, hilb, strat, NULL);1989 r=(ideal)(rl->m[0].data);1990 rl->m[0].data=NULL;1991 rl->Clean();1992 #else1993 1799 if (w!=NULL) 1994 1800 r=bba(F,Q,*w,hilb,strat); 1995 1801 else 1996 1802 r=bba(F,Q,NULL,hilb,strat); 1997 #endif1998 1803 } 1999 1804 #ifdef KDEBUG … … 2044 1849 kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy)); 2045 1850 strat->syzComp = syzComp; 2046 spSet(currRing);2047 1851 if (pOrdSgn==-1) 2048 1852 p=kNF1(F,Q,p,strat,lazyReduce); … … 2056 1860 { 2057 1861 ideal res; 2058 spSet(currRing);2059 1862 if (TEST_OPT_PROT) 2060 1863 { … … 2088 1891 strat->kNoether=pCopy(ppNoether); 2089 1892 strat->ak = idRankFreeModule(F); 2090 spSet(currRing);2091 1893 initBuchMoraCrit(strat); 2092 1894 strat->NotUsedAxis = (BOOLEAN *)Alloc((pVariables+1)*sizeof(BOOLEAN)); … … 2099 1901 strat->tmax = setmax; 2100 1902 strat->T = initT(); 2101 strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);2102 1903 if (pOrdSgn == -1) strat->honey = TRUE; 2103 1904 initS(F,Q,strat); -
Singular/kstd1.h
rc88c949 rd14712 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: kstd1.h,v 1. 8 1998-12-15 10:06:45 pohlExp $ */6 /* $Id: kstd1.h,v 1.9 1999-09-29 10:59:30 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT … … 25 25 ideal kStd(ideal F, ideal Q, tHomog h, intvec ** mw,intvec *hilb=NULL, 26 26 int syzComp=0,int newIdeal=0, intvec *vw=NULL); 27 #ifdef STDTRACE28 lists TraceStd(leftv,int , ideal F, ideal Q, tHomog h, intvec ** w,intvec *hilb=NULL,29 int syzComp=0,int newIdeal=0);30 #endif31 27 32 28 /* the following global data are defined in kutil.cc */ -
Singular/kstd2.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd2.cc,v 1. 29 1999-09-27 14:58:09obachman Exp $ */4 /* $Id: kstd2.cc,v 1.30 1999-09-29 10:59:30 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT - Kernel: alg. of Buchberger … … 15 15 #include "kutil.h" 16 16 #include "kstd1.h" 17 #include "kstd2.h"18 17 #include "khstd.h" 19 #include "spolys.h"20 18 #include "cntrlc.h" 21 19 #include "weight.h" … … 23 21 #include "ipshell.h" 24 22 #include "intvec.h" 25 #include "spSpolyLoop.h"26 #include "kbPolyProcs.h"27 23 28 24 // #include "timer.h" … … 50 46 * assumes homogeneous case and degree-ordering 51 47 */ 48 #if 0 49 static void redSyz (LObject* h,kStrategy strat) 50 { 51 int j = 0,i=0,pos; 52 BOOLEAN exchanged=pDivisibleBy((*h).p2,(*h).p1); 53 poly p,q; 54 55 if (exchanged) 56 { 57 q = kFromInput((*h).p1,strat); 58 if (q==NULL) 59 { 60 exchanged = FALSE; 61 } 62 else 63 { 64 while (i<=strat->Ll) 65 { 66 if ((strat->L[i].p1==strat->P.p1) || (strat->L[i].p2==strat->P.p1)) 67 { 68 deleteInL(strat->L,&strat->Ll,i,strat); 69 } 70 else 71 i++; 72 } 73 i = 0; 74 } 75 } 76 if (TEST_OPT_DEBUG) 77 { 78 PrintS("red:"); 79 wrp(h->p); 80 } 81 while(1) 82 { 83 i = 0; 84 j = strat->sl + 1; 85 while (i <= strat->tl) 86 { 87 if (K_DIVISIBLE_BY(strat->T[i], h->p)) 88 { 89 if ((!exchanged) && (pEqual((*h).p,strat->T[i].p))) 90 { 91 j = 0; 92 while (j<=strat->sl) 93 { 94 if (strat->S[j] == strat->T[i].p) break; 95 } 96 if (j <= strat->sl) break; 97 } 98 else 99 { 100 break; 101 } 102 } 103 i++; 104 } 105 106 if (i > strat->tl) 107 { 108 // nothing to reduce with 109 if (exchanged) 110 { 111 assume(q!= NULL); 112 if (pGetComp((*h).p) > strat->syzComp) 113 { 114 pDelete(&((*h).p)); 115 pDelete(&q); 116 return; 117 } 118 else 119 { 120 if (!TEST_OPT_INTSTRATEGY) 121 { 122 pos = posInS(strat->S,strat->sl,(*h).p); 123 pNorm((*h).p); 124 (*h).p = redtailSyz((*h).p,pos-1,strat); 125 } 126 p = (*h).p; 127 while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=strat->syzComp)) 128 pIter(p); 129 pDelete(&pNext(p)); 130 pNext(p) = q; 131 q = NULL; 132 } 133 } 134 else if (!TEST_OPT_INTSTRATEGY) 135 { 136 pos = posInS(strat->S,strat->sl,(*h).p); 137 pNorm((*h).p); 138 (*h).p = redtailSyz((*h).p,pos-1,strat); 139 } 140 if (q != NULL) pDelete(&q); 141 enterTBba((*h),strat->tl+1,strat); 142 return; 143 } 144 145 // found one to reduce 146 if (j <= strat->sl) 147 { 148 // might have found a better one ? 149 q = kFromInput(strat->S[j],strat); 150 if (q!=NULL) 151 { 152 exchanged = TRUE; 153 p = strat->S[j]; 154 if (!TEST_OPT_INTSTRATEGY) 155 pNorm((*h).p); 156 else 157 { 158 //pContent((*h).p); 159 pCleardenom((*h).p);// also does a pContent 160 } 161 strat->S[j] = (*h).p; 162 (*h).p = p; 163 strat->T[i].p = strat->S[j]; 164 for (i=0;i<=strat->Ll;i++) 165 { 166 if (strat->L[i].p1==p) strat->L[i].p1=strat->S[j]; 167 if (strat->L[i].p2==p) strat->L[i].p2=strat->S[j]; 168 } 169 } 170 } 171 172 if (TEST_OPT_DEBUG) 173 { 174 PrintS(" with "); 175 wrp(strat->T[i].p); 176 } 177 kbReducePoly(h, &(strat->T[i]), strat->kNoether); 178 if (TEST_OPT_DEBUG) 179 { 180 PrintS("\nto "); wrp((*h).p);PrintLn(); 181 } 182 if ((*h).p == NULL) 183 { 184 if (h->lcm!=NULL) pFree1((*h).lcm); 185 #ifdef KDEBUG 186 (*h).lcm=NULL; 187 #endif 188 if (q != NULL) pDelete(&q); 189 return; 190 } 191 } 192 } 193 194 #else 195 52 196 static void redSyz (LObject* h,kStrategy strat) 53 197 { … … 118 262 wrp(strat->S[j]); 119 263 } 120 (*h).p = spSpolyRed(strat->S[j],(*h).p,strat->kNoether, 121 strat->spSpolyLoop); 264 (*h).p = ksOldSpolyRed(strat->S[j],(*h).p,strat->kNoether); 122 265 if (TEST_OPT_DEBUG) 123 266 { … … 175 318 } 176 319 320 #endif 321 177 322 /*2 178 323 * reduction procedure for the homogeneous case … … 219 364 220 365 // now we found one which is divisible 221 k bReducePoly(h, &(strat->T[j]),366 ksReducePoly(h, &(strat->T[j]), 222 367 strat->kNoether); 223 368 #ifdef KDEBUG … … 284 429 wrp(strat->T[j].p); 285 430 } 286 k bReducePoly(h, &(strat->T[j]), strat->kNoether);431 ksReducePoly(h, &(strat->T[j]), strat->kNoether); 287 432 if (TEST_OPT_DEBUG) 288 433 { … … 440 585 h->p = pCopy(h->p); 441 586 } 442 k bReducePoly(h, &(strat->T[ii]), strat->kNoether);587 ksReducePoly(h, &(strat->T[ii]), strat->kNoether); 443 588 if (TEST_OPT_DEBUG) 444 589 { … … 527 672 /* compute the s-polynomial */ 528 673 if (!TEST_OPT_INTSTRATEGY) pNorm((*h).p); 529 p = spSpolyShortBba(strat->T[j].p,(*h).p);674 p = ksCreateShortSpoly(strat->T[j].p,(*h).p); 530 675 /* computes only the first monomial of the spoly */ 531 676 if (p) … … 542 687 if (pDivisibleBy(strat->T[j].p,(*h).p)) 543 688 { 544 ph = spSpolyShortBba(strat->T[j].p,(*h).p);689 ph = ksCreateShortSpoly(strat->T[j].p,(*h).p); 545 690 if (ph==NULL) 546 691 { … … 567 712 } 568 713 pFree1(p); 569 (*h).p = spSpolyRed(strat->T[jbest].p,(*h).p,strat->kNoether, 570 strat->spSpolyLoop); 714 (*h).p = ksOldSpolyRed(strat->T[jbest].p,(*h).p,strat->kNoether); 571 715 } 572 716 else … … 649 793 wrp(strat->S[j]); 650 794 } 651 h = spSpolyRed(strat->S[j],h,strat->kNoether, strat->spSpolyLoop);795 h = ksOldSpolyRed(strat->S[j],h,strat->kNoether); 652 796 if (TEST_OPT_DEBUG) 653 797 { … … 775 919 pFree1(strat->P.p); 776 920 /* the real one */ 777 k bCreateSpoly(&(strat->P),921 ksCreateSpoly(&(strat->P), 778 922 strat->kNoether); 779 923 } … … 890 1034 /*- set S -*/ 891 1035 strat->sl = -1; 892 strat->spSpolyLoop = spGetSpolyLoop(currRing, max(strat->ak, pMaxComp(q)),893 strat->syzComp, FALSE);894 1036 /*- init local data struct.---------------------------------------- -*/ 895 1037 /*Shdl=*/initS(F,Q,strat); … … 935 1077 /*- set S -*/ 936 1078 strat->sl = -1; 937 strat->spSpolyLoop = spGetSpolyLoop(currRing,938 max(strat->ak, idRankFreeModule(q)),939 strat->syzComp, FALSE);940 1079 /*- init local data struct.---------------------------------------- -*/ 941 1080 /*Shdl=*/initS(F,Q,strat); … … 1029 1168 } 1030 1169 strat->homog=h; 1031 spSet(currRing);1032 strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);1033 1170 initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/ 1034 1171 initBuchMoraPos(strat); -
Singular/kstdfac.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstdfac.cc,v 1.2 3 1999-09-27 15:04:58obachman Exp $ */4 /* $Id: kstdfac.cc,v 1.24 1999-09-29 10:59:31 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT - Kernel: factorizing alg. of Buchberger … … 15 15 #include "kutil.h" 16 16 #include "kstd1.h" 17 #include "kstd2.h"18 17 #include "khstd.h" 19 #include "spolys.h"20 18 #include "cntrlc.h" 21 19 #include "weight.h" 22 //#include "ipid.h"23 20 #include "ipshell.h" 24 21 #include "intvec.h" … … 28 25 #include "lists.h" 29 26 #include "ideals.h" 30 #include "spSpolyLoop.h"31 27 #include "timer.h" 32 28 #include "kstdfac.h" … … 207 203 s->fromT=o->fromT; 208 204 s->noetherSet=o->noetherSet; 209 s->spSpolyLoop = o->spSpolyLoop;210 205 return s; 211 206 } … … 453 448 pFree1(strat->P.p); 454 449 /* the real one */ 455 strat->P.p = spSpolyCreate(strat->P.p1, 456 strat->P.p2, 457 strat->kNoether, 458 strat->spSpolyLoop); 450 strat->P.p = ksOldCreateSpoly(strat->P.p1, 451 strat->P.p2, 452 strat->kNoether); 459 453 } 460 454 if (strat->honey) … … 783 777 } 784 778 strat->homog=h; 785 spSet(currRing);786 strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);787 779 initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/ 788 780 initBuchMoraPos(strat); -
Singular/kutil.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kutil.cc,v 1.3 6 1999-09-27 14:57:11 obachman Exp $ */4 /* $Id: kutil.cc,v 1.37 1999-09-29 10:59:31 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: kernel: utils for kStd … … 12 12 #include "tok.h" 13 13 #include "febase.h" 14 #include "spolys.h"15 14 #include "mmemory.h" 16 15 #include "numbers.h" 17 16 #include "polys.h" 18 //#include "ipid.h"19 17 #include "ring.h" 20 18 #include "ideals.h" … … 25 23 #include "kstd1.h" 26 24 #include "kutil.h" 27 #include "spSpolyLoop.h"28 //#include "longrat.h"29 25 30 26 static poly redMora (poly h,int maxIndex,kStrategy strat); 31 27 static poly redBba (poly h,int maxIndex,kStrategy strat); 32 28 33 //int cp, c3;34 //BOOLEAN interpt;35 //BOOLEAN news=FALSE;36 //static BOOLEAN newt=FALSE;/*used for messageSets*/37 29 BITSET test=(BITSET)0; 38 //int ak;39 //int syzComp=0;40 30 int HCord; 41 //LObject P;42 //poly tail;43 //BOOLEAN *pairtest;/*used for enterOnePair*/44 //int // LazyPass=100,45 // LazyDegree=1;46 31 int Kstd1_deg; 47 32 int mu=32000; 48 49 //polyset S;50 //int sl;51 //ideal Shdl;52 //intset ecartS;53 //intset fromQ;54 55 //TSet T;56 //int tl;57 //int tmax;58 59 //LSet L;60 //int Ll;61 //int Lmax;62 63 //LSet B;64 //int Bl;65 //int Bmax;66 67 //BOOLEAN kActive=FALSE;68 //BOOLEAN fromT = FALSE;69 //BOOLEAN honey, sugarCrit;/*option 5*/70 //BOOLEAN Gebauer;71 //BOOLEAN * NotUsedAxis;72 //BOOLEAN homog;73 //BOOLEAN noTailReduction = FALSE;74 75 /*0 implementation*/76 /*77 *static void deleteHCn(poly* p)78 *{79 * poly p1;80 * if (pHEdgeFound && (*p))81 * {82 * if (pComp0(*p,pNoether) == -1)83 * {84 * pDelete(p);85 * return;86 * }87 * p1 = *p;88 * while (pNext(p1))89 * {90 * if (pComp0(pNext(p1), pNoether) == -1) pDelete(&pNext(p1));91 * else pIter(p1);92 * }93 * }94 *}95 */96 33 97 34 /*2 … … 608 545 pLcm(p,strat->S[i],Lp.lcm); 609 546 pSetm(Lp.lcm); 610 #ifdef DRING611 // if ((pDRING) && (pdDFlag(Lp.lcm)==0))612 // {613 // for(j=1;j<=pdN;j++)614 // {615 // if((Lp.pGetExp(lcm,pdX(j))>0)616 // &&(Lp.pGetExp(lcm,pdIX(j))>0))617 // {618 // pFree1(Lp.lcm);619 // Lp.lcm=NULL;620 // return;621 // }622 // }623 // /*delete pairs with lcm contains x_j^a*x_j^(-b)*/624 // }625 #endif626 547 if (strat->sugarCrit) 627 548 { 628 549 if( 629 #ifdef SDRING630 (!pSDRING) &&631 #endif632 550 (!((strat->ecartS[i]>0)&&(ecart>0))) 633 551 && pHasNotCF(p,strat->S[i])) … … 665 583 *if the leading term of r devides lcm(s,p) then (s,p) will not enter B 666 584 */ 667 #ifdef SDRING668 if (!pSDRING)669 #endif670 585 { 671 586 j = strat->Bl; … … 699 614 { 700 615 if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/ 701 #ifdef SDRING702 (!pSDRING) &&703 #endif704 616 pHasNotCF(p,strat->S[i])) 705 617 { … … 734 646 *if the leading term of r devides lcm(s,p) then (s,p) will not enter B 735 647 */ 736 #ifdef SDRING737 if (!pSDRING)738 #endif739 648 for(j = strat->Bl;j>=0;j--) 740 649 { … … 769 678 Lp.p=NULL; 770 679 else 771 #ifdef SDRING 772 // spSpolyShortBba will not work for SDRING 773 if (pSDRING) 774 { 775 Lp.p=spSpolyCreate(strat->S[i],p,strat->kNoether,strat->spSpolyLoop); 776 if (Lp.p!=NULL) 777 pDelete(&pNext(Lp.p)); 778 } 779 else 780 #endif 781 { 782 Lp.p = spSpolyShortBba(strat->S[i],p); 680 { 681 Lp.p = ksCreateShortSpoly(strat->S[i],p); 783 682 } 784 683 if (Lp.p == NULL) … … 814 713 enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l); 815 714 } 816 #ifdef DRING817 if ((pDRING) && (pdDFlag(strat->S[i])==0) && (pdDFlag(p)==0))818 {819 Lp.lcm=pOne();820 pdLcm(strat->S[i],p,Lp.lcm);821 Lp.p1 = strat->S[i];822 Lp.p2 = p;823 Lp.p = pdSpolyCreate(strat->S[i],p);824 if (Lp.p!=NULL)825 {826 /*spoly of p and S[i] bzgl Lp.lcm*/827 strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);828 l = strat->posInL(strat->B,strat->Bl,Lp,strat);829 enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);830 }831 }832 #endif833 715 } 834 716 … … 845 727 pLcm(p,strat->S[i],Lp.lcm); 846 728 pSetm(Lp.lcm); 847 if( 848 #ifdef SDRING 849 (!pSDRING) && 850 #endif 851 (pHasNotCF(p,strat->S[i]))) 729 if(pHasNotCF(p,strat->S[i])) 852 730 { 853 731 strat->cp++; … … 873 751 /*- compute the short s-polynomial -*/ 874 752 875 #ifdef SDRING 876 // spSpolyShortBba will not work for SDRING 877 if (pSDRING) 878 { 879 Lp.p=spSpolyCreate(strat->S[i],p,strat->kNoether,strat->spSpolyLoop); 880 if (Lp.p!=NULL) 881 pDelete(&pNext(Lp.p)); 882 } 883 else 884 #endif 885 { 886 Lp.p = spSpolyShortBba(strat->S[i],p); 887 } 753 Lp.p = ksCreateShortSpoly(strat->S[i],p); 888 754 if (Lp.p == NULL) 889 755 { … … 904 770 enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l); 905 771 } 906 #ifdef DRING907 if ((pDRING) && (pdDFlag(strat->S[i])==0) && (pdDFlag(p)==0))908 {909 Lp.lcm=pOne();910 pdLcm(strat->S[i],p,Lp.lcm);911 Lp.p1 = strat->S[i];912 Lp.p2 = p;913 Lp.p = pdSpolyCreate(strat->S[i],p);914 if (Lp.p!=NULL)915 {916 /*spoly of p and S[i] bzgl Lp.lcm*/917 strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);918 l = strat->posInL(strat->B,strat->Bl,Lp,strat);919 enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);920 }921 }922 #endif923 772 } 924 773 … … 938 787 if (strat->pairtest!=NULL) 939 788 { 940 #ifdef SDRING941 if (!pSDRING)942 #endif943 789 { 944 790 /*- i.e. there is an i with pairtest[i]==TRUE -*/ … … 961 807 strat->pairtest=NULL; 962 808 } 963 if ((strat->Gebauer || strat->fromT) 964 #ifdef SDRING 965 && (!pSDRING) 966 #endif 967 ) 809 if (strat->Gebauer || strat->fromT) 968 810 { 969 811 if (strat->sugarCrit) … … 1074 916 else 1075 917 { 1076 #ifdef SDRING1077 if (!pSDRING)1078 #endif1079 918 for (j=strat->Ll; j>=0; j--) 1080 919 { … … 1109 948 strat->Bl = -1; 1110 949 j = strat->Ll; 1111 #ifdef SDRING1112 if (!pSDRING)1113 #endif1114 950 loop /*cannot be changed into a for !!! */ 1115 951 { … … 2351 2187 ) 2352 2188 { 2353 spSpolyTail(strat->S[j], p, h, strat->kNoether, strat->spSpolyLoop);2189 ksOldSpolyTail(strat->S[j], p, h, strat->kNoether); 2354 2190 hn = pNext(h); 2355 2191 if (hn == NULL) … … 2396 2232 { 2397 2233 strat->redTailChange=TRUE; 2398 spSpolyTail(strat->S[j], p, h, strat->kNoether, strat->spSpolyLoop);2234 ksOldSpolyTail(strat->S[j], p, h, strat->kNoether); 2399 2235 hn = pNext(h); 2400 2236 if (hn == NULL) … … 2437 2273 if (pDivisibleBy(strat->S[j], hn) && (!pEqual(strat->S[j],h))) 2438 2274 { 2439 spSpolyTail(strat->S[j], p, h, strat->kNoether, strat->spSpolyLoop);2275 ksOldSpolyTail(strat->S[j], p, h, strat->kNoether); 2440 2276 hn = pNext(h); 2441 2277 if (hn == NULL) … … 2544 2380 LObject h; 2545 2381 int i,pos; 2546 #ifdef SDRING2547 polyset aug=(polyset)Alloc(setmax*sizeof(poly));2548 int augmax=setmax, augl=-1;2549 #endif2550 2382 2551 2383 h.ecart=0; h.length=0; … … 2600 2432 { 2601 2433 h.p = pCopy(F->m[i]); 2602 #ifdef SDRING2603 aug[0]=h.p;2604 augl=0;2605 #ifdef SRING2606 if (pSRING)2607 psAug(pCopy(h.p),pOne(),&aug,&augl,&augmax);2608 #endif2609 #ifdef DRING2610 if (pDRING)2611 pdAug(pCopy(h.p),&aug,&augl,&augmax);2612 #endif2613 for (augl++;augl != 0;)2614 {2615 h.p=aug[--augl];2616 #ifdef KDEBUG2617 pHeapTest(h.p, h.heap);2618 #endif2619 #ifdef KDEBUG2620 if (TEST_OPT_DEBUG && pSDRING)2621 {2622 PrintS("new (aug) s:");2623 wrp(h.p);2624 PrintLn();2625 }2626 #endif2627 #endif2628 2434 if (TEST_OPT_INTSTRATEGY) 2629 2435 { … … 2656 2462 strat->enterS(h,pos,strat); 2657 2463 } 2658 #ifdef SDRING2659 }2660 #endif2661 2464 } 2662 2465 } … … 2666 2469 while (strat->sl>0) deleteInS(strat->sl,strat); 2667 2470 } 2668 #ifdef SDRING2669 Free((ADDRESS)aug,augmax*sizeof(poly));2670 #endif2671 2471 } 2672 2472 … … 2675 2475 LObject h; 2676 2476 int i,pos; 2677 #ifdef SDRING2678 polyset aug=(polyset)Alloc(setmax*sizeof(poly));2679 int augmax=setmax, augl=-1;2680 #endif2681 2477 2682 2478 h.ecart=0; h.length=0; … … 2734 2530 h.p2=NULL; 2735 2531 h.lcm=NULL; 2736 #ifdef SDRING2737 aug[0]=h.p;2738 augl=0;2739 #ifdef SRING2740 if (pSRING)2741 psAug(pCopy(h.p),pOne(),&aug,&augl,&augmax);2742 #endif2743 #ifdef DRING2744 if (pDRING)2745 pdAug(pCopy(h.p),&aug,&augl,&augmax);2746 #endif2747 for (augl++;augl != 0;)2748 {2749 h.p=aug[--augl];2750 #ifdef KDEBUG2751 pTest(h.p);2752 #endif2753 #ifdef SDRING2754 if (TEST_OPT_DEBUG && pSDRING)2755 {2756 PrintS("new (aug) s:");2757 wrp(h.p);2758 PrintLn();2759 }2760 #endif2761 #endif2762 2532 if (TEST_OPT_INTSTRATEGY) 2763 2533 { … … 2790 2560 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos); 2791 2561 } 2792 #ifdef SDRING2793 }2794 #endif2795 2562 } 2796 2563 } … … 2800 2567 while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat); 2801 2568 } 2802 #ifdef SDRING2803 Free((ADDRESS)aug,augmax*sizeof(poly));2804 #endif2805 2569 } 2806 2570 … … 2813 2577 LObject h; 2814 2578 int i,pos; 2815 #ifdef SDRING2816 polyset aug=(polyset)Alloc(setmax*sizeof(poly));2817 int augmax=setmax, augl=-1;2818 #endif2819 2579 2820 2580 h.ecart=0; h.length=0; … … 2950 2710 } 2951 2711 } 2952 #ifdef SDRING2953 Free((ADDRESS)aug,augmax*sizeof(poly));2954 #endif2955 2712 } 2956 2713 /*2 … … 2965 2722 { 2966 2723 if (pDivisibleBy(strat->S[j],h)) 2967 return spSpolyRedNew(strat->S[j],h,strat->kNoether, strat->spSpolyLoop);2724 return ksOldSpolyRedNew(strat->S[j],h,strat->kNoether); 2968 2725 else j++; 2969 2726 } … … 3038 2795 if (pDivisibleBy(strat->S[j],h)) 3039 2796 { 3040 h = spSpolyRed(strat->S[j],h,strat->kNoether, strat->spSpolyLoop);2797 h = ksOldSpolyRed(strat->S[j],h,strat->kNoether); 3041 2798 if (h==NULL) return NULL; 3042 2799 j = start; … … 3059 2816 if (pDivisibleBy(strat->S[j],h)) 3060 2817 { 3061 h = spSpolyRed(strat->S[j],h,strat->kNoether, strat->spSpolyLoop);2818 h = ksOldSpolyRed(strat->S[j],h,strat->kNoether); 3062 2819 if (h==NULL) return NULL; 3063 2820 j = 0; … … 3087 2844 && ((e >= strat->ecartS[j]) || strat->kHEdgeFound)) 3088 2845 { 3089 h1 = spSpolyRedNew(strat->S[j],h,strat->kNoether, strat->spSpolyLoop);2846 h1 = ksOldSpolyRedNew(strat->S[j],h,strat->kNoether); 3090 2847 if(TEST_OPT_DEBUG) 3091 2848 { … … 3116 2873 int i, suc=0; 3117 2874 poly redSi=NULL; 3118 #ifdef SDRING3119 polyset aug=(polyset)Alloc(setmax*sizeof(poly));3120 int augmax=setmax;3121 int augl;3122 int pos;3123 BOOLEAN recursiv=FALSE;3124 #endif3125 2875 3126 2876 //Print("nach initS: updateS start mit sl=%d\n",(strat->sl)); … … 3166 2916 i--; 3167 2917 } 3168 #ifdef SDRING3169 else if ((pSDRING) && (pComp(redSi,strat->S[i])!=0))3170 {3171 pDelete(&redSi);3172 redSi=strat->S[i];3173 strat->S[i]=NULL;3174 deleteInS(i,strat);3175 suc=0;3176 i=0;3177 aug[0]=redSi;3178 augl=0;3179 #ifdef SRING3180 if (pSRING) psAug(pCopy(redSi),pOne(),&aug,&augl,&augmax);3181 #endif3182 #ifdef DRING3183 if (pDRING) pdAug(pCopy(redSi),&aug,&augl,&augmax);3184 #endif3185 redSi=NULL;3186 if (augl>0) recursiv=TRUE;3187 while (augl >= 0)3188 {3189 h.p=aug[augl];3190 pHeapTest(h.p, p.heap);3191 if (h.p!=NULL)3192 {3193 if (TEST_OPT_DEBUG)3194 {3195 Print("new (aug %d) s:",augl);3196 wrp(h.p);3197 PrintLn();3198 }3199 if (TEST_OPT_INTSTRATEGY)3200 {3201 //pContent(h.p);3202 pCleardenom(h.p);// also does a pContent3203 }3204 else3205 {3206 pNorm(h.p);3207 }3208 strat->initEcart(&h);3209 pos = posInS(strat->S,strat->sl,h.p);3210 strat->enterS(h,pos,strat);3211 }3212 augl--;3213 }3214 }3215 #endif3216 2918 else 3217 2919 { … … 3237 2939 { 3238 2940 if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) 3239 #ifdef SDRING3240 && (!pSDRING)3241 #endif3242 2941 ) 3243 2942 h.p = redtailBba(strat->S[i],i-1,strat); … … 3275 2974 i--; 3276 2975 } 3277 #ifdef SDRING3278 else if ((pSDRING) && (pComp(redSi,(strat->S)[i])!=0))3279 {3280 pDelete(&redSi);3281 redSi=(strat->S)[i];3282 (strat->S)[i]=NULL;3283 deleteInS(i,strat);3284 i--;3285 aug[0]=redSi;3286 augl=0;3287 #ifdef SRING3288 if (pSRING) psAug(pCopy(redSi),pOne(),&aug,&augl,&augmax);3289 #endif3290 #ifdef DRING3291 if (pDRING) pdAug(pCopy(redSi),&aug,&augl,&augmax);3292 #endif3293 redSi=NULL;3294 if (augl>0) recursiv=TRUE;3295 for (augl++;augl != 0;)3296 {3297 h.p=aug[--augl];3298 #ifdef KDEBUG3299 if (TEST_OPT_DEBUG)3300 {3301 PrintS("new (aug) s:");3302 wrp(h.p);3303 PrintLn();3304 }3305 #endif3306 if (!TEST_OPT_INTSTRATEGY)3307 pNorm(h.p);3308 else3309 {3310 //pContent(h.p);3311 pCleardenom(h.p);// also does a pContent3312 }3313 strat->initEcart(&h);3314 pos = posInS(strat->S,strat->sl,h.p);3315 strat->enterS(h,pos,strat);3316 }3317 }3318 #endif3319 2976 else if (TEST_OPT_INTSTRATEGY) 3320 2977 { … … 3354 3011 { 3355 3012 if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) 3356 #ifdef SDRING3357 && (!pSDRING)3358 #endif3359 3013 ) 3360 3014 { … … 3376 3030 } 3377 3031 if (redSi!=NULL) pDelete1(&redSi); 3378 #ifdef SDRING3379 Free((ADDRESS)aug,augmax*sizeof(poly));3380 if (recursiv) updateS(FALSE,strat);3381 #endif3382 3032 #ifdef KDEBUG 3383 3033 kTest(strat); … … 3393 3043 int i; 3394 3044 3395 #ifdef SDRING3396 if (pSDRING3397 && (atS<=strat->sl)3398 && pComparePolys(p.p,strat->S[atS]))3399 {3400 if (TEST_OPT_PROT)3401 PrintS("m");3402 p.p=NULL;3403 return;3404 }3405 if (pSDRING3406 && (atS<strat->sl)3407 && pComparePolys(p.p,strat->S[atS+1]))3408 {3409 if (TEST_OPT_PROT)3410 PrintS("m");3411 p.p=NULL;3412 return;3413 }3414 if (pSDRING3415 && (atS>0)3416 && pComparePolys(p.p,strat->S[atS-1]))3417 {3418 if (TEST_OPT_PROT)3419 PrintS("m");3420 p.p=NULL;3421 return;3422 }3423 #endif3424 3045 strat->news = TRUE; 3425 3046 /*- puts p to the standardbasis s at position at -*/ … … 3664 3285 else 3665 3286 { 3666 #ifdef SDRING3667 if (3668 #ifdef SRING3669 pSRING ||3670 #endif3671 #ifdef DRING3672 pDRING ||3673 #endif3674 0)3675 initS(F, Q,strat); /*sets also S, ecartS, fromQ */3676 else3677 #endif3678 3287 /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */ 3679 3288 // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */ -
Singular/kutil.h
rc88c949 rd14712 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: kutil.h,v 1.1 5 1999-09-27 14:57:12 obachman Exp $ */6 /* $Id: kutil.h,v 1.16 1999-09-29 10:59:32 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT: kernel: utils for kStd … … 68 68 int (*posInLOld)(const LSet Ls,const int Ll, 69 69 const LObject &Lo,const kStrategy strat); 70 void (*spSpolyLoop)(poly p1, poly p2, poly m, poly spNoether);71 70 pFDegProc pOldFDeg; 72 71 ideal Shdl; … … 173 172 BOOLEAN newHEdge(polyset S, int ak,kStrategy strat); 174 173 175 rOrderType_t spGetOrderType(ring r, int modrank, int syzcomp);176 extern int spCheckCoeff(number *a, number *b);177 178 174 inline TSet initT () { return (TSet)Alloc0(setmax*sizeof(TObject)); } 179 175 … … 197 193 #endif 198 194 195 /*************************************************************** 196 * 197 * From kstd2.cc 198 * 199 ***************************************************************/ 200 ideal bba (ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat); 201 poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce); 202 ideal kNF2 (ideal F,ideal Q,ideal q, kStrategy strat, int lazyReduce); 203 void initBba(ideal F,kStrategy strat); 204 205 /*************************************************************** 206 * 207 * From kSpolys.cc 208 * 209 ***************************************************************/ 210 // Reduces PR with PW 211 // Assumes PR != NULL, PW != NULL, Lm(PW) divides Lm(PR) 212 // Changes: PR 213 // Const: PW 214 // If coef != NULL, then *coef is a/gcd(a,b), where a = LC(PR), b = LC(PW) 215 void ksReducePoly(LObject* PR, 216 TObject* PW, 217 poly spNoether = NULL, 218 number *coef = NULL); 219 220 // Reduces PR at Current->next with PW 221 // Assumes PR != NULL, Current contained in PR 222 // Current->next != NULL, LM(PW) devides LM(Current->next) 223 // Changes: PR 224 // Const: PW 225 void ksReducePolyTail(LObject* PR, 226 TObject* PW, 227 poly Current, 228 poly spNoether = NULL); 229 230 // Creates S-Poly of Pair 231 // Const: Pair->p1, Pair->p2 232 // Changes: Pair->p == S-Poly of p1, p2 233 // Assume: Pair->p1 != NULL && Pair->p2 234 void ksCreateSpoly(LObject* Pair, 235 poly spNoether = NULL); 236 237 238 /*2 239 * creates the leading term of the S-polynomial of p1 and p2 240 * do not destroy p1 and p2 241 * remarks: 242 * 1. the coefficient is 0 (nNew) 243 * 2. pNext is undefined 244 */ 245 poly ksCreateShortSpoly(poly p1, poly p2); 246 247 248 /* 249 * input - output: a, b 250 * returns: 251 * a := a/gcd(a,b), b := b/gcd(a,b) 252 * and return value 253 * 0 -> a != 1, b != 1 254 * 1 -> a == 1, b != 1 255 * 2 -> a != 1, b == 1 256 * 3 -> a == 1, b == 1 257 * this value is used to control the spolys 258 */ 259 int ksCheckCoeff(number *a, number *b); 260 261 // old stuff 262 poly ksOldSpolyRed(poly p1, poly p2, poly spNoether = NULL); 263 poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether = NULL); 264 poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether = NULL); 265 void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether); 199 266 200 267 #ifdef HAVE_SHORT_EVECTORS -
Singular/mmheap.h
rc88c949 rd14712 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: mmheap.h,v 1. 9 1999-09-27 15:05:25obachman Exp $ */6 /* $Id: mmheap.h,v 1.10 1999-09-29 10:59:33 obachman Exp $ */ 7 7 #include <stdlib.h> 8 8 #include "mod2.h" … … 56 56 * 57 57 *****************************************************************/ 58 59 58 #ifndef HEAP_DEBUG 60 59 … … 89 88 90 89 #endif 90 /* use this for unknown heaps */ 91 #define MM_UNKNOWN_HEAP ((memHeap) 1) 91 92 92 93 /***************************************************************** -
Singular/mod2.h.in
rc88c949 rd14712 5 5 * DO NOT EDIT! 6 6 * 7 * Version: $Id: mod2.h.in,v 1.6 8 1999-09-27 14:37:13 obachman Exp $7 * Version: $Id: mod2.h.in,v 1.69 1999-09-29 10:59:33 obachman Exp $ 8 8 *******************************************************************/ 9 9 #ifndef MOD2_H … … 157 157 /* Define to enable TCL interface */ 158 158 #undef HAVE_TCL 159 /* Define to enable working in Weyl algebras */160 #undef DRING161 /* Define to enable working in exterior algebras */162 #undef SRING163 159 164 160 /* Undefine to disable Gerhard's and Wilfried's fast and dirty std computations */ … … 244 240 245 241 #define SINGULAR_VERSION (SINGULAR_MAJOR_VERSION*1000 + SINGULAR_MINOR_VERSION*100 + SINGULAR_SUB_VERSION) 246 #ifdef DRING247 #define SDRING248 #endif249 250 #ifdef SRING251 #define SDRING252 #endif253 242 254 243 #if SIZEOF_EXPONENT == 1 … … 365 354 #endif 366 355 367 368 /* define PDEBUG checking polys, undefine otherwise */ 369 /* define PDEBUG 1 for additionally checking access to polys -- vewry slow !*/ 370 #define PDEBUG 1 371 /* define KDEBUG checking during standard base computation */ 372 #define KDEBUG 356 /* undef PDEBUG to disable checks of polys 357 * 358 * define PDEBUG to 359 * 0 for basic, explicitely requested tests 360 * 1 for tests in pProcs 361 * 2 for low-level tests (Exponent access, primitive monom operations) 362 * NOTE: for PDEBUG > 1 it gets very slow 363 * You can locally enable tests in pProcs by setting the 364 * define at the beginning of pProcs.cc 365 */ 366 #define PDEBUG 0 367 368 /* undef KDEBUG for checck of data during std computations 369 * 370 * define KDEBUG to 371 * 0 for basic tests 372 * 1 for tests in kSpoly 373 * NOTE: You can locally enable tests in kspoly by setting the 374 * define at the beginning of kspoly.cc 375 */ 376 #define KDEBUG 0 377 373 378 /* define LDEBUG checking numbers, undefine otherwise */ 374 379 #define LDEBUG -
Singular/mpsr_Error.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mpsr_Error.cc,v 1. 9 1999-09-27 15:05:26obachman Exp $ */4 /* $Id: mpsr_Error.cc,v 1.10 1999-09-29 10:59:34 obachman Exp $ */ 5 5 6 6 /*************************************************************** … … 54 54 { 55 55 mpsr_SetError(mpsr_MP_Failure); 56 mpsr_MP_errno = link->MP_errno;56 mpsr_MP_errno = (enum MP_Errors) link->MP_errno; 57 57 return mpsr_MP_Failure; 58 58 } -
Singular/numbers.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: numbers.cc,v 1. 19 1999-09-16 12:34:00 SingularExp $ */4 /* $Id: numbers.cc,v 1.20 1999-09-29 10:59:34 obachman Exp $ */ 5 5 6 6 /* … … 21 21 #include "gnumpc.h" 22 22 #include "ring.h" 23 #ifndef FAST_AND_DIRTY24 #undef npMultM25 #undef npSubM26 #undef npNegM27 #undef npEqualM28 #endif29 23 #include "ffields.h" 30 24 #include "shortfl.h" -
Singular/numbers.h
rc88c949 rd14712 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: numbers.h,v 1. 9 1999-09-16 12:34:01 SingularExp $ */6 /* $Id: numbers.h,v 1.10 1999-09-29 10:59:34 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT: interface to coefficient aritmetics … … 68 68 void nSetChar(ring r, BOOLEAN complete); 69 69 70 #ifndef FAST_AND_DIRTY71 #define npMultM nMult72 #define npSubM nSub73 #define npNegM nNeg74 #define npEqualM nEqual75 70 #endif 76 77 #endif -
Singular/polys-comp.h
rc88c949 rd14712 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: polys-comp.h,v 1.1 1 1999-09-27 15:05:28obachman Exp $ */6 /* $Id: polys-comp.h,v 1.12 1999-09-29 10:59:35 obachman Exp $ */ 7 7 8 8 /*************************************************************** … … 358 358 { 359 359 long d; 360 long _i = currRing->pCompLSize - 1;361 register const long* s1 = &(p1->exp.l[currRing->pCompHighIndex]);362 register const long* s2 = &(p2->exp.l[currRing->pCompHighIndex]);360 unsigned long _i = currRing->pCompLSize - 1; 361 register const unsigned long* s1 = &(p1->exp.l[currRing->pCompHighIndex]); 362 register const unsigned long* s2 = &(p2->exp.l[currRing->pCompHighIndex]); 363 363 364 364 for (;;) -
Singular/polys-impl.h
rc88c949 rd14712 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: polys-impl.h,v 1.3 4 1999-09-29 09:52:38 SingularExp $ */6 /* $Id: polys-impl.h,v 1.35 1999-09-29 10:59:36 obachman Exp $ */ 7 7 8 8 /*************************************************************** … … 41 41 typedef Exponent_t* Exponent_pt; 42 42 43 typedef long Order_t;43 typedef unsigned long Order_t; 44 44 struct spolyrec 45 45 { … … 324 324 { 325 325 int i = currRing->ExpLSize; 326 long* s1 = &(p1->exp.l[0]);327 const long* s2 = &(p2->exp.l[0]);326 unsigned long* s1 = &(p1->exp.l[0]); 327 const unsigned long* s2 = &(p2->exp.l[0]); 328 328 for (;;) 329 329 { … … 345 345 { 346 346 int i = currRing->ExpLSize; 347 long* s1 = &(p1->exp.l[0]);348 const long* s2 = &(p2->exp.l[0]);347 unsigned long* s1 = &(p1->exp.l[0]); 348 const unsigned long* s2 = &(p2->exp.l[0]); 349 349 350 350 for (;;) … … 367 367 #endif // defined(PDEBUG) && PDEBUG > 1 368 368 { 369 long* s1 = &(p1->exp.l[0]);370 const long* s2 = &(p2->exp.l[0]);371 const long* s3 = &(p3->exp.l[0]);372 const long* const ub = s3 + currRing->ExpLSize;369 unsigned long* s1 = &(p1->exp.l[0]); 370 const unsigned long* s2 = &(p2->exp.l[0]); 371 const unsigned long* s3 = &(p3->exp.l[0]); 372 const unsigned long* const ub = s3 + currRing->ExpLSize; 373 373 374 374 p1->next = p2->next; … … 484 484 DECLARE(BOOLEAN, _pEqual(poly p1, poly p2)) 485 485 { 486 const long *s1 = (long*) &(p1->exp.l[0]);487 const long *s2 = (long*) &(p2->exp.l[0]);488 const long* const lb = s1 + currRing->ExpLSize;486 const unsigned long *s1 = (unsigned long*) &(p1->exp.l[0]); 487 const unsigned long *s2 = (unsigned long*) &(p2->exp.l[0]); 488 const unsigned long* const lb = s1 + currRing->ExpLSize; 489 489 490 490 for(;;) -
Singular/polys.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys.cc,v 1.4 2 1999-09-28 15:02:32obachman Exp $ */4 /* $Id: polys.cc,v 1.43 1999-09-29 10:59:36 obachman Exp $ */ 5 5 6 6 /* … … 54 54 /* 1 for c ordering, -1 otherwise (i.e. for C ordering) */ 55 55 int pComponentOrder; 56 57 #ifdef DRING58 int p2;59 BOOLEAN pDRING=FALSE;60 #endif61 62 #ifdef SRING63 int pAltVars;64 BOOLEAN pSRING=FALSE;65 #endif66 67 #ifdef SDRING68 BOOLEAN pSDRING=FALSE;69 #include "polys.inc"70 #endif71 56 72 57 /* ----------- global variables, set by procedures from hecke/kstd1 ----- */ … … 719 704 pComponentOrder=1; 720 705 if (ppNoether!=NULL) pDelete(&ppNoether); 721 #ifdef SRING722 pSRING=FALSE;723 pAltVars=r->N+1;724 #endif725 706 pVariables = r->N; 726 707 … … 861 842 poly aa=a; 862 843 poly prev=NULL; 863 #ifdef SDRING864 poly pDRINGres=NULL;865 #endif866 844 867 845 pMultT_nok = pGetComp(exp); … … 883 861 else 884 862 { 885 #ifdef DRING886 if (pDRING)887 {888 if (pdDFlag(a)==1)889 {890 if (pdDFlag(exp)==1)891 {892 pDRINGres=pAdd(pDRINGres,pMultDD(a,exp));893 }894 else895 {896 pDRINGres=pAdd(pDRINGres,pMultDT(a,exp));897 }898 }899 else900 {901 if (pdDFlag(exp)==1)902 {903 pDRINGres=pAdd(pDRINGres,pMultDD(a,exp));904 }905 else906 {907 pDRINGres=pAdd(pDRINGres,pMultTT(a,exp));908 }909 }910 }911 else912 #endif913 #ifdef SRING914 if (pSRING)915 {916 pDRINGres=pAdd(pDRINGres,psMultM(a,exp));917 }918 else919 #endif920 863 { 921 864 if (pMultT_nok) /* comp of exp != 0 */ … … 933 876 } 934 877 pMultT_nok=0; 935 #ifdef SDRING936 if (937 #ifdef DRING938 pDRING ||939 #endif940 #ifdef SRING941 pSRING ||942 #endif943 0 )944 {945 pDelete(&aa);946 pTest(pDRINGres);947 return pDRINGres;948 }949 #endif950 878 pTest(aa); 951 879 return aa; /*TRUE*/ … … 1187 1115 else 1188 1116 { 1189 #ifdef DRING1190 if (pDRING)1191 {1192 for(i=1;i<=pdN;i++)1193 {1194 if(pGetExp(rc,pdDX(i))>0)1195 {1196 pdSetDFlag(rc,1);1197 break;1198 }1199 }1200 }1201 #endif1202 1117 pSetm(rc); 1203 1118 } … … 1589 1504 BOOLEAN pHasNotCF(poly p1, poly p2) 1590 1505 { 1591 #ifdef SRING1592 if (pSRING)1593 return FALSE;1594 #endif1595 1506 1596 1507 if (pGetComp(p1) > 0 || pGetComp(p2) > 0) -
Singular/polys.h
rc88c949 rd14712 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: polys.h,v 1.2 3 1999-09-28 15:01:20obachman Exp $ */6 /* $Id: polys.h,v 1.24 1999-09-29 10:59:37 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT - all basic methods to manipulate polynomials … … 20 20 extern int pComponentOrder; 21 21 22 #ifdef DRING23 // D=k[x,d,y] is the Weyl-Algebra [y], y commuting with all others24 // M=k[x,x^(-1),y] is a D-module25 // all x(1..n),d,x(1..n)^(-1),y(1..k) are considered as "ring variables" v(1..N)26 // the map from x(i) to v:27 #define pdX(i) (i)28 // d(i)29 #define pdDX(i) (pdN+i)30 // x(i)^(-1)31 #define pdIX(i) (pdN+i)32 // y(i)33 #define pdY(i) (pdN*2+i+1)34 // a monomial m belongs to a D-module M iff pdDFlag(m)==035 // a monomial m belongs to an ideal in the Weyl-Algebra D iff pdDFlag(m)==136 #define pdDFlag(m) pGetExp(m,pdN*2+1)37 #define pdSetDFlag(m,i) pSetExp(m,pdN*2+1,i)38 39 extern int pdN;40 extern int pdK;41 extern BOOLEAN pDRING;42 poly pdSpolyCreate(poly a, poly b);43 void pdLcm(poly a, poly b, poly m);44 BOOLEAN pdIsConstantComp(poly p);45 void spModuleToPoly(poly a1);46 void pdSetDFlagP(poly p,int i);47 #endif48 #ifdef SRING49 extern int pAltVars;50 extern BOOLEAN pSRING;51 #endif52 #ifdef SDRING53 void psAug(poly q, poly done, polyset *s, int *l, int *m);54 void pdAug(poly q, polyset *s, int *l, int *m);55 #endif56 #ifdef SDRING57 extern BOOLEAN pSDRING;58 #endif59 60 22 /* function prototypes */ 61 23 … … 121 83 BOOLEAN pHasNotCF(poly p1, poly p2); /*has no common factor ?*/ 122 84 void pSplit(poly p, poly * r); /*p => IN(p), r => REST(p) */ 85 // Returns TRUE if m is monom of p, FALSE otherwise 86 BOOLEAN pIsMonomOf(poly p, poly m); 123 87 124 88 … … 349 313 // This is something weird -- Don't use it, unless you know what you are doing 350 314 poly pTakeOutComp(poly * p, int k); 315 void pSetPolyComp(poly p, int comp); 351 316 void pDeleteComp(poly * p,int k); 352 317 void pNorm(poly p); … … 375 340 // tests (see polys-impl.cc ) 376 341 unsigned long pGetShortExpVector(poly p); 342 343 377 344 378 345 -
Singular/polys0.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys0.cc,v 1.1 1 1999-09-27 15:05:31obachman Exp $ */4 /* $Id: polys0.cc,v 1.12 1999-09-29 10:59:37 obachman Exp $ */ 5 5 6 6 /* … … 35 35 && (!nIsMOne(pGetCoeff(p))) 36 36 ) 37 #ifdef DRING38 || (pDRING && pdIsConstantComp(p))39 #endif40 37 ) 41 38 { … … 59 56 for (i=0; i<pVariables; i++) 60 57 { 61 #ifdef DRING62 if ((!pDRING)||(i!=2*pdN))63 #endif64 58 { 65 59 Exponent_t ee = pGetExp(p,i+1); … … 71 65 wroteCoef=(pShortOut==0); 72 66 writeGen=TRUE; 73 #ifdef DRING74 if((pDRING)&&(pdN<=i)&&(i<2*pdN)&&(pdDFlag(p)==0))75 {76 StringAppendS(RingVar(i-pdN));77 ee=-ee;78 }79 else80 StringAppendS(RingVar(i));81 #else82 67 StringAppendS(RingVar(i)); 83 #endif84 68 if (ee != 1) 85 69 { -
Singular/polys1.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys1.cc,v 1.2 8 1999-09-28 15:02:33obachman Exp $ */4 /* $Id: polys1.cc,v 1.29 1999-09-29 10:59:38 obachman Exp $ */ 5 5 6 6 /* … … 77 77 } 78 78 return k; 79 } 80 81 BOOLEAN pIsMonomOf(poly p, poly m) 82 { 83 if (m == NULL) return TRUE; 84 while (p != NULL) 85 { 86 if (p == m) return TRUE; 87 pIter(p); 88 } 89 return FALSE; 79 90 } 80 91 … … 478 489 } 479 490 } 480 #ifdef SDRING481 if(pSDRING)482 {483 return pPow(p,i);484 }485 else486 #endif487 491 { 488 492 rc = pNext(p); -
Singular/ring.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ring.cc,v 1.6 5 1999-09-27 14:39:25obachman Exp $ */4 /* $Id: ring.cc,v 1.66 1999-09-29 10:59:38 obachman Exp $ */ 5 5 6 6 /* … … 22 22 #include "longalg.h" 23 23 #include "ffields.h" 24 #include "spolys.h"25 24 #include "subexpr.h" 26 25 #include "ideals.h" … … 53 52 // complete == FALSE : only delete operations are enabled 54 53 // complete == TRUE : full reset of all variables 55 #ifdef DRING56 void rChangeCurrRing(ring r, BOOLEAN complete, idhdl h)57 #else58 54 void rChangeCurrRing(ring r, BOOLEAN complete) 59 #endif60 55 { 61 56 /*------------ set global ring vars --------------------------------*/ … … 89 84 } 90 85 91 #ifdef DRING92 pDRING=FALSE;93 pSDRING=FALSE;94 if ((h!=NULL) && (hasFlag(h,FLAG_DRING))) rDSet();95 #endif // DRING96 97 #ifdef SRING98 if ((currRing->partN<=currRing->N)99 #ifdef DRING100 && ((h==NULL) || (!hasFlag(h,FLAG_DRING)))101 #endif102 )103 {104 pAltVars=currRing->partN;105 pSRING=TRUE;106 pSDRING=TRUE;107 }108 else109 {110 pAltVars=currRing->N+1;111 }112 #endif // SRING113 114 86 /*------------ set spolys ------------------------------------------*/ 115 spSet(r);116 87 } 117 88 } … … 140 111 141 112 /*------------ change the global ring -----------------------*/ 142 #ifdef DRING143 rChangeCurrRing(rg,complete,h);144 #else145 113 rChangeCurrRing(rg,complete); 146 #endif147 114 currRingHdl = h; 148 115 … … 206 173 r->N = 3; 207 174 /*r->P = 0; Alloc0 in idhdl::set, ipid.cc*/ 208 #ifdef SRING209 r->partN = 4;210 #endif211 175 /*names*/ 212 176 r->names = (char **) Alloc(3 * sizeof(char *)); … … 650 614 s: name, chr: ch, varnames: rv, ordering: ord, typ: typ 651 615 */ 652 #ifdef DRING653 void rDSet()654 {655 pDRING=TRUE;656 pSDRING=TRUE;657 pdN=currRing->partN;658 pdK=pVariables-pdN*2-1;659 }660 #endif661 616 662 617 int rIsRingVar(char *n) … … 2409 2364 r->ExpLSize=j/(sizeof(long)/sizeof(Exponent_t)); 2410 2365 r->mm_specHeap = mmGetSpecHeap(POLYSIZE + (r->ExpLSize)*sizeof(long)); 2366 if (r->mm_specHeap == NULL) 2367 { 2368 // monomial too large, clean up 2369 Free((ADDRESS)tmp_ordsgn,(2*(n+r->N)*sizeof(long))); 2370 Free((ADDRESS)tmp_typ,(2*(n+r->N)*sizeof(sro_ord))); 2371 Free((ADDRESS)v,(r->N+1)*sizeof(int)); 2372 return TRUE; 2373 } 2374 2411 2375 2412 2376 // ---------------------------- -
Singular/ring.h
rc88c949 rd14712 7 7 * ABSTRACT - the interpreter related ring operations 8 8 */ 9 /* $Id: ring.h,v 1.3 3 1999-09-27 14:39:26obachman Exp $ */9 /* $Id: ring.h,v 1.34 1999-09-29 10:59:39 obachman Exp $ */ 10 10 11 11 /* includes */ … … 16 16 17 17 18 #ifdef DRING19 void rChangeCurrRing(ring r, BOOLEAN complete = TRUE, idhdl h = NULL);20 #else21 18 void rChangeCurrRing(ring r, BOOLEAN complete = TRUE); 22 #endif23 19 void rSetHdl(idhdl h, BOOLEAN complete = TRUE); 24 20 idhdl rInit(char *s, sleftv* pn, sleftv* rv, sleftv* ord); … … 51 47 52 48 idhdl rFindHdl(ring r, idhdl n, idhdl w); 53 #ifdef DRING54 void rDSet();55 #endif56 49 void rDInit(); 57 50 int rOrderName(char * ordername); -
Singular/spSpolyLoop.inc
rc88c949 rd14712 1 typedef enum Characteristics {chGEN = 0, chMODP} Characteristics;2 typedef enum OrderingTypes {otGEN = 0, otEXP, otCOMPEXP, otEXPCOMP} OrderingTypes;3 typedef enum Homogs {homGEN = 0, homYES} Homogs;4 typedef enum NumWords {nwGEN = 0, nwONE, nwTWO, nwEVEN, nwODD} NumWords;5 static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwEVEN6 (poly a1, poly a2, poly monom, poly spNoether)7 {8 poly a = monom, // collects the result9 b = NULL, // stores a1*monom10 c; // used for temporary storage11 number tm = pGetCoeff(monom), // coefficient of monom12 tneg = npNegM(tm), // - (coefficient of monom)13 tb, // used for tm*coeff(a1)14 tc; // used for intermediate coeff15 16 Order_t order; // used for homog case17 18 if (a2==NULL) goto Finish; // we are done if a2 is 019 b = pNew();20 21 ; // inits order for homog case22 23 24 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b25 26 // MAIN LOOP:27 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering28 register long d;29 d = pGetComp(a2) - pGetComp(b);30 NonZeroTestA(d, pComponentOrder, goto NotEqual);31 d = pGetOrder(b) - pGetOrder(a2);32 NonZeroTestA(d, pOrdSgn, goto NotEqual);33 _pMonComp_otEXP_nwEVEN(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;34 35 Equal: // b equals a236 assume(pComp0(b, a2) == 0);37 tb = npMultM(pGetCoeff(a1), tm);38 tc = pGetCoeff(a2);39 if (!npEqualM(tc, tb))40 {41 tc=npSubM(tc, tb);42 ;43 pSetCoeff0(a2,tc); // adjust coeff of a244 a = pNext(a) = a2; // append a2 to result and advance a245 pIter(a2);46 }47 else48 { // coeffs are equal, so their difference is 0:49 c = a2; // do not append anything to result: Delete a2 and advance50 pIter(a2);51 ;52 pFree1(c);53 }54 ;55 pIter(a1);56 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?57 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom58 goto Top;59 60 NotEqual: // b != a261 if (d < 0) // b < a2:62 {63 assume(pComp0(b, a2) == -1);64 a = pNext(a) = a2;// append a2 to result and advance a265 pIter(a2);66 if (a2==NULL) goto Finish;;67 goto Top;68 }69 else // now d >= 0, i.e., b > a270 {71 assume(pComp0(b, a2) == 1);72 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));73 a = pNext(a) = b; // append b to result and advance a174 pIter(a1);75 if (a1 == NULL) // are we done?76 {77 b = pNew();78 goto Finish;79 }80 b = pNew();81 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom82 goto Top;83 }84 85 Finish: // a1 or a2 is NULL: Clean-up time86 assume(a1 == NULL || a2 == NULL);87 if (a1 == NULL) // append rest of a2 to result88 pNext(a) = a2;89 else // append (- a1*monom) to result90 spMultCopyX(a1, monom, a, tneg, spNoether);91 ;92 if (b != NULL) pFree1(b);93 }94 static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwODD95 (poly a1, poly a2, poly monom, poly spNoether)96 {97 poly a = monom, // collects the result98 b = NULL, // stores a1*monom99 c; // used for temporary storage100 number tm = pGetCoeff(monom), // coefficient of monom101 tneg = npNegM(tm), // - (coefficient of monom)102 tb, // used for tm*coeff(a1)103 tc; // used for intermediate coeff104 105 Order_t order; // used for homog case106 107 if (a2==NULL) goto Finish; // we are done if a2 is 0108 b = pNew();109 110 ; // inits order for homog case111 112 113 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b114 115 // MAIN LOOP:116 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering117 register long d;118 d = pGetComp(a2) - pGetComp(b);119 NonZeroTestA(d, pComponentOrder, goto NotEqual);120 d = pGetOrder(b) - pGetOrder(a2);121 NonZeroTestA(d, pOrdSgn, goto NotEqual);122 _pMonComp_otEXP_nwODD(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;123 124 Equal: // b equals a2125 assume(pComp0(b, a2) == 0);126 tb = npMultM(pGetCoeff(a1), tm);127 tc = pGetCoeff(a2);128 if (!npEqualM(tc, tb))129 {130 tc=npSubM(tc, tb);131 ;132 pSetCoeff0(a2,tc); // adjust coeff of a2133 a = pNext(a) = a2; // append a2 to result and advance a2134 pIter(a2);135 }136 else137 { // coeffs are equal, so their difference is 0:138 c = a2; // do not append anything to result: Delete a2 and advance139 pIter(a2);140 ;141 pFree1(c);142 }143 ;144 pIter(a1);145 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?146 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom147 goto Top;148 149 NotEqual: // b != a2150 if (d < 0) // b < a2:151 {152 assume(pComp0(b, a2) == -1);153 a = pNext(a) = a2;// append a2 to result and advance a2154 pIter(a2);155 if (a2==NULL) goto Finish;;156 goto Top;157 }158 else // now d >= 0, i.e., b > a2159 {160 assume(pComp0(b, a2) == 1);161 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));162 a = pNext(a) = b; // append b to result and advance a1163 pIter(a1);164 if (a1 == NULL) // are we done?165 {166 b = pNew();167 goto Finish;168 }169 b = pNew();170 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom171 goto Top;172 }173 174 Finish: // a1 or a2 is NULL: Clean-up time175 assume(a1 == NULL || a2 == NULL);176 if (a1 == NULL) // append rest of a2 to result177 pNext(a) = a2;178 else // append (- a1*monom) to result179 spMultCopyX(a1, monom, a, tneg, spNoether);180 ;181 if (b != NULL) pFree1(b);182 }183 static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwONE184 (poly a1, poly a2, poly monom, poly spNoether)185 {186 poly a = monom, // collects the result187 b = NULL, // stores a1*monom188 c; // used for temporary storage189 number tm = pGetCoeff(monom), // coefficient of monom190 tneg = npNegM(tm), // - (coefficient of monom)191 tb, // used for tm*coeff(a1)192 tc; // used for intermediate coeff193 194 Order_t order; // used for homog case195 196 if (a2==NULL) goto Finish; // we are done if a2 is 0197 b = pNew();198 199 ; // inits order for homog case200 201 202 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b203 204 // MAIN LOOP:205 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering206 register long d;207 d = pGetComp(a2) - pGetComp(b);208 NonZeroTestA(d, pComponentOrder, goto NotEqual);209 d = pGetOrder(b) - pGetOrder(a2);210 NonZeroTestA(d, pOrdSgn, goto NotEqual);211 _pMonComp_otEXP_nwONE(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;212 213 Equal: // b equals a2214 assume(pComp0(b, a2) == 0);215 tb = npMultM(pGetCoeff(a1), tm);216 tc = pGetCoeff(a2);217 if (!npEqualM(tc, tb))218 {219 tc=npSubM(tc, tb);220 ;221 pSetCoeff0(a2,tc); // adjust coeff of a2222 a = pNext(a) = a2; // append a2 to result and advance a2223 pIter(a2);224 }225 else226 { // coeffs are equal, so their difference is 0:227 c = a2; // do not append anything to result: Delete a2 and advance228 pIter(a2);229 ;230 pFree1(c);231 }232 ;233 pIter(a1);234 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?235 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom236 goto Top;237 238 NotEqual: // b != a2239 if (d < 0) // b < a2:240 {241 assume(pComp0(b, a2) == -1);242 a = pNext(a) = a2;// append a2 to result and advance a2243 pIter(a2);244 if (a2==NULL) goto Finish;;245 goto Top;246 }247 else // now d >= 0, i.e., b > a2248 {249 assume(pComp0(b, a2) == 1);250 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));251 a = pNext(a) = b; // append b to result and advance a1252 pIter(a1);253 if (a1 == NULL) // are we done?254 {255 b = pNew();256 goto Finish;257 }258 b = pNew();259 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom260 goto Top;261 }262 263 Finish: // a1 or a2 is NULL: Clean-up time264 assume(a1 == NULL || a2 == NULL);265 if (a1 == NULL) // append rest of a2 to result266 pNext(a) = a2;267 else // append (- a1*monom) to result268 spMultCopyX(a1, monom, a, tneg, spNoether);269 ;270 if (b != NULL) pFree1(b);271 }272 static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwTWO273 (poly a1, poly a2, poly monom, poly spNoether)274 {275 poly a = monom, // collects the result276 b = NULL, // stores a1*monom277 c; // used for temporary storage278 number tm = pGetCoeff(monom), // coefficient of monom279 tneg = npNegM(tm), // - (coefficient of monom)280 tb, // used for tm*coeff(a1)281 tc; // used for intermediate coeff282 283 Order_t order; // used for homog case284 285 if (a2==NULL) goto Finish; // we are done if a2 is 0286 b = pNew();287 288 ; // inits order for homog case289 290 291 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b292 293 // MAIN LOOP:294 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering295 register long d;296 d = pGetComp(a2) - pGetComp(b);297 NonZeroTestA(d, pComponentOrder, goto NotEqual);298 d = pGetOrder(b) - pGetOrder(a2);299 NonZeroTestA(d, pOrdSgn, goto NotEqual);300 _pMonComp_otEXP_nwTWO(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;301 302 Equal: // b equals a2303 assume(pComp0(b, a2) == 0);304 tb = npMultM(pGetCoeff(a1), tm);305 tc = pGetCoeff(a2);306 if (!npEqualM(tc, tb))307 {308 tc=npSubM(tc, tb);309 ;310 pSetCoeff0(a2,tc); // adjust coeff of a2311 a = pNext(a) = a2; // append a2 to result and advance a2312 pIter(a2);313 }314 else315 { // coeffs are equal, so their difference is 0:316 c = a2; // do not append anything to result: Delete a2 and advance317 pIter(a2);318 ;319 pFree1(c);320 }321 ;322 pIter(a1);323 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?324 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom325 goto Top;326 327 NotEqual: // b != a2328 if (d < 0) // b < a2:329 {330 assume(pComp0(b, a2) == -1);331 a = pNext(a) = a2;// append a2 to result and advance a2332 pIter(a2);333 if (a2==NULL) goto Finish;;334 goto Top;335 }336 else // now d >= 0, i.e., b > a2337 {338 assume(pComp0(b, a2) == 1);339 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));340 a = pNext(a) = b; // append b to result and advance a1341 pIter(a1);342 if (a1 == NULL) // are we done?343 {344 b = pNew();345 goto Finish;346 }347 b = pNew();348 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom349 goto Top;350 }351 352 Finish: // a1 or a2 is NULL: Clean-up time353 assume(a1 == NULL || a2 == NULL);354 if (a1 == NULL) // append rest of a2 to result355 pNext(a) = a2;356 else // append (- a1*monom) to result357 spMultCopyX(a1, monom, a, tneg, spNoether);358 ;359 if (b != NULL) pFree1(b);360 }361 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwEVEN362 (poly a1, poly a2, poly monom, poly spNoether)363 {364 poly a = monom, // collects the result365 b = NULL, // stores a1*monom366 c; // used for temporary storage367 number tm = pGetCoeff(monom), // coefficient of monom368 tneg = npNegM(tm), // - (coefficient of monom)369 tb, // used for tm*coeff(a1)370 tc; // used for intermediate coeff371 372 Order_t order; // used for homog case373 374 if (a2==NULL) goto Finish; // we are done if a2 is 0375 b = pNew();376 377 order = pGetOrder(a2); // inits order for homog case378 379 380 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b381 382 // MAIN LOOP:383 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering384 register long d;385 d = pGetComp(a2) - pGetComp(b);386 NonZeroTestA(d, pComponentOrder, goto NotEqual);387 _pMonComp_otEXP_nwEVEN(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;388 389 Equal: // b equals a2390 assume(pComp0(b, a2) == 0);391 tb = npMultM(pGetCoeff(a1), tm);392 tc = pGetCoeff(a2);393 if (!npEqualM(tc, tb))394 {395 tc=npSubM(tc, tb);396 ;397 pSetCoeff0(a2,tc); // adjust coeff of a2398 a = pNext(a) = a2; // append a2 to result and advance a2399 pIter(a2);400 }401 else402 { // coeffs are equal, so their difference is 0:403 c = a2; // do not append anything to result: Delete a2 and advance404 pIter(a2);405 ;406 pFree1(c);407 }408 ;409 pIter(a1);410 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?411 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom412 goto Top;413 414 NotEqual: // b != a2415 if (d < 0) // b < a2:416 {417 assume(pComp0(b, a2) == -1);418 a = pNext(a) = a2;// append a2 to result and advance a2419 pIter(a2);420 if (a2==NULL) goto Finish;;421 goto Top;422 }423 else // now d >= 0, i.e., b > a2424 {425 assume(pComp0(b, a2) == 1);426 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));427 a = pNext(a) = b; // append b to result and advance a1428 pIter(a1);429 if (a1 == NULL) // are we done?430 {431 b = pNew();432 goto Finish;433 }434 b = pNew();435 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom436 goto Top;437 }438 439 Finish: // a1 or a2 is NULL: Clean-up time440 assume(a1 == NULL || a2 == NULL);441 if (a1 == NULL) // append rest of a2 to result442 pNext(a) = a2;443 else // append (- a1*monom) to result444 spMultCopyX(a1, monom, a, tneg, spNoether);445 ;446 if (b != NULL) pFree1(b);447 }448 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwODD449 (poly a1, poly a2, poly monom, poly spNoether)450 {451 poly a = monom, // collects the result452 b = NULL, // stores a1*monom453 c; // used for temporary storage454 number tm = pGetCoeff(monom), // coefficient of monom455 tneg = npNegM(tm), // - (coefficient of monom)456 tb, // used for tm*coeff(a1)457 tc; // used for intermediate coeff458 459 Order_t order; // used for homog case460 461 if (a2==NULL) goto Finish; // we are done if a2 is 0462 b = pNew();463 464 order = pGetOrder(a2); // inits order for homog case465 466 467 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b468 469 // MAIN LOOP:470 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering471 register long d;472 d = pGetComp(a2) - pGetComp(b);473 NonZeroTestA(d, pComponentOrder, goto NotEqual);474 _pMonComp_otEXP_nwODD(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;475 476 Equal: // b equals a2477 assume(pComp0(b, a2) == 0);478 tb = npMultM(pGetCoeff(a1), tm);479 tc = pGetCoeff(a2);480 if (!npEqualM(tc, tb))481 {482 tc=npSubM(tc, tb);483 ;484 pSetCoeff0(a2,tc); // adjust coeff of a2485 a = pNext(a) = a2; // append a2 to result and advance a2486 pIter(a2);487 }488 else489 { // coeffs are equal, so their difference is 0:490 c = a2; // do not append anything to result: Delete a2 and advance491 pIter(a2);492 ;493 pFree1(c);494 }495 ;496 pIter(a1);497 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?498 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom499 goto Top;500 501 NotEqual: // b != a2502 if (d < 0) // b < a2:503 {504 assume(pComp0(b, a2) == -1);505 a = pNext(a) = a2;// append a2 to result and advance a2506 pIter(a2);507 if (a2==NULL) goto Finish;;508 goto Top;509 }510 else // now d >= 0, i.e., b > a2511 {512 assume(pComp0(b, a2) == 1);513 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));514 a = pNext(a) = b; // append b to result and advance a1515 pIter(a1);516 if (a1 == NULL) // are we done?517 {518 b = pNew();519 goto Finish;520 }521 b = pNew();522 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom523 goto Top;524 }525 526 Finish: // a1 or a2 is NULL: Clean-up time527 assume(a1 == NULL || a2 == NULL);528 if (a1 == NULL) // append rest of a2 to result529 pNext(a) = a2;530 else // append (- a1*monom) to result531 spMultCopyX(a1, monom, a, tneg, spNoether);532 ;533 if (b != NULL) pFree1(b);534 }535 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwONE536 (poly a1, poly a2, poly monom, poly spNoether)537 {538 poly a = monom, // collects the result539 b = NULL, // stores a1*monom540 c; // used for temporary storage541 number tm = pGetCoeff(monom), // coefficient of monom542 tneg = npNegM(tm), // - (coefficient of monom)543 tb, // used for tm*coeff(a1)544 tc; // used for intermediate coeff545 546 Order_t order; // used for homog case547 548 if (a2==NULL) goto Finish; // we are done if a2 is 0549 b = pNew();550 551 order = pGetOrder(a2); // inits order for homog case552 553 554 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b555 556 // MAIN LOOP:557 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering558 register long d;559 d = pGetComp(a2) - pGetComp(b);560 NonZeroTestA(d, pComponentOrder, goto NotEqual);561 _pMonComp_otEXP_nwONE(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;562 563 Equal: // b equals a2564 assume(pComp0(b, a2) == 0);565 tb = npMultM(pGetCoeff(a1), tm);566 tc = pGetCoeff(a2);567 if (!npEqualM(tc, tb))568 {569 tc=npSubM(tc, tb);570 ;571 pSetCoeff0(a2,tc); // adjust coeff of a2572 a = pNext(a) = a2; // append a2 to result and advance a2573 pIter(a2);574 }575 else576 { // coeffs are equal, so their difference is 0:577 c = a2; // do not append anything to result: Delete a2 and advance578 pIter(a2);579 ;580 pFree1(c);581 }582 ;583 pIter(a1);584 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?585 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom586 goto Top;587 588 NotEqual: // b != a2589 if (d < 0) // b < a2:590 {591 assume(pComp0(b, a2) == -1);592 a = pNext(a) = a2;// append a2 to result and advance a2593 pIter(a2);594 if (a2==NULL) goto Finish;;595 goto Top;596 }597 else // now d >= 0, i.e., b > a2598 {599 assume(pComp0(b, a2) == 1);600 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));601 a = pNext(a) = b; // append b to result and advance a1602 pIter(a1);603 if (a1 == NULL) // are we done?604 {605 b = pNew();606 goto Finish;607 }608 b = pNew();609 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom610 goto Top;611 }612 613 Finish: // a1 or a2 is NULL: Clean-up time614 assume(a1 == NULL || a2 == NULL);615 if (a1 == NULL) // append rest of a2 to result616 pNext(a) = a2;617 else // append (- a1*monom) to result618 spMultCopyX(a1, monom, a, tneg, spNoether);619 ;620 if (b != NULL) pFree1(b);621 }622 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwTWO623 (poly a1, poly a2, poly monom, poly spNoether)624 {625 poly a = monom, // collects the result626 b = NULL, // stores a1*monom627 c; // used for temporary storage628 number tm = pGetCoeff(monom), // coefficient of monom629 tneg = npNegM(tm), // - (coefficient of monom)630 tb, // used for tm*coeff(a1)631 tc; // used for intermediate coeff632 633 Order_t order; // used for homog case634 635 if (a2==NULL) goto Finish; // we are done if a2 is 0636 b = pNew();637 638 order = pGetOrder(a2); // inits order for homog case639 640 641 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b642 643 // MAIN LOOP:644 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering645 register long d;646 d = pGetComp(a2) - pGetComp(b);647 NonZeroTestA(d, pComponentOrder, goto NotEqual);648 _pMonComp_otEXP_nwTWO(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;649 650 Equal: // b equals a2651 assume(pComp0(b, a2) == 0);652 tb = npMultM(pGetCoeff(a1), tm);653 tc = pGetCoeff(a2);654 if (!npEqualM(tc, tb))655 {656 tc=npSubM(tc, tb);657 ;658 pSetCoeff0(a2,tc); // adjust coeff of a2659 a = pNext(a) = a2; // append a2 to result and advance a2660 pIter(a2);661 }662 else663 { // coeffs are equal, so their difference is 0:664 c = a2; // do not append anything to result: Delete a2 and advance665 pIter(a2);666 ;667 pFree1(c);668 }669 ;670 pIter(a1);671 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?672 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom673 goto Top;674 675 NotEqual: // b != a2676 if (d < 0) // b < a2:677 {678 assume(pComp0(b, a2) == -1);679 a = pNext(a) = a2;// append a2 to result and advance a2680 pIter(a2);681 if (a2==NULL) goto Finish;;682 goto Top;683 }684 else // now d >= 0, i.e., b > a2685 {686 assume(pComp0(b, a2) == 1);687 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));688 a = pNext(a) = b; // append b to result and advance a1689 pIter(a1);690 if (a1 == NULL) // are we done?691 {692 b = pNew();693 goto Finish;694 }695 b = pNew();696 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom697 goto Top;698 }699 700 Finish: // a1 or a2 is NULL: Clean-up time701 assume(a1 == NULL || a2 == NULL);702 if (a1 == NULL) // append rest of a2 to result703 pNext(a) = a2;704 else // append (- a1*monom) to result705 spMultCopyX(a1, monom, a, tneg, spNoether);706 ;707 if (b != NULL) pFree1(b);708 }709 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwEVEN710 (poly a1, poly a2, poly monom, poly spNoether)711 {712 poly a = monom, // collects the result713 b = NULL, // stores a1*monom714 c; // used for temporary storage715 number tm = pGetCoeff(monom), // coefficient of monom716 tneg = npNegM(tm), // - (coefficient of monom)717 tb, // used for tm*coeff(a1)718 tc; // used for intermediate coeff719 720 Order_t order; // used for homog case721 722 if (a2==NULL) goto Finish; // we are done if a2 is 0723 b = pNew();724 725 ; // inits order for homog case726 727 728 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b729 730 // MAIN LOOP:731 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering732 register long d;733 d = pGetOrder(b) - pGetOrder(a2);734 NonZeroTestA(d, pOrdSgn, goto NotEqual);735 _pMonComp_otEXPCOMP_nwEVEN(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;736 737 Equal: // b equals a2738 assume(pComp0(b, a2) == 0);739 tb = npMultM(pGetCoeff(a1), tm);740 tc = pGetCoeff(a2);741 if (!npEqualM(tc, tb))742 {743 tc=npSubM(tc, tb);744 ;745 pSetCoeff0(a2,tc); // adjust coeff of a2746 a = pNext(a) = a2; // append a2 to result and advance a2747 pIter(a2);748 }749 else750 { // coeffs are equal, so their difference is 0:751 c = a2; // do not append anything to result: Delete a2 and advance752 pIter(a2);753 ;754 pFree1(c);755 }756 ;757 pIter(a1);758 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?759 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom760 goto Top;761 762 NotEqual: // b != a2763 if (d < 0) // b < a2:764 {765 assume(pComp0(b, a2) == -1);766 a = pNext(a) = a2;// append a2 to result and advance a2767 pIter(a2);768 if (a2==NULL) goto Finish;;769 goto Top;770 }771 else // now d >= 0, i.e., b > a2772 {773 assume(pComp0(b, a2) == 1);774 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));775 a = pNext(a) = b; // append b to result and advance a1776 pIter(a1);777 if (a1 == NULL) // are we done?778 {779 b = pNew();780 goto Finish;781 }782 b = pNew();783 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom784 goto Top;785 }786 787 Finish: // a1 or a2 is NULL: Clean-up time788 assume(a1 == NULL || a2 == NULL);789 if (a1 == NULL) // append rest of a2 to result790 pNext(a) = a2;791 else // append (- a1*monom) to result792 spMultCopyX(a1, monom, a, tneg, spNoether);793 ;794 if (b != NULL) pFree1(b);795 }796 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwODD797 (poly a1, poly a2, poly monom, poly spNoether)798 {799 poly a = monom, // collects the result800 b = NULL, // stores a1*monom801 c; // used for temporary storage802 number tm = pGetCoeff(monom), // coefficient of monom803 tneg = npNegM(tm), // - (coefficient of monom)804 tb, // used for tm*coeff(a1)805 tc; // used for intermediate coeff806 807 Order_t order; // used for homog case808 809 if (a2==NULL) goto Finish; // we are done if a2 is 0810 b = pNew();811 812 ; // inits order for homog case813 814 815 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b816 817 // MAIN LOOP:818 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering819 register long d;820 d = pGetOrder(b) - pGetOrder(a2);821 NonZeroTestA(d, pOrdSgn, goto NotEqual);822 _pMonComp_otEXPCOMP_nwODD(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;823 824 Equal: // b equals a2825 assume(pComp0(b, a2) == 0);826 tb = npMultM(pGetCoeff(a1), tm);827 tc = pGetCoeff(a2);828 if (!npEqualM(tc, tb))829 {830 tc=npSubM(tc, tb);831 ;832 pSetCoeff0(a2,tc); // adjust coeff of a2833 a = pNext(a) = a2; // append a2 to result and advance a2834 pIter(a2);835 }836 else837 { // coeffs are equal, so their difference is 0:838 c = a2; // do not append anything to result: Delete a2 and advance839 pIter(a2);840 ;841 pFree1(c);842 }843 ;844 pIter(a1);845 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?846 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom847 goto Top;848 849 NotEqual: // b != a2850 if (d < 0) // b < a2:851 {852 assume(pComp0(b, a2) == -1);853 a = pNext(a) = a2;// append a2 to result and advance a2854 pIter(a2);855 if (a2==NULL) goto Finish;;856 goto Top;857 }858 else // now d >= 0, i.e., b > a2859 {860 assume(pComp0(b, a2) == 1);861 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));862 a = pNext(a) = b; // append b to result and advance a1863 pIter(a1);864 if (a1 == NULL) // are we done?865 {866 b = pNew();867 goto Finish;868 }869 b = pNew();870 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom871 goto Top;872 }873 874 Finish: // a1 or a2 is NULL: Clean-up time875 assume(a1 == NULL || a2 == NULL);876 if (a1 == NULL) // append rest of a2 to result877 pNext(a) = a2;878 else // append (- a1*monom) to result879 spMultCopyX(a1, monom, a, tneg, spNoether);880 ;881 if (b != NULL) pFree1(b);882 }883 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwONE884 (poly a1, poly a2, poly monom, poly spNoether)885 {886 poly a = monom, // collects the result887 b = NULL, // stores a1*monom888 c; // used for temporary storage889 number tm = pGetCoeff(monom), // coefficient of monom890 tneg = npNegM(tm), // - (coefficient of monom)891 tb, // used for tm*coeff(a1)892 tc; // used for intermediate coeff893 894 Order_t order; // used for homog case895 896 if (a2==NULL) goto Finish; // we are done if a2 is 0897 b = pNew();898 899 ; // inits order for homog case900 901 902 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b903 904 // MAIN LOOP:905 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering906 register long d;907 d = pGetOrder(b) - pGetOrder(a2);908 NonZeroTestA(d, pOrdSgn, goto NotEqual);909 _pMonComp_otEXPCOMP_nwONE(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;910 911 Equal: // b equals a2912 assume(pComp0(b, a2) == 0);913 tb = npMultM(pGetCoeff(a1), tm);914 tc = pGetCoeff(a2);915 if (!npEqualM(tc, tb))916 {917 tc=npSubM(tc, tb);918 ;919 pSetCoeff0(a2,tc); // adjust coeff of a2920 a = pNext(a) = a2; // append a2 to result and advance a2921 pIter(a2);922 }923 else924 { // coeffs are equal, so their difference is 0:925 c = a2; // do not append anything to result: Delete a2 and advance926 pIter(a2);927 ;928 pFree1(c);929 }930 ;931 pIter(a1);932 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?933 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom934 goto Top;935 936 NotEqual: // b != a2937 if (d < 0) // b < a2:938 {939 assume(pComp0(b, a2) == -1);940 a = pNext(a) = a2;// append a2 to result and advance a2941 pIter(a2);942 if (a2==NULL) goto Finish;;943 goto Top;944 }945 else // now d >= 0, i.e., b > a2946 {947 assume(pComp0(b, a2) == 1);948 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));949 a = pNext(a) = b; // append b to result and advance a1950 pIter(a1);951 if (a1 == NULL) // are we done?952 {953 b = pNew();954 goto Finish;955 }956 b = pNew();957 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom958 goto Top;959 }960 961 Finish: // a1 or a2 is NULL: Clean-up time962 assume(a1 == NULL || a2 == NULL);963 if (a1 == NULL) // append rest of a2 to result964 pNext(a) = a2;965 else // append (- a1*monom) to result966 spMultCopyX(a1, monom, a, tneg, spNoether);967 ;968 if (b != NULL) pFree1(b);969 }970 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwTWO971 (poly a1, poly a2, poly monom, poly spNoether)972 {973 poly a = monom, // collects the result974 b = NULL, // stores a1*monom975 c; // used for temporary storage976 number tm = pGetCoeff(monom), // coefficient of monom977 tneg = npNegM(tm), // - (coefficient of monom)978 tb, // used for tm*coeff(a1)979 tc; // used for intermediate coeff980 981 Order_t order; // used for homog case982 983 if (a2==NULL) goto Finish; // we are done if a2 is 0984 b = pNew();985 986 ; // inits order for homog case987 988 989 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b990 991 // MAIN LOOP:992 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering993 register long d;994 d = pGetOrder(b) - pGetOrder(a2);995 NonZeroTestA(d, pOrdSgn, goto NotEqual);996 _pMonComp_otEXPCOMP_nwTWO(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;997 998 Equal: // b equals a2999 assume(pComp0(b, a2) == 0);1000 tb = npMultM(pGetCoeff(a1), tm);1001 tc = pGetCoeff(a2);1002 if (!npEqualM(tc, tb))1003 {1004 tc=npSubM(tc, tb);1005 ;1006 pSetCoeff0(a2,tc); // adjust coeff of a21007 a = pNext(a) = a2; // append a2 to result and advance a21008 pIter(a2);1009 }1010 else1011 { // coeffs are equal, so their difference is 0:1012 c = a2; // do not append anything to result: Delete a2 and advance1013 pIter(a2);1014 ;1015 pFree1(c);1016 }1017 ;1018 pIter(a1);1019 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1020 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom1021 goto Top;1022 1023 NotEqual: // b != a21024 if (d < 0) // b < a2:1025 {1026 assume(pComp0(b, a2) == -1);1027 a = pNext(a) = a2;// append a2 to result and advance a21028 pIter(a2);1029 if (a2==NULL) goto Finish;;1030 goto Top;1031 }1032 else // now d >= 0, i.e., b > a21033 {1034 assume(pComp0(b, a2) == 1);1035 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1036 a = pNext(a) = b; // append b to result and advance a11037 pIter(a1);1038 if (a1 == NULL) // are we done?1039 {1040 b = pNew();1041 goto Finish;1042 }1043 b = pNew();1044 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom1045 goto Top;1046 }1047 1048 Finish: // a1 or a2 is NULL: Clean-up time1049 assume(a1 == NULL || a2 == NULL);1050 if (a1 == NULL) // append rest of a2 to result1051 pNext(a) = a2;1052 else // append (- a1*monom) to result1053 spMultCopyX(a1, monom, a, tneg, spNoether);1054 ;1055 if (b != NULL) pFree1(b);1056 }1057 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwEVEN1058 (poly a1, poly a2, poly monom, poly spNoether)1059 {1060 poly a = monom, // collects the result1061 b = NULL, // stores a1*monom1062 c; // used for temporary storage1063 number tm = pGetCoeff(monom), // coefficient of monom1064 tneg = npNegM(tm), // - (coefficient of monom)1065 tb, // used for tm*coeff(a1)1066 tc; // used for intermediate coeff1067 1068 Order_t order; // used for homog case1069 1070 if (a2==NULL) goto Finish; // we are done if a2 is 01071 b = pNew();1072 1073 order = pGetOrder(a2); // inits order for homog case1074 1075 1076 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b1077 1078 // MAIN LOOP:1079 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1080 register long d;1081 _pMonComp_otEXPCOMP_nwEVEN(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1082 1083 Equal: // b equals a21084 assume(pComp0(b, a2) == 0);1085 tb = npMultM(pGetCoeff(a1), tm);1086 tc = pGetCoeff(a2);1087 if (!npEqualM(tc, tb))1088 {1089 tc=npSubM(tc, tb);1090 ;1091 pSetCoeff0(a2,tc); // adjust coeff of a21092 a = pNext(a) = a2; // append a2 to result and advance a21093 pIter(a2);1094 }1095 else1096 { // coeffs are equal, so their difference is 0:1097 c = a2; // do not append anything to result: Delete a2 and advance1098 pIter(a2);1099 ;1100 pFree1(c);1101 }1102 ;1103 pIter(a1);1104 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1105 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom1106 goto Top;1107 1108 NotEqual: // b != a21109 if (d < 0) // b < a2:1110 {1111 assume(pComp0(b, a2) == -1);1112 a = pNext(a) = a2;// append a2 to result and advance a21113 pIter(a2);1114 if (a2==NULL) goto Finish;;1115 goto Top;1116 }1117 else // now d >= 0, i.e., b > a21118 {1119 assume(pComp0(b, a2) == 1);1120 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1121 a = pNext(a) = b; // append b to result and advance a11122 pIter(a1);1123 if (a1 == NULL) // are we done?1124 {1125 b = pNew();1126 goto Finish;1127 }1128 b = pNew();1129 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom1130 goto Top;1131 }1132 1133 Finish: // a1 or a2 is NULL: Clean-up time1134 assume(a1 == NULL || a2 == NULL);1135 if (a1 == NULL) // append rest of a2 to result1136 pNext(a) = a2;1137 else // append (- a1*monom) to result1138 spMultCopyX(a1, monom, a, tneg, spNoether);1139 ;1140 if (b != NULL) pFree1(b);1141 }1142 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwODD1143 (poly a1, poly a2, poly monom, poly spNoether)1144 {1145 poly a = monom, // collects the result1146 b = NULL, // stores a1*monom1147 c; // used for temporary storage1148 number tm = pGetCoeff(monom), // coefficient of monom1149 tneg = npNegM(tm), // - (coefficient of monom)1150 tb, // used for tm*coeff(a1)1151 tc; // used for intermediate coeff1152 1153 Order_t order; // used for homog case1154 1155 if (a2==NULL) goto Finish; // we are done if a2 is 01156 b = pNew();1157 1158 order = pGetOrder(a2); // inits order for homog case1159 1160 1161 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b1162 1163 // MAIN LOOP:1164 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1165 register long d;1166 _pMonComp_otEXPCOMP_nwODD(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1167 1168 Equal: // b equals a21169 assume(pComp0(b, a2) == 0);1170 tb = npMultM(pGetCoeff(a1), tm);1171 tc = pGetCoeff(a2);1172 if (!npEqualM(tc, tb))1173 {1174 tc=npSubM(tc, tb);1175 ;1176 pSetCoeff0(a2,tc); // adjust coeff of a21177 a = pNext(a) = a2; // append a2 to result and advance a21178 pIter(a2);1179 }1180 else1181 { // coeffs are equal, so their difference is 0:1182 c = a2; // do not append anything to result: Delete a2 and advance1183 pIter(a2);1184 ;1185 pFree1(c);1186 }1187 ;1188 pIter(a1);1189 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1190 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom1191 goto Top;1192 1193 NotEqual: // b != a21194 if (d < 0) // b < a2:1195 {1196 assume(pComp0(b, a2) == -1);1197 a = pNext(a) = a2;// append a2 to result and advance a21198 pIter(a2);1199 if (a2==NULL) goto Finish;;1200 goto Top;1201 }1202 else // now d >= 0, i.e., b > a21203 {1204 assume(pComp0(b, a2) == 1);1205 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1206 a = pNext(a) = b; // append b to result and advance a11207 pIter(a1);1208 if (a1 == NULL) // are we done?1209 {1210 b = pNew();1211 goto Finish;1212 }1213 b = pNew();1214 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom1215 goto Top;1216 }1217 1218 Finish: // a1 or a2 is NULL: Clean-up time1219 assume(a1 == NULL || a2 == NULL);1220 if (a1 == NULL) // append rest of a2 to result1221 pNext(a) = a2;1222 else // append (- a1*monom) to result1223 spMultCopyX(a1, monom, a, tneg, spNoether);1224 ;1225 if (b != NULL) pFree1(b);1226 }1227 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwONE1228 (poly a1, poly a2, poly monom, poly spNoether)1229 {1230 poly a = monom, // collects the result1231 b = NULL, // stores a1*monom1232 c; // used for temporary storage1233 number tm = pGetCoeff(monom), // coefficient of monom1234 tneg = npNegM(tm), // - (coefficient of monom)1235 tb, // used for tm*coeff(a1)1236 tc; // used for intermediate coeff1237 1238 Order_t order; // used for homog case1239 1240 if (a2==NULL) goto Finish; // we are done if a2 is 01241 b = pNew();1242 1243 order = pGetOrder(a2); // inits order for homog case1244 1245 1246 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b1247 1248 // MAIN LOOP:1249 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1250 register long d;1251 _pMonComp_otEXPCOMP_nwONE(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1252 1253 Equal: // b equals a21254 assume(pComp0(b, a2) == 0);1255 tb = npMultM(pGetCoeff(a1), tm);1256 tc = pGetCoeff(a2);1257 if (!npEqualM(tc, tb))1258 {1259 tc=npSubM(tc, tb);1260 ;1261 pSetCoeff0(a2,tc); // adjust coeff of a21262 a = pNext(a) = a2; // append a2 to result and advance a21263 pIter(a2);1264 }1265 else1266 { // coeffs are equal, so their difference is 0:1267 c = a2; // do not append anything to result: Delete a2 and advance1268 pIter(a2);1269 ;1270 pFree1(c);1271 }1272 ;1273 pIter(a1);1274 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1275 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom1276 goto Top;1277 1278 NotEqual: // b != a21279 if (d < 0) // b < a2:1280 {1281 assume(pComp0(b, a2) == -1);1282 a = pNext(a) = a2;// append a2 to result and advance a21283 pIter(a2);1284 if (a2==NULL) goto Finish;;1285 goto Top;1286 }1287 else // now d >= 0, i.e., b > a21288 {1289 assume(pComp0(b, a2) == 1);1290 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1291 a = pNext(a) = b; // append b to result and advance a11292 pIter(a1);1293 if (a1 == NULL) // are we done?1294 {1295 b = pNew();1296 goto Finish;1297 }1298 b = pNew();1299 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom1300 goto Top;1301 }1302 1303 Finish: // a1 or a2 is NULL: Clean-up time1304 assume(a1 == NULL || a2 == NULL);1305 if (a1 == NULL) // append rest of a2 to result1306 pNext(a) = a2;1307 else // append (- a1*monom) to result1308 spMultCopyX(a1, monom, a, tneg, spNoether);1309 ;1310 if (b != NULL) pFree1(b);1311 }1312 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwTWO1313 (poly a1, poly a2, poly monom, poly spNoether)1314 {1315 poly a = monom, // collects the result1316 b = NULL, // stores a1*monom1317 c; // used for temporary storage1318 number tm = pGetCoeff(monom), // coefficient of monom1319 tneg = npNegM(tm), // - (coefficient of monom)1320 tb, // used for tm*coeff(a1)1321 tc; // used for intermediate coeff1322 1323 Order_t order; // used for homog case1324 1325 if (a2==NULL) goto Finish; // we are done if a2 is 01326 b = pNew();1327 1328 order = pGetOrder(a2); // inits order for homog case1329 1330 1331 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b1332 1333 // MAIN LOOP:1334 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1335 register long d;1336 _pMonComp_otEXPCOMP_nwTWO(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1337 1338 Equal: // b equals a21339 assume(pComp0(b, a2) == 0);1340 tb = npMultM(pGetCoeff(a1), tm);1341 tc = pGetCoeff(a2);1342 if (!npEqualM(tc, tb))1343 {1344 tc=npSubM(tc, tb);1345 ;1346 pSetCoeff0(a2,tc); // adjust coeff of a21347 a = pNext(a) = a2; // append a2 to result and advance a21348 pIter(a2);1349 }1350 else1351 { // coeffs are equal, so their difference is 0:1352 c = a2; // do not append anything to result: Delete a2 and advance1353 pIter(a2);1354 ;1355 pFree1(c);1356 }1357 ;1358 pIter(a1);1359 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1360 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom1361 goto Top;1362 1363 NotEqual: // b != a21364 if (d < 0) // b < a2:1365 {1366 assume(pComp0(b, a2) == -1);1367 a = pNext(a) = a2;// append a2 to result and advance a21368 pIter(a2);1369 if (a2==NULL) goto Finish;;1370 goto Top;1371 }1372 else // now d >= 0, i.e., b > a21373 {1374 assume(pComp0(b, a2) == 1);1375 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1376 a = pNext(a) = b; // append b to result and advance a11377 pIter(a1);1378 if (a1 == NULL) // are we done?1379 {1380 b = pNew();1381 goto Finish;1382 }1383 b = pNew();1384 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom1385 goto Top;1386 }1387 1388 Finish: // a1 or a2 is NULL: Clean-up time1389 assume(a1 == NULL || a2 == NULL);1390 if (a1 == NULL) // append rest of a2 to result1391 pNext(a) = a2;1392 else // append (- a1*monom) to result1393 spMultCopyX(a1, monom, a, tneg, spNoether);1394 ;1395 if (b != NULL) pFree1(b);1396 }1397 static void spSpolyLoop_chMODP_otEXP_homGEN_nwEVEN1398 (poly a1, poly a2, poly monom, poly spNoether)1399 {1400 poly a = monom, // collects the result1401 b = NULL, // stores a1*monom1402 c; // used for temporary storage1403 number tm = pGetCoeff(monom), // coefficient of monom1404 tneg = npNegM(tm), // - (coefficient of monom)1405 tb, // used for tm*coeff(a1)1406 tc; // used for intermediate coeff1407 1408 Order_t order; // used for homog case1409 1410 if (a2==NULL) goto Finish; // we are done if a2 is 01411 b = pNew();1412 1413 ; // inits order for homog case1414 1415 1416 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b1417 1418 // MAIN LOOP:1419 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1420 register long d;1421 d = pGetOrder(b) - pGetOrder(a2);1422 NonZeroTestA(d, pOrdSgn, goto NotEqual);1423 _pMonComp_otEXP_nwEVEN(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1424 1425 Equal: // b equals a21426 assume(pComp0(b, a2) == 0);1427 tb = npMultM(pGetCoeff(a1), tm);1428 tc = pGetCoeff(a2);1429 if (!npEqualM(tc, tb))1430 {1431 tc=npSubM(tc, tb);1432 ;1433 pSetCoeff0(a2,tc); // adjust coeff of a21434 a = pNext(a) = a2; // append a2 to result and advance a21435 pIter(a2);1436 }1437 else1438 { // coeffs are equal, so their difference is 0:1439 c = a2; // do not append anything to result: Delete a2 and advance1440 pIter(a2);1441 ;1442 pFree1(c);1443 }1444 ;1445 pIter(a1);1446 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1447 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom1448 goto Top;1449 1450 NotEqual: // b != a21451 if (d < 0) // b < a2:1452 {1453 assume(pComp0(b, a2) == -1);1454 a = pNext(a) = a2;// append a2 to result and advance a21455 pIter(a2);1456 if (a2==NULL) goto Finish;;1457 goto Top;1458 }1459 else // now d >= 0, i.e., b > a21460 {1461 assume(pComp0(b, a2) == 1);1462 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1463 a = pNext(a) = b; // append b to result and advance a11464 pIter(a1);1465 if (a1 == NULL) // are we done?1466 {1467 b = pNew();1468 goto Finish;1469 }1470 b = pNew();1471 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom1472 goto Top;1473 }1474 1475 Finish: // a1 or a2 is NULL: Clean-up time1476 assume(a1 == NULL || a2 == NULL);1477 if (a1 == NULL) // append rest of a2 to result1478 pNext(a) = a2;1479 else // append (- a1*monom) to result1480 spMultCopyX(a1, monom, a, tneg, spNoether);1481 ;1482 if (b != NULL) pFree1(b);1483 }1484 static void spSpolyLoop_chMODP_otEXP_homGEN_nwODD1485 (poly a1, poly a2, poly monom, poly spNoether)1486 {1487 poly a = monom, // collects the result1488 b = NULL, // stores a1*monom1489 c; // used for temporary storage1490 number tm = pGetCoeff(monom), // coefficient of monom1491 tneg = npNegM(tm), // - (coefficient of monom)1492 tb, // used for tm*coeff(a1)1493 tc; // used for intermediate coeff1494 1495 Order_t order; // used for homog case1496 1497 if (a2==NULL) goto Finish; // we are done if a2 is 01498 b = pNew();1499 1500 ; // inits order for homog case1501 1502 1503 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b1504 1505 // MAIN LOOP:1506 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1507 register long d;1508 d = pGetOrder(b) - pGetOrder(a2);1509 NonZeroTestA(d, pOrdSgn, goto NotEqual);1510 _pMonComp_otEXP_nwODD(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1511 1512 Equal: // b equals a21513 assume(pComp0(b, a2) == 0);1514 tb = npMultM(pGetCoeff(a1), tm);1515 tc = pGetCoeff(a2);1516 if (!npEqualM(tc, tb))1517 {1518 tc=npSubM(tc, tb);1519 ;1520 pSetCoeff0(a2,tc); // adjust coeff of a21521 a = pNext(a) = a2; // append a2 to result and advance a21522 pIter(a2);1523 }1524 else1525 { // coeffs are equal, so their difference is 0:1526 c = a2; // do not append anything to result: Delete a2 and advance1527 pIter(a2);1528 ;1529 pFree1(c);1530 }1531 ;1532 pIter(a1);1533 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1534 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom1535 goto Top;1536 1537 NotEqual: // b != a21538 if (d < 0) // b < a2:1539 {1540 assume(pComp0(b, a2) == -1);1541 a = pNext(a) = a2;// append a2 to result and advance a21542 pIter(a2);1543 if (a2==NULL) goto Finish;;1544 goto Top;1545 }1546 else // now d >= 0, i.e., b > a21547 {1548 assume(pComp0(b, a2) == 1);1549 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1550 a = pNext(a) = b; // append b to result and advance a11551 pIter(a1);1552 if (a1 == NULL) // are we done?1553 {1554 b = pNew();1555 goto Finish;1556 }1557 b = pNew();1558 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom1559 goto Top;1560 }1561 1562 Finish: // a1 or a2 is NULL: Clean-up time1563 assume(a1 == NULL || a2 == NULL);1564 if (a1 == NULL) // append rest of a2 to result1565 pNext(a) = a2;1566 else // append (- a1*monom) to result1567 spMultCopyX(a1, monom, a, tneg, spNoether);1568 ;1569 if (b != NULL) pFree1(b);1570 }1571 static void spSpolyLoop_chMODP_otEXP_homGEN_nwONE1572 (poly a1, poly a2, poly monom, poly spNoether)1573 {1574 poly a = monom, // collects the result1575 b = NULL, // stores a1*monom1576 c; // used for temporary storage1577 number tm = pGetCoeff(monom), // coefficient of monom1578 tneg = npNegM(tm), // - (coefficient of monom)1579 tb, // used for tm*coeff(a1)1580 tc; // used for intermediate coeff1581 1582 Order_t order; // used for homog case1583 1584 if (a2==NULL) goto Finish; // we are done if a2 is 01585 b = pNew();1586 1587 ; // inits order for homog case1588 1589 1590 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b1591 1592 // MAIN LOOP:1593 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1594 register long d;1595 d = pGetOrder(b) - pGetOrder(a2);1596 NonZeroTestA(d, pOrdSgn, goto NotEqual);1597 _pMonComp_otEXP_nwONE(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1598 1599 Equal: // b equals a21600 assume(pComp0(b, a2) == 0);1601 tb = npMultM(pGetCoeff(a1), tm);1602 tc = pGetCoeff(a2);1603 if (!npEqualM(tc, tb))1604 {1605 tc=npSubM(tc, tb);1606 ;1607 pSetCoeff0(a2,tc); // adjust coeff of a21608 a = pNext(a) = a2; // append a2 to result and advance a21609 pIter(a2);1610 }1611 else1612 { // coeffs are equal, so their difference is 0:1613 c = a2; // do not append anything to result: Delete a2 and advance1614 pIter(a2);1615 ;1616 pFree1(c);1617 }1618 ;1619 pIter(a1);1620 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1621 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom1622 goto Top;1623 1624 NotEqual: // b != a21625 if (d < 0) // b < a2:1626 {1627 assume(pComp0(b, a2) == -1);1628 a = pNext(a) = a2;// append a2 to result and advance a21629 pIter(a2);1630 if (a2==NULL) goto Finish;;1631 goto Top;1632 }1633 else // now d >= 0, i.e., b > a21634 {1635 assume(pComp0(b, a2) == 1);1636 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1637 a = pNext(a) = b; // append b to result and advance a11638 pIter(a1);1639 if (a1 == NULL) // are we done?1640 {1641 b = pNew();1642 goto Finish;1643 }1644 b = pNew();1645 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom1646 goto Top;1647 }1648 1649 Finish: // a1 or a2 is NULL: Clean-up time1650 assume(a1 == NULL || a2 == NULL);1651 if (a1 == NULL) // append rest of a2 to result1652 pNext(a) = a2;1653 else // append (- a1*monom) to result1654 spMultCopyX(a1, monom, a, tneg, spNoether);1655 ;1656 if (b != NULL) pFree1(b);1657 }1658 static void spSpolyLoop_chMODP_otEXP_homGEN_nwTWO1659 (poly a1, poly a2, poly monom, poly spNoether)1660 {1661 poly a = monom, // collects the result1662 b = NULL, // stores a1*monom1663 c; // used for temporary storage1664 number tm = pGetCoeff(monom), // coefficient of monom1665 tneg = npNegM(tm), // - (coefficient of monom)1666 tb, // used for tm*coeff(a1)1667 tc; // used for intermediate coeff1668 1669 Order_t order; // used for homog case1670 1671 if (a2==NULL) goto Finish; // we are done if a2 is 01672 b = pNew();1673 1674 ; // inits order for homog case1675 1676 1677 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b1678 1679 // MAIN LOOP:1680 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1681 register long d;1682 d = pGetOrder(b) - pGetOrder(a2);1683 NonZeroTestA(d, pOrdSgn, goto NotEqual);1684 _pMonComp_otEXP_nwTWO(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1685 1686 Equal: // b equals a21687 assume(pComp0(b, a2) == 0);1688 tb = npMultM(pGetCoeff(a1), tm);1689 tc = pGetCoeff(a2);1690 if (!npEqualM(tc, tb))1691 {1692 tc=npSubM(tc, tb);1693 ;1694 pSetCoeff0(a2,tc); // adjust coeff of a21695 a = pNext(a) = a2; // append a2 to result and advance a21696 pIter(a2);1697 }1698 else1699 { // coeffs are equal, so their difference is 0:1700 c = a2; // do not append anything to result: Delete a2 and advance1701 pIter(a2);1702 ;1703 pFree1(c);1704 }1705 ;1706 pIter(a1);1707 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1708 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom1709 goto Top;1710 1711 NotEqual: // b != a21712 if (d < 0) // b < a2:1713 {1714 assume(pComp0(b, a2) == -1);1715 a = pNext(a) = a2;// append a2 to result and advance a21716 pIter(a2);1717 if (a2==NULL) goto Finish;;1718 goto Top;1719 }1720 else // now d >= 0, i.e., b > a21721 {1722 assume(pComp0(b, a2) == 1);1723 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1724 a = pNext(a) = b; // append b to result and advance a11725 pIter(a1);1726 if (a1 == NULL) // are we done?1727 {1728 b = pNew();1729 goto Finish;1730 }1731 b = pNew();1732 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom1733 goto Top;1734 }1735 1736 Finish: // a1 or a2 is NULL: Clean-up time1737 assume(a1 == NULL || a2 == NULL);1738 if (a1 == NULL) // append rest of a2 to result1739 pNext(a) = a2;1740 else // append (- a1*monom) to result1741 spMultCopyX(a1, monom, a, tneg, spNoether);1742 ;1743 if (b != NULL) pFree1(b);1744 }1745 static void spSpolyLoop_chMODP_otEXP_homYES_nwEVEN1746 (poly a1, poly a2, poly monom, poly spNoether)1747 {1748 poly a = monom, // collects the result1749 b = NULL, // stores a1*monom1750 c; // used for temporary storage1751 number tm = pGetCoeff(monom), // coefficient of monom1752 tneg = npNegM(tm), // - (coefficient of monom)1753 tb, // used for tm*coeff(a1)1754 tc; // used for intermediate coeff1755 1756 Order_t order; // used for homog case1757 1758 if (a2==NULL) goto Finish; // we are done if a2 is 01759 b = pNew();1760 1761 order = pGetOrder(a2); // inits order for homog case1762 1763 1764 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b1765 1766 // MAIN LOOP:1767 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1768 register long d;1769 _pMonComp_otEXP_nwEVEN(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1770 1771 Equal: // b equals a21772 assume(pComp0(b, a2) == 0);1773 tb = npMultM(pGetCoeff(a1), tm);1774 tc = pGetCoeff(a2);1775 if (!npEqualM(tc, tb))1776 {1777 tc=npSubM(tc, tb);1778 ;1779 pSetCoeff0(a2,tc); // adjust coeff of a21780 a = pNext(a) = a2; // append a2 to result and advance a21781 pIter(a2);1782 }1783 else1784 { // coeffs are equal, so their difference is 0:1785 c = a2; // do not append anything to result: Delete a2 and advance1786 pIter(a2);1787 ;1788 pFree1(c);1789 }1790 ;1791 pIter(a1);1792 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1793 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom1794 goto Top;1795 1796 NotEqual: // b != a21797 if (d < 0) // b < a2:1798 {1799 assume(pComp0(b, a2) == -1);1800 a = pNext(a) = a2;// append a2 to result and advance a21801 pIter(a2);1802 if (a2==NULL) goto Finish;;1803 goto Top;1804 }1805 else // now d >= 0, i.e., b > a21806 {1807 assume(pComp0(b, a2) == 1);1808 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1809 a = pNext(a) = b; // append b to result and advance a11810 pIter(a1);1811 if (a1 == NULL) // are we done?1812 {1813 b = pNew();1814 goto Finish;1815 }1816 b = pNew();1817 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom1818 goto Top;1819 }1820 1821 Finish: // a1 or a2 is NULL: Clean-up time1822 assume(a1 == NULL || a2 == NULL);1823 if (a1 == NULL) // append rest of a2 to result1824 pNext(a) = a2;1825 else // append (- a1*monom) to result1826 spMultCopyX(a1, monom, a, tneg, spNoether);1827 ;1828 if (b != NULL) pFree1(b);1829 }1830 static void spSpolyLoop_chMODP_otEXP_homYES_nwODD1831 (poly a1, poly a2, poly monom, poly spNoether)1832 {1833 poly a = monom, // collects the result1834 b = NULL, // stores a1*monom1835 c; // used for temporary storage1836 number tm = pGetCoeff(monom), // coefficient of monom1837 tneg = npNegM(tm), // - (coefficient of monom)1838 tb, // used for tm*coeff(a1)1839 tc; // used for intermediate coeff1840 1841 Order_t order; // used for homog case1842 1843 if (a2==NULL) goto Finish; // we are done if a2 is 01844 b = pNew();1845 1846 order = pGetOrder(a2); // inits order for homog case1847 1848 1849 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b1850 1851 // MAIN LOOP:1852 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1853 register long d;1854 _pMonComp_otEXP_nwODD(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1855 1856 Equal: // b equals a21857 assume(pComp0(b, a2) == 0);1858 tb = npMultM(pGetCoeff(a1), tm);1859 tc = pGetCoeff(a2);1860 if (!npEqualM(tc, tb))1861 {1862 tc=npSubM(tc, tb);1863 ;1864 pSetCoeff0(a2,tc); // adjust coeff of a21865 a = pNext(a) = a2; // append a2 to result and advance a21866 pIter(a2);1867 }1868 else1869 { // coeffs are equal, so their difference is 0:1870 c = a2; // do not append anything to result: Delete a2 and advance1871 pIter(a2);1872 ;1873 pFree1(c);1874 }1875 ;1876 pIter(a1);1877 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1878 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom1879 goto Top;1880 1881 NotEqual: // b != a21882 if (d < 0) // b < a2:1883 {1884 assume(pComp0(b, a2) == -1);1885 a = pNext(a) = a2;// append a2 to result and advance a21886 pIter(a2);1887 if (a2==NULL) goto Finish;;1888 goto Top;1889 }1890 else // now d >= 0, i.e., b > a21891 {1892 assume(pComp0(b, a2) == 1);1893 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1894 a = pNext(a) = b; // append b to result and advance a11895 pIter(a1);1896 if (a1 == NULL) // are we done?1897 {1898 b = pNew();1899 goto Finish;1900 }1901 b = pNew();1902 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom1903 goto Top;1904 }1905 1906 Finish: // a1 or a2 is NULL: Clean-up time1907 assume(a1 == NULL || a2 == NULL);1908 if (a1 == NULL) // append rest of a2 to result1909 pNext(a) = a2;1910 else // append (- a1*monom) to result1911 spMultCopyX(a1, monom, a, tneg, spNoether);1912 ;1913 if (b != NULL) pFree1(b);1914 }1915 static void spSpolyLoop_chMODP_otEXP_homYES_nwONE1916 (poly a1, poly a2, poly monom, poly spNoether)1917 {1918 poly a = monom, // collects the result1919 b = NULL, // stores a1*monom1920 c; // used for temporary storage1921 number tm = pGetCoeff(monom), // coefficient of monom1922 tneg = npNegM(tm), // - (coefficient of monom)1923 tb, // used for tm*coeff(a1)1924 tc; // used for intermediate coeff1925 1926 Order_t order; // used for homog case1927 1928 if (a2==NULL) goto Finish; // we are done if a2 is 01929 b = pNew();1930 1931 order = pGetOrder(a2); // inits order for homog case1932 1933 1934 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b1935 1936 // MAIN LOOP:1937 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering1938 register long d;1939 _pMonComp_otEXP_nwONE(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;1940 1941 Equal: // b equals a21942 assume(pComp0(b, a2) == 0);1943 tb = npMultM(pGetCoeff(a1), tm);1944 tc = pGetCoeff(a2);1945 if (!npEqualM(tc, tb))1946 {1947 tc=npSubM(tc, tb);1948 ;1949 pSetCoeff0(a2,tc); // adjust coeff of a21950 a = pNext(a) = a2; // append a2 to result and advance a21951 pIter(a2);1952 }1953 else1954 { // coeffs are equal, so their difference is 0:1955 c = a2; // do not append anything to result: Delete a2 and advance1956 pIter(a2);1957 ;1958 pFree1(c);1959 }1960 ;1961 pIter(a1);1962 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?1963 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom1964 goto Top;1965 1966 NotEqual: // b != a21967 if (d < 0) // b < a2:1968 {1969 assume(pComp0(b, a2) == -1);1970 a = pNext(a) = a2;// append a2 to result and advance a21971 pIter(a2);1972 if (a2==NULL) goto Finish;;1973 goto Top;1974 }1975 else // now d >= 0, i.e., b > a21976 {1977 assume(pComp0(b, a2) == 1);1978 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));1979 a = pNext(a) = b; // append b to result and advance a11980 pIter(a1);1981 if (a1 == NULL) // are we done?1982 {1983 b = pNew();1984 goto Finish;1985 }1986 b = pNew();1987 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom1988 goto Top;1989 }1990 1991 Finish: // a1 or a2 is NULL: Clean-up time1992 assume(a1 == NULL || a2 == NULL);1993 if (a1 == NULL) // append rest of a2 to result1994 pNext(a) = a2;1995 else // append (- a1*monom) to result1996 spMultCopyX(a1, monom, a, tneg, spNoether);1997 ;1998 if (b != NULL) pFree1(b);1999 }2000 static void spSpolyLoop_chMODP_otEXP_homYES_nwTWO2001 (poly a1, poly a2, poly monom, poly spNoether)2002 {2003 poly a = monom, // collects the result2004 b = NULL, // stores a1*monom2005 c; // used for temporary storage2006 number tm = pGetCoeff(monom), // coefficient of monom2007 tneg = npNegM(tm), // - (coefficient of monom)2008 tb, // used for tm*coeff(a1)2009 tc; // used for intermediate coeff2010 2011 Order_t order; // used for homog case2012 2013 if (a2==NULL) goto Finish; // we are done if a2 is 02014 b = pNew();2015 2016 order = pGetOrder(a2); // inits order for homog case2017 2018 2019 pCopyAddFastHomog(b, a1, monom, order); // now a2 != NULL -- set up b2020 2021 // MAIN LOOP:2022 Top: // compare b = monom*a1 and a2 w.r.t. monomial ordering2023 register long d;2024 _pMonComp_otEXP_nwTWO(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;2025 2026 Equal: // b equals a22027 assume(pComp0(b, a2) == 0);2028 tb = npMultM(pGetCoeff(a1), tm);2029 tc = pGetCoeff(a2);2030 if (!npEqualM(tc, tb))2031 {2032 tc=npSubM(tc, tb);2033 ;2034 pSetCoeff0(a2,tc); // adjust coeff of a22035 a = pNext(a) = a2; // append a2 to result and advance a22036 pIter(a2);2037 }2038 else2039 { // coeffs are equal, so their difference is 0:2040 c = a2; // do not append anything to result: Delete a2 and advance2041 pIter(a2);2042 ;2043 pFree1(c);2044 }2045 ;2046 pIter(a1);2047 if (a2 == NULL || a1 == NULL) goto Finish; // are we done ?2048 pCopyAddFastHomog(b, a1, monom, order); // No! So, get new b = a1*monom2049 goto Top;2050 2051 NotEqual: // b != a22052 if (d < 0) // b < a2:2053 {2054 assume(pComp0(b, a2) == -1);2055 a = pNext(a) = a2;// append a2 to result and advance a22056 pIter(a2);2057 if (a2==NULL) goto Finish;;2058 goto Top;2059 }2060 else // now d >= 0, i.e., b > a22061 {2062 assume(pComp0(b, a2) == 1);2063 pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));2064 a = pNext(a) = b; // append b to result and advance a12065 pIter(a1);2066 if (a1 == NULL) // are we done?2067 {2068 b = pNew();2069 goto Finish;2070 }2071 b = pNew();2072 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom2073 goto Top;2074 }2075 2076 Finish: // a1 or a2 is NULL: Clean-up time2077 assume(a1 == NULL || a2 == NULL);2078 if (a1 == NULL) // append rest of a2 to result2079 pNext(a) = a2;2080 else // append (- a1*monom) to result2081 spMultCopyX(a1, monom, a, tneg, spNoether);2082 ;2083 if (b != NULL) pFree1(b);2084 }2085 static spSpolyLoopProc spGetSpolyLoop(Characteristics ch,OrderingTypes ot,Homogs hom,NumWords nw)2086 {2087 if (ch == chMODP)2088 {2089 if (ot == otEXP)2090 {2091 if (hom == homYES)2092 {2093 if (nw == nwTWO)2094 {2095 return spSpolyLoop_chMODP_otEXP_homYES_nwTWO;2096 }2097 if (nw == nwONE)2098 {2099 return spSpolyLoop_chMODP_otEXP_homYES_nwONE;2100 }2101 if (nw == nwODD)2102 {2103 return spSpolyLoop_chMODP_otEXP_homYES_nwODD;2104 }2105 if (nw == nwEVEN)2106 {2107 return spSpolyLoop_chMODP_otEXP_homYES_nwEVEN;2108 }2109 }2110 if (nw == nwTWO)2111 {2112 return spSpolyLoop_chMODP_otEXP_homGEN_nwTWO;2113 }2114 if (nw == nwONE)2115 {2116 return spSpolyLoop_chMODP_otEXP_homGEN_nwONE;2117 }2118 if (nw == nwODD)2119 {2120 return spSpolyLoop_chMODP_otEXP_homGEN_nwODD;2121 }2122 if (nw == nwEVEN)2123 {2124 return spSpolyLoop_chMODP_otEXP_homGEN_nwEVEN;2125 }2126 }2127 if (ot == otEXPCOMP)2128 {2129 if (hom == homYES)2130 {2131 if (nw == nwTWO)2132 {2133 return spSpolyLoop_chMODP_otEXPCOMP_homYES_nwTWO;2134 }2135 if (nw == nwONE)2136 {2137 return spSpolyLoop_chMODP_otEXPCOMP_homYES_nwONE;2138 }2139 if (nw == nwODD)2140 {2141 return spSpolyLoop_chMODP_otEXPCOMP_homYES_nwODD;2142 }2143 if (nw == nwEVEN)2144 {2145 return spSpolyLoop_chMODP_otEXPCOMP_homYES_nwEVEN;2146 }2147 }2148 if (nw == nwTWO)2149 {2150 return spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwTWO;2151 }2152 if (nw == nwONE)2153 {2154 return spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwONE;2155 }2156 if (nw == nwODD)2157 {2158 return spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwODD;2159 }2160 if (nw == nwEVEN)2161 {2162 return spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwEVEN;2163 }2164 }2165 if (ot == otCOMPEXP)2166 {2167 if (hom == homYES)2168 {2169 if (nw == nwTWO)2170 {2171 return spSpolyLoop_chMODP_otCOMPEXP_homYES_nwTWO;2172 }2173 if (nw == nwONE)2174 {2175 return spSpolyLoop_chMODP_otCOMPEXP_homYES_nwONE;2176 }2177 if (nw == nwODD)2178 {2179 return spSpolyLoop_chMODP_otCOMPEXP_homYES_nwODD;2180 }2181 if (nw == nwEVEN)2182 {2183 return spSpolyLoop_chMODP_otCOMPEXP_homYES_nwEVEN;2184 }2185 }2186 if (nw == nwTWO)2187 {2188 return spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwTWO;2189 }2190 if (nw == nwONE)2191 {2192 return spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwONE;2193 }2194 if (nw == nwODD)2195 {2196 return spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwODD;2197 }2198 if (nw == nwEVEN)2199 {2200 return spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwEVEN;2201 }2202 }2203 }2204 return NULL;2205 } -
Singular/spolys.h
rc88c949 rd14712 7 7 * ABSTRACT: s-polynomials 8 8 */ 9 /* $Id: spolys.h,v 1. 7 1999-09-27 14:43:43obachman Exp $ */9 /* $Id: spolys.h,v 1.8 1999-09-29 10:59:40 obachman Exp $ */ 10 10 #include "structs.h" 11 #include "spSpolyLoop.h"12 11 13 12 /* reduction */ -
Singular/structs.h
rc88c949 rd14712 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: structs.h,v 1.2 4 1999-09-28 17:37:22 SingularExp $ */6 /* $Id: structs.h,v 1.25 1999-09-29 10:59:40 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT … … 215 215 216 216 memHeap mm_specHeap; /* Heap from where monoms are allocated */ 217 #ifdef SDRING218 short partN;219 #endif220 217 short ch; /* characteristic */ 221 218 short ch_flags; /* additional char-flags */ -
Singular/syz.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz.cc,v 1.2 2 1999-09-27 15:32:56obachman Exp $ */4 /* $Id: syz.cc,v 1.23 1999-09-29 10:59:40 obachman Exp $ */ 5 5 6 6 /* … … 16 16 #include "kstd1.h" 17 17 #include "kutil.h" 18 #include "spolys.h"19 18 #include "stairc.h" 20 //#include "ipid.h"21 19 #include "cntrlc.h" 22 20 #include "ipid.h" -
Singular/syz.h
rc88c949 rd14712 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: syz.h,v 1.1 7 1999-09-27 15:05:33obachman Exp $ */6 /* $Id: syz.h,v 1.18 1999-09-29 10:59:41 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT: Resolutions 9 9 */ 10 10 #include "structs.h" 11 #include "kbPolyProcs.h"12 11 13 12 struct sSObject{ … … 50 49 kBucket_pt syz_bucket; 51 50 ring syRing; 52 kbPolyProcs pProcs;53 51 int length; 54 52 resolvente fullres; -
Singular/syz0.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz0.cc,v 1.2 0 1999-09-27 15:32:56obachman Exp $ */4 /* $Id: syz0.cc,v 1.21 1999-09-29 10:59:41 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: resolutions … … 12 12 #include "mmemory.h" 13 13 #include "polys.h" 14 #include "spolys.h"15 14 #include "febase.h" 16 15 #include "kstd1.h" 17 16 #include "kutil.h" 18 #include "spolys.h"19 17 #include "stairc.h" 20 18 #include "ipid.h" … … 31 29 32 30 static kBucket_pt sy0buck; 33 static kbPolyProcs sy0pProcs;34 31 35 32 static polyset syInitSort(polyset oldF,int rkF,int Fmax, … … 125 122 } 126 123 127 static poly syRedtail2(poly p, polyset redWith, intvec *modcomp , spSpolyLoopProc SpolyLoop = NULL)124 static poly syRedtail2(poly p, polyset redWith, intvec *modcomp) 128 125 { 129 126 poly h, hn; … … 143 140 { 144 141 //if (TEST_OPT_PROT) Print("r"); 145 hn = spSpolyRed(redWith[j],hn,NULL, SpolyLoop);142 hn = ksOldSpolyRed(redWith[j],hn); 146 143 if (hn == NULL) 147 144 { … … 202 199 rkF=idRankFreeModule(idF); 203 200 Free((ADDRESS)idF,sizeof(ip_sideal)); 204 spSet(currRing);205 201 /*-------------sorting of F for index handling------------*/ 206 202 if (noSort) … … 286 282 tl = smax; 287 283 /*--------------begin to reduce-----------------------------*/ 288 toRed = spSpolyCreate(S[j],S[k],NULL, NULL);284 toRed = ksOldCreateSpoly(S[j],S[k]); 289 285 ecartToRed = 1; 290 286 bestEcart = 1; … … 383 379 } 384 380 385 toRed = spSpolyRed(p,toRed,NULL, NULL);381 toRed = ksOldSpolyRed(p,toRed); 386 382 } 387 383 } … … 433 429 *special Normalform for Schreyer in factor rings 434 430 */ 435 poly sySpecNormalize(poly toNorm,ideal mW=NULL , spSpolyLoopProc SpolyLoop=NULL)431 poly sySpecNormalize(poly toNorm,ideal mW=NULL) 436 432 { 437 433 int j,i=0; … … 450 446 { 451 447 //pNorm(toNorm); 452 toNorm = spSpolyRed(currQuotient->m[i],toNorm,NULL, SpolyLoop);448 toNorm = ksOldSpolyRed(currQuotient->m[i],toNorm); 453 449 pDelete(&p); 454 450 if (toNorm==NULL) return NULL; … … 550 546 { 551 547 number an=nCopy(pGetCoeff(F[k])),bn=nCopy(pGetCoeff(F[j])); 552 int ct = spCheckCoeff(&an, &bn);548 int ct = ksCheckCoeff(&an, &bn); 553 549 syz = pCopy(pairs[k]); 554 550 //syz->coef = nCopy(F[k]->coef); … … 587 583 } 588 584 if (k<Fl) 589 toRed = spSpolyCreate(F[j],F[k],NULL, NULL);585 toRed = ksOldCreateSpoly(F[j],F[k]); 590 586 else 591 587 { 592 588 q = pMultT(pCopy(F[j]),multWith); 593 toRed = sySpecNormalize(q,mW , NULL);589 toRed = sySpecNormalize(q,mW); 594 590 pDelete(&multWith); 595 591 } … … 614 610 printf("toRed in Pair[%d, %d]:", j, k); 615 611 pWrite(toRed); 616 kBucketInit(sy0buck,toRed,-1 ,&sy0pProcs);612 kBucketInit(sy0buck,toRed,-1); 617 613 #endif 618 614 … … 622 618 { 623 619 kBucketClear(sy0buck,&toRed,<R); 624 toRed = sySpecNormalize(toRed,mW , NULL);620 toRed = sySpecNormalize(toRed,mW); 625 621 #ifdef WRITE_BUCKETS 626 622 printf("toRed in Pair[%d, %d]:", j, k); … … 691 687 { 692 688 (*newmodcomp)[j+2] = Sl; 693 (*Shdl)[Sl] = syRedtail2(syz,*Shdl,newmodcomp , NULL);689 (*Shdl)[Sl] = syRedtail2(syz,*Shdl,newmodcomp); 694 690 (*newmodcomp)[j+2] = 0; 695 691 } … … 844 840 //while ((i!=0) && (!res[syzIndex]->m[i-1])) i--; 845 841 sy0buck = kBucketCreate(); 846 kbSetPolyProcs(&sy0pProcs,currRing,spGetOrderType(currRing,1,0));847 842 if (syzIndex+1==*length) 848 843 { -
Singular/syz1.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz1.cc,v 1.4 0 1999-09-27 15:05:33obachman Exp $ */4 /* $Id: syz1.cc,v 1.41 1999-09-29 10:59:41 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: resolutions … … 14 14 #include "kstd1.h" 15 15 #include "kutil.h" 16 #include "spolys.h"17 #include "spolys0.h"18 16 #include "stairc.h" 19 17 #include "ipid.h" … … 31 29 #include "syz.h" 32 30 #include "kbuckets.h" 33 #include "kbPolyProcs.h"34 31 #include <limits.h> 35 32 … … 38 35 /*--------------static variables------------------------*/ 39 36 /*---points to the real components, shifted of the actual module-*/ 40 staticint * currcomponents=NULL;41 staticlong * currShiftedComponents=NULL;37 int * currcomponents=NULL; 38 long * currShiftedComponents=NULL; 42 39 43 40 // Logarithm of estimate of maximal number of new components … … 374 371 { 375 372 //hn = sySPolyRed(hn,redWith->m[j]); 376 hn = spSpolyRed(redWith->m[j],hn,NULL,spSpolyLoop_General);373 hn = ksOldSpolyRed(redWith->m[j],hn); 377 374 if (hn == NULL) 378 375 { … … 805 802 pTest(tso.p1); 806 803 nextPairs[i].p = 807 spSpolyCreate(tso.p2, tso.p1,NULL,spSpolyLoop_General);804 ksOldCreateSpoly(tso.p2, tso.p1,NULL); 808 805 (*spl)[i] = pLength(nextPairs[i].p); 809 806 } … … 1046 1043 { 1047 1044 (sPairs)[i].syz = 1048 spSpolyRed(res->m[j],(sPairs)[i].syz,NULL,spSpolyLoop_General);1045 ksOldSpolyRed(res->m[j],(sPairs)[i].syz); 1049 1046 //sySPolyRed((sPairs)[i].syz,res->m[j]); 1050 1047 j = k-1; … … 1535 1532 static void syStatistics(resolvente res,int length) 1536 1533 { 1537 int i,j=1,k,deg=0; 1534 int i,j=1,k; 1535 Order_t deg = 0; 1538 1536 1539 1537 PrintLn(); … … 2518 2516 pComp0 = syzcomp2dpc; 2519 2517 syzstr->bucket = kBucketCreate(); 2520 kbSetPolyProcs(&syzstr->pProcs,currRing,rOrderType_Syz2dpc,FALSE);2521 2518 for (index=syzstr->length-1;index>0;index--) 2522 2519 { … … 2714 2711 syzstr->Firstelem = (int**)Alloc0((*length+1)*sizeof(int*)); 2715 2712 syzstr->bucket = kBucketCreate(); 2716 kbSetPolyProcs(&syzstr->pProcs,currRing,rOrderType_Syz2dpc,FALSE);2717 2713 int len0=idRankFreeModule(arg)+1; 2718 2714 startdeg = actdeg; -
Singular/syz2.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz2.cc,v 1. 1 1999-09-27 15:05:34obachman Exp $ */4 /* $Id: syz2.cc,v 1.2 1999-09-29 10:59:42 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: resolutions … … 605 605 { 606 606 //tso.p = sySPoly(tso.p1, tso.p2,tso.lcm); 607 tso.p = spSpolyCreate(tso.p2, tso.p1,NULL,spSpolyLoop_General);607 tso.p = ksOldCreateSpoly(tso.p2, tso.p1); 608 608 #ifdef SHOW_PROT 609 609 Print("reduziere Paar mit: \n"); … … 966 966 syzstr->bucket = kBucketCreate(); 967 967 syzstr->syz_bucket = kBucketCreate(); 968 kbSetPolyProcs(&syzstr->pProcs,currRing,rOrderType_Syz2dpc,FALSE);969 968 startdeg = actdeg; 970 969 nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg); -
Singular/tesths.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: tesths.cc,v 1.7 5 1999-09-24 12:24:41 SingularExp $ */4 /* $Id: tesths.cc,v 1.76 1999-09-29 10:59:43 obachman Exp $ */ 5 5 6 6 /* … … 122 122 " 0<\n" 123 123 " by: G.-M. Greuel, G. Pfister, H. Schoenemann \\ %s\n" 124 #ifdef SDRING125 " preliminary experimental version\n"126 #endif127 124 "FB Mathematik der Universitaet, D-67653 Kaiserslautern \\\n" 128 125 , S_VERSION1,S_VERSION2);
Note: See TracChangeset
for help on using the changeset viewer.