Changeset d14712 in git


Ignore:
Timestamp:
Sep 29, 1999, 12:59:43 PM (25 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
4f011a3b4ee2de9e079fb1b3ff36483e9f1f0511
Parents:
c88c949ab8d0ed79f5fe01cd33e526815d5e041f
Message:
* got rid off STDTRACE, FAST_AND_DIRTY, (most) DRING, SRING, SDRING
* got rid of spoly*.* stuff


git-svn-id: file:///usr/local/Singular/svn/trunk@3694 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
3 added
34 edited

Legend:

Unmodified
Added
Removed
  • Singular/Makefile.in

    rc88c949 rd14712  
    7474    ipassign.cc ipconv.cc ipid.cc iplib.cc \
    7575    ipprint.cc ipshell.cc khstd.cc kstdfac.cc \
    76     comm.cc kstd1.cc kstd2.cc kutil.cc lists.cc \
     76    kstd1.cc kstd2.cc kutil.cc lists.cc \
    7777    longalg.cc longrat.cc longrat0.cc \
    7878    maps.cc matpol.cc misc.cc sdb.cc gnumpfl.cc gnumpc.cc \
     
    8181    numbers.cc polys.cc polys0.cc polys1.cc polys-impl.cc \
    8282    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 \
    8484    subexpr.cc syz.cc syz0.cc syz1.cc \
    8585    timer.cc weight.cc \
     
    8787    mpsr_Get.cc mpsr_GetMisc.cc mpsr_Error.cc \
    8888    GMPrat.cc multicnt.cc npolygon.cc semic.cc spectrum.cc splist.cc \
    89     ndbm.cc spSpolyLoop.cc libparse.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 \
    9191    mpr_inout.cc mpr_base.cc mpr_numeric.cc
    9292# normal C source files
     
    9797ESOURCES=iparith.cc gmalloc.c tesths.cc mpsr_Tok.cc claptmpl.cc
    9898
    99 SOURCES=${CSOURCES} ${CXXSOURCES} grammar.y scanner.l libparse.l spSpolyLoop.pl generate.pl
     99SOURCES=${CSOURCES} ${CXXSOURCES} grammar.y scanner.l libparse.l
    100100
    101101SOURCES=${CSOURCES} ${CXXSOURCES} ${ESOURCES} \
    102         grammar.y scanner.l libparse.l spSpolyLoop.pl generate.pl
     102        grammar.y scanner.l libparse.l
    103103
    104104HEADERS=algmap.h hutil.h lists.h stairc.h attrib.h ideals.h \
     
    110110        mmemory.h mmprivate.h mmheap.h mmpage.h page.h \
    111111        ffields.h khstd.h silink.h sparsmat.h gnumpfl.h gnumpc.h \
    112         fglm.h comm.h kstd1.h modulop.h sing_dbm.h weight.h \
    113         fglmgauss.h fglmvec.h kstd2.h mpsr.h sing_mp.h \
    114         kstdfac.h mpsr_Get.h spolys.h \
    115         kutil.h mpsr_Put.h spolys0.h sing_dld.h\
    116         ndbm.h spSpolyLoop.h polys-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 \
    117117        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 \
    119119        mpr_global.h mpr_inout.h mpr_base.h mpr_numeric.h \
    120120        feOpt.h fegetopt.h
    121121
    122 INCS=febase.inc polys.inc iparith.inc mpsr_Tok.inc spSpolyLoop.inc feOpt.inc
     122INCS=febase.inc polys.inc iparith.inc mpsr_Tok.inc feOpt.inc
    123123
    124124TESTS=${testdir}/comparecheck ${testdir}/fac_test.in ${testdir}/fac_test.out\
     
    211211        echo unsigned long feVersionId =  `date '+%Y%m%d%H'`\; >version.h
    212212
    213 kbPolyProcs.cc kbPolyProcs.dd : kbPolyProcs.pin
    214 
    215 kbPolyProcs.pin : generate.pl
    216         @if test "x${PERL5}" = x; then \
    217                 echo Error: no perl5 given. Can not rebuild $@;\
    218                 exit 1;\
    219         fi
    220         ${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.inc
    223 
    224 spSpolyLoop.inc: spSpolyLoop.pl
    225         @if test "x${PERL5}" = x; then \
    226                 echo Error: no perl5 given. Can not rebuild spSpolyLoop.inc;\
    227                 exit 1;\
    228         fi
    229         ${PERL5} spSpolyLoop.pl > spSpolyLoop.inc
    230 
    231 
    232213libparse: libparse_main.o utils.o fegetopt.o
    233214        ${CXX} -o libparse libparse_main.o utils.o fegetopt.o
     
    259240        rm a.out
    260241
    261 src: scanner.cc grammar.h grammar.cc libparse.cc spSpolyLoop.inc
     242src: scanner.cc grammar.h grammar.cc libparse.cc
    262243
    263244mod2.h: stamp-h
     
    322303        @echo "Rebuilding the deleted files requires flex"
    323304        @echo "bison, perl"
    324         -rm -f scanner.cc grammar.h grammar.cc libparse.cc spSpolyLoop.inc
     305        -rm -f scanner.cc grammar.h grammar.cc libparse.cc
    325306
    326307maintainer-clean: distclean srcclean
     
    450431     gnumpc.op longrat.op longrat0.op misc.op ring.op numbers.op maps.op\
    451432     hilb.op comm.op kstd1.op kstd2.op kutil.op khstd.op kstdfac.op modulop.op \
    452      spolys.op ideals.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 \
    454435     ipid.op ipshell.op iplib.op ipassign.op ipconv.op ipprint.op\
    455436     polys.op polys0.op polys1.op polys-impl.op extra.op\
     
    460441     mpsr_Error.op mpsr_Put.op mpsr_PutPoly.op mpsr_GetPoly.op \
    461442     mpsr_Get.op mpsr_GetMisc.op \
    462      ndbm.op spSpolyLoop.op libparse.op  mod_raw.op \
     443     ndbm.op libparse.op  mod_raw.op \
    463444     mpr_inout.op mpr_base.op mpr_numeric.op \
    464445     GMPrat.op multicnt.op npolygon.op semic.op spectrum.op splist.op \
     
    479460     hilb.ob comm.ob kstd1.ob kstd2.ob kutil.ob khstd.ob kstdfac.ob modulop.ob \
    480461     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 \
    482463     ipid.ob ipshell.ob iplib.ob ipassign.ob ipconv.ob ipprint.ob\
    483464     polys.ob polys0.ob polys1.ob polys-impl.ob extra.ob\
     
    488469     mpsr_Error.ob mpsr_Put.ob mpsr_PutPoly.ob mpsr_GetPoly.ob \
    489470     mpsr_Get.ob mpsr_GetMisc.ob \
    490      ndbm.ob spSpolyLoop.ob libparse.ob mod-${SINGUNAME}.ob \
     471     ndbm.ob libparse.ob mod-${SINGUNAME}.ob \
    491472     pcv.ob kbuckets.ob kbPolyProcs.ob
    492473
  • Singular/attrib.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: attrib.cc,v 1.14 1999-09-17 11:42:22 Singular Exp $ */
     4/* $Id: attrib.cc,v 1.15 1999-09-29 10:59:27 obachman Exp $ */
    55
    66/*
     
    350350    I->rank=max(I->rank,(int)c->Data());
    351351  }
    352 #ifdef DRING
    353   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 #endif
    380352  else
    381353  {
     
    418390    resetFlag((idhdl)a->data,FLAG_STD);
    419391  }
    420 #ifdef DRING
    421   else if (strcmp(name,"D")==0)
    422   {
    423     resetFlag(a,FLAG_DOPERATOR);
    424     resetFlag((idhdl)a->data,FLAG_DOPERATOR);
    425   }
    426 #endif
    427392  else
    428393  {
  • Singular/extra.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR      *
    33*****************************************/
    4 /* $Id: extra.cc,v 1.107 1999-09-27 15:32:54 obachman Exp $ */
     4/* $Id: extra.cc,v 1.108 1999-09-29 10:59:28 obachman Exp $ */
    55/*
    66* ABSTRACT: general interface to internals of Singular ("system" command)
     
    5757#endif
    5858
    59 #ifdef STDTRACE
    60 //#include "comm.h"
    61 #endif
    62 
    6359#ifdef HAVE_FACTORY
    6460#define SI_DONT_HAVE_GLOBAL_VARS
     
    192188        char *s=(char *)h->Data();
    193189        res->rtyp=INT_CMD;
    194         #ifdef DRING
    195           TEST_FOR("DRING")
    196         #endif
    197190        #ifdef HAVE_DBM
    198191          TEST_FOR("DBM")
     
    216209          TEST_FOR("tcl")
    217210        #endif
    218         #ifdef SRING
    219           TEST_FOR("SRING")
    220         #endif
    221211        #ifdef TEST_MAC_ORDER
    222212          TEST_FOR("MAC_ORDER");
     
    705695    }
    706696    else
    707     /*==================== trace =============================*/
    708 #ifdef STDTRACE
    709     /* 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           else
    737           {
    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       else
    753          WerrorS("ideal expected");
    754     }
    755     else
    756 #endif
    757697#ifdef HAVE_FACTORY
    758698/*==================== fastcomb =============================*/
  • Singular/fglmcomb.cc

    rc88c949 rd14712  
    11// emacs edit mode for this file is -*- C++ -*-
    2 // $Id: fglmcomb.cc,v 1.14 1998-10-28 12:43:29 Singular Exp $
     2// $Id: fglmcomb.cc,v 1.15 1999-09-29 10:59:28 obachman Exp $
    33
    44/****************************************
     
    2121#include "ideals.h"
    2222#include "ring.h"
    23 #include "spolys.h"
    2423#include "ipid.h"
    2524#include "ipshell.h"
  • Singular/kbuckets.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kbuckets.cc,v 1.4 1999-09-27 14:57:12 obachman Exp $ */
     4/* $Id: kbuckets.cc,v 1.5 1999-09-29 10:59:29 obachman Exp $ */
    55
    66#include "mod2.h"
     
    1010#include "polys.h"
    1111#include "febase.h"
    12 #include "spolys0.h"
     12#include "pProcs.h"
    1313#include "kbuckets.h"
    1414#include "numbers.h"
     
    290290  for (i=2; i<=bucket->buckets_used; i++)
    291291  {
    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);
    295295  }
    296296
     
    418418  for (i=0; i<= bucket->buckets_used; i++)
    419419    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);
    421421#else
    422   kb_n_Mult_p(n, bucket->p);
     422  bucket->p = p_Mult_n(bucket->p, n);
    423423#endif
    424424}
     
    452452  if (i <= bucket->buckets_used && bucket->buckets[i] != NULL)
    453453  {
    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);
    461458    l1 = bucket->buckets_length[i];
    462459    bucket->buckets[i] = NULL;
     
    465462    while (bucket->buckets[i] != NULL)
    466463    {
    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);
    471467      i = pLogLength(l1);
    472468    }
     
    475471  {
    476472    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);
    478474    pSetCoeff0(m, nNeg(pGetCoeff(m)));
    479475  }
     
    486482    kBucketAdjustBucketsUsed(bucket);
    487483#else // HAVE_PSEUDO_BUCKETS
    488   kb_p_Minus_m_Mult_q(&(bucket->p), &(bucket->l),
    489                                    m, p, l1, spNoether,
    490                                    bucket->heap);
     484  bucket->p = p_Minus_m_Mult_q(bucket->p, m,  p,
     485                               &(bucket->l), l1,
     486                               spNoether, bucket->heap);
    491487#endif
    492488  kbTests(bucket);
     
    520516        bucket->buckets_length[i] -= lq;
    521517        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);
    523519      }
    524520    }
     
    552548      {
    553549        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);
    555551      }
    556552    }
     
    570566//
    571567
    572 extern int spCheckCoeff(number *a, number *b);
     568extern int ksCheckCoeff(number *a, number *b);
    573569
    574570number kBucketPolyRed(kBucket_pt bucket,
     
    593589  {
    594590    number an = pGetCoeff(p1), bn = pGetCoeff(lm);
    595     int ct = spCheckCoeff(&an, &bn);
     591    int ct = ksCheckCoeff(&an, &bn);
    596592    pSetCoeff(lm, bn);
    597593    if ((ct == 0) || (ct == 2)) kBucket_Mult_n(bucket, an);
     
    611607  }
    612608
    613   spMonSub(lm,p1);
     609  pMonSubFrom(lm,p1);
    614610  l1--;
    615611
     
    617613
    618614  kb_pDelete1(lm, bucket->heap);
    619   if (reset_vec) spModuleToPoly(a1);
     615  if (reset_vec) pSetCompP(a1, 0);
    620616  kbTests(bucket);
    621617  return rn;
  • Singular/kbuckets.h

    rc88c949 rd14712  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kbuckets.h,v 1.4 1999-09-27 14:34:18 obachman Exp $ */
     6/* $Id: kbuckets.h,v 1.5 1999-09-29 10:59:29 obachman Exp $ */
    77#include "mod2.h"
    88#include "mmheap.h"
    9 #include "kbPolyProcs.h"
    109
    1110/////////////////////////////////////////////////////////////////////////
  • Singular/kstd1.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd1.cc,v 1.37 1999-09-13 08:16:20 Singular Exp $ */
     4/* $Id: kstd1.cc,v 1.38 1999-09-29 10:59:30 obachman Exp $ */
    55/*
    66* ABSTRACT:
     
    1414#include "kutil.h"
    1515#include "kstd1.h"
    16 #include "kstd2.h"
    1716#include "khstd.h"
    18 #include "spolys.h"
    1917#include "stairc.h"
    2018#include "weight.h"
     
    2624#include "timer.h"
    2725#include "lists.h"
    28 #ifdef STDTRACE
    29 #include "comm.h"
    30 #endif
    31 #include "spSpolyLoop.h"
    3226
    3327//#include "ipprint.h"
     
    108102  if (intoT)
    109103  {
    110     hp = spSpolyRedNew(*with,(*h).p,strat->kNoether, strat->spSpolyLoop);
     104    hp = ksOldSpolyRedNew(*with,(*h).p,strat->kNoether);
    111105    enterT(*h,strat);
    112106    (*h).p = hp;
     
    114108  else
    115109  {
    116     (*h).p = spSpolyRed(*with,(*h).p,strat->kNoether, strat->spSpolyLoop);
     110    (*h).p = ksOldSpolyRed(*with,(*h).p,strat->kNoether);
    117111  }
    118112  if (TEST_OPT_DEBUG)
     
    216210        if (at <= strat->Ll)
    217211        {
     212          /*test if h is already standardbasis element*/
     213#ifdef HAVE_HOMOG_T
     214          i=strat->tl+1;
     215#else
    218216          i=strat->sl+1;
     217#endif
    219218          do
    220219          {
    221220            i--;
    222221            if (i<0) return;
     222#ifdef HAVE_HOMOG_T
     223          } while (!pDivisibleBy1(strat->T[i].p,(*h).p));
     224#else
    223225          } while (!pDivisibleBy1(strat->S[i],(*h).p));
     226#endif       
    224227          enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
    225228          if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
     
    367370        if (at <= strat->Ll)
    368371        {
     372#ifdef HAVE_HOMOG_T
     373          i=strat->tl+1;
     374#else
    369375          i=strat->sl+1;
     376#endif
    370377          do
    371378          {
    372379            i--;
    373380            if (i<0) return;
     381#ifdef HAVE_HOMOG_T
     382          } while (!pDivisibleBy1(strat->T[i].p,(*h).p));
     383#else
    374384          } while (!pDivisibleBy1(strat->S[i],(*h).p));
     385#endif       
    375386          enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
    376387          if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
     
    429440        wrp(strat->T[j].p);
    430441      }
    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);
    433443      if (TEST_OPT_DEBUG)
    434444      {
     
    468478        if (at <= strat->Ll)
    469479        {
     480#ifdef HAVE_HOMOG_T
     481          i=strat->tl+1;
     482#else
    470483          i=strat->sl+1;
     484#endif
    471485          do
    472486          {
    473487            i--;
    474488            if (i<0) return;
     489#ifdef HAVE_HOMOG_T
     490          } while (!pDivisibleBy1(strat->T[i].p,(*h).p));
     491#else
    475492          } while (!pDivisibleBy1(strat->S[i],(*h).p));
     493#endif       
    476494          enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
    477495          if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
     
    617635        if (at <= strat->Ll)
    618636        {
     637#ifdef HAVE_HOMOG_T
     638          i=strat->tl+1;
     639#else
    619640          i=strat->sl+1;
     641#endif
    620642          do
    621643          {
    622644            i--;
    623645            if (i<0) return;
     646#ifdef HAVE_HOMOG_T
     647          } while (!pDivisibleBy1(strat->T[i].p,(*h).p));
     648#else
    624649          } while (!pDivisibleBy1(strat->S[i],(*h).p));
     650#endif       
    625651          enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
    626652          if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
     
    910936      {
    911937        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,
    913939                                    strat->L[j].p2,
    914                                     strat->kNoether,
    915                                     strat->spSpolyLoop);   /*the real one*/
     940                                    strat->kNoether);   /*the real one*/
    916941        if (!strat->honey)
    917942          strat->initEcart(&strat->L[j]);
     
    951976      {
    952977        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                                     
    957983        strat->L[i].ecart = pLDeg(strat->L[i].p,&strat->L[i].length)-pFDeg(strat->L[i].p);
    958984      }
     
    10411067  int i;
    10421068
    1043 #ifdef SDRING
    1044   if (pSDRING
    1045   && (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 (pSDRING
    1054   && (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 (pSDRING
    1063   && (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 #endif
    10721069  strat->news = TRUE;
    10731070  /*- puts p to the standardbasis s at position atS -*/
     
    12481245  int hilbeledeg=1,hilbcount=0;
    12491246
    1250 #ifdef SDRING
    1251   polyset aug=(polyset)Alloc(setmax*sizeof(poly));
    1252   int augmax=setmax, augl=-1;
    1253   poly oldLcm;
    1254 #endif
    1255 
    12561247  strat->update = TRUE;
    12571248  /*- setting global variables ------------------- -*/
     
    13151306    {
    13161307      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 -*/
    13211311      if (!strat->honey)
    13221312        strat->initEcart(&strat->P);
     
    13241314        strat->P.length = pLength(strat->P.p);
    13251315    }
    1326 #ifdef SDRING
    1327     if (strat->P.p != NULL)
    1328 #endif
    13291316    {
    13301317      if (TEST_OPT_PROT) message(strat->P.ecart+pFDeg(strat->P.p),&olddeg,&reduc,strat);
     
    13331320    if (strat->P.p != NULL)
    13341321    {
    1335 #ifdef SDRING
    1336       aug[0]=strat->P.p;
    1337       augl=0;
    1338       if (pSDRING)
    1339       {
    1340         oldLcm=strat->P.lcm;
    1341 #ifdef SRING
    1342         if (pSRING) psAug(pCopy(strat->P.p),pOne(),&aug,&augl,&augmax);
    1343 #endif
    1344 #ifdef DRING
    1345         if (pDRING) pdAug(pCopy(strat->P.p),&aug,&augl,&augmax);
    1346 #endif
    1347       }
    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 #endif
    13601322          if (TEST_OPT_PROT) PrintS("s");/*- statistic -*/
    13611323          /*- enter P.p into s and b: -*/
     
    13781340          {
    13791341            int pos;
    1380 #ifdef SDRING
    1381             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             else
    1389 #endif
    13901342            {
    13911343              enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat);
     
    14041356          if (strat->P.lcm!=NULL) pFree1(strat->P.lcm);
    14051357          strat->P.lcm=NULL;
    1406 #ifdef SDRING
    1407         }
    1408       }
    1409       /* delete the old pair */
    1410       if (pSDRING &&(oldLcm!=NULL)) pFree1(oldLcm);
    1411 #endif
    14121358#ifdef KDEBUG
    14131359      memset(&strat->P,0,sizeof(strat->P));
     
    14501396  pDelete(&strat->kNoether);
    14511397  Free((ADDRESS)strat->NotUsedAxis,(pVariables+1)*sizeof(BOOLEAN));
    1452 #ifdef SDRING
    1453   Free((ADDRESS)aug,augmax*sizeof(poly));
    1454 #endif
    14551398  if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
    14561399  if (TEST_OPT_WEIGHTM)
     
    14991442  initBuchMoraPos(strat);
    15001443  initMora(F,strat);
    1501   strat->spSpolyLoop = spGetSpolyLoop(currRing,
    1502                                       max(strat->ak,pMaxComp(q)),
    1503                                       strat->syzComp, FALSE);
    15041444  strat->enterS = enterSMoraNF;
    15051445  /*- set T -*/
     
    15971537  strat->enterS = enterSMoraNF;
    15981538  /*- set T -*/
    1599   strat->spSpolyLoop = spGetSpolyLoop(currRing,
    1600                                       max(strat->ak,idRankFreeModule(q)),
    1601                                       strat->syzComp, FALSE);
    16021539  strat->tl = -1;
    16031540  strat->tmax = setmax;
     
    17231660  }
    17241661  if ((h==testHomog)
    1725 #ifdef DRING
    1726   && (!pDRING)
    1727 #endif
    17281662  )
    17291663  {
     
    17461680  }
    17471681  pLexOrder=b;
    1748 #ifdef DRING
    1749   if (pDRING) h=isNotHomog;
    1750 #endif
    17511682  if (h==isHomog)
    17521683  {
     
    17651696  }
    17661697  strat->homog=h;
    1767   spSet(currRing);
    1768   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat, syzComp);
    17691698  if (pOrdSgn==-1)
    17701699  {
     
    17761705  else
    17771706  {
    1778     #ifdef STDTRACE
    1779     lists l;
    1780     if (w!=NULL)
    1781       l=bbaLink(F,Q,*w,hilb,strat);
    1782     else
    1783       l=bbaLink(F,Q,NULL,hilb,strat);
    1784     r=(ideal)(l->m[0].data);
    1785     l->m[0].data=NULL;
    1786     l->Clean();
    1787     #else
    17881707    if (w!=NULL)
    17891708      r=bba(F,Q,*w,hilb,strat);
    17901709    else
    17911710      r=bba(F,Q,NULL,hilb,strat);
    1792     #endif
    17931711  }
    17941712#ifdef KDEBUG
     
    18131731//##############################################################
    18141732//##############################################################
    1815 
    1816 #ifdef STDTRACE
    1817 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 DRING
    1839   && (!pDRING)
    1840 #endif
    1841   )
    1842   {
    1843     if (strat->ak == 0)
    1844     {
    1845       h = (tHomog)idHomIdeal(F,Q);
    1846       w=NULL;
    1847     }
    1848     else
    1849       h = (tHomog)idHomModule(F,Q,w);
    1850   }
    1851 #ifdef DRING
    1852   if (pDRING) h=isNotHomog;
    1853 #endif
    1854   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 //     else
    1875 //       r=mora(F,Q,NULL,hilb,strat);
    1876 //   }
    1877 //   else
    1878   {
    1879     stdTrace->Init(lv,rw);
    1880     if(w==NULL)
    1881       l=bbaLink(F,Q,NULL,hilb,strat,stdTrace);
    1882     else
    1883       l=bbaLink(F,Q,*w,hilb,strat,stdTrace);
    1884     r=(ideal) (l->m[0].Data());
    1885   }
    1886 #ifdef KDEBUG
    1887   int i;
    1888   for (i=0; i<IDELEMS(r); i++) pTest(r->m[i]);
    1889 #endif
    1890   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 #endif
    19091733
    19101734lists min_std(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
     
    19281752  strat->ak = idRankFreeModule(F);
    19291753  if ((h==testHomog)
    1930 #ifdef DRING
    1931   && (!pDRING)
    1932 #endif
    19331754  )
    19341755  {
     
    19431764    }
    19441765  }
    1945 #ifdef DRING
    1946   if (pDRING) h=isNotHomog;
    1947 #endif
    19481766  if (h==isHomog)
    19491767  {
     
    19701788  }
    19711789  strat->homog=h;
    1972   spSet(currRing);
    1973   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat, syzComp);
    19741790  if (pOrdSgn==-1)
    19751791  {
     
    19811797  else
    19821798  {
    1983   #ifdef STDTRACE
    1984     lists rl;
    1985     if (w!=NULL)
    1986       rl=bbaLink(F, Q, *w, hilb, strat, NULL);
    1987     else
    1988       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   #else
    19931799    if (w!=NULL)
    19941800      r=bba(F,Q,*w,hilb,strat);
    19951801    else
    19961802      r=bba(F,Q,NULL,hilb,strat);
    1997   #endif
    19981803  }
    19991804#ifdef KDEBUG
     
    20441849  kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy));
    20451850  strat->syzComp = syzComp;
    2046   spSet(currRing);
    20471851  if (pOrdSgn==-1)
    20481852    p=kNF1(F,Q,p,strat,lazyReduce);
     
    20561860{
    20571861  ideal res;
    2058   spSet(currRing);
    20591862  if (TEST_OPT_PROT)
    20601863  {
     
    20881891  strat->kNoether=pCopy(ppNoether);
    20891892  strat->ak = idRankFreeModule(F);
    2090   spSet(currRing);
    20911893  initBuchMoraCrit(strat);
    20921894  strat->NotUsedAxis = (BOOLEAN *)Alloc((pVariables+1)*sizeof(BOOLEAN));
     
    20991901  strat->tmax        = setmax;
    21001902  strat->T           = initT();
    2101   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    21021903  if (pOrdSgn == -1)   strat->honey = TRUE;
    21031904  initS(F,Q,strat);
  • Singular/kstd1.h

    rc88c949 rd14712  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kstd1.h,v 1.8 1998-12-15 10:06:45 pohl Exp $ */
     6/* $Id: kstd1.h,v 1.9 1999-09-29 10:59:30 obachman Exp $ */
    77/*
    88* ABSTRACT
     
    2525ideal kStd(ideal F, ideal Q, tHomog h, intvec ** mw,intvec *hilb=NULL,
    2626          int syzComp=0,int newIdeal=0, intvec *vw=NULL);
    27 #ifdef STDTRACE
    28 lists TraceStd(leftv,int , ideal F, ideal Q, tHomog h, intvec ** w,intvec *hilb=NULL,
    29           int syzComp=0,int newIdeal=0);
    30 #endif
    3127
    3228/* the following global data are defined in kutil.cc */
  • Singular/kstd2.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.29 1999-09-27 14:58:09 obachman Exp $ */
     4/* $Id: kstd2.cc,v 1.30 1999-09-29 10:59:30 obachman Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    1515#include "kutil.h"
    1616#include "kstd1.h"
    17 #include "kstd2.h"
    1817#include "khstd.h"
    19 #include "spolys.h"
    2018#include "cntrlc.h"
    2119#include "weight.h"
     
    2321#include "ipshell.h"
    2422#include "intvec.h"
    25 #include "spSpolyLoop.h"
    26 #include "kbPolyProcs.h"
    2723
    2824// #include "timer.h"
     
    5046*  assumes homogeneous case and degree-ordering
    5147*/
     48#if 0
     49static 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
    52196static void redSyz (LObject* h,kStrategy strat)
    53197{
     
    118262        wrp(strat->S[j]);
    119263      }
    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);
    122265      if (TEST_OPT_DEBUG)
    123266      {
     
    175318}
    176319
     320#endif
     321
    177322/*2
    178323*  reduction procedure for the homogeneous case
     
    219364
    220365    // now we found one which is divisible
    221     kbReducePoly(h, &(strat->T[j]),
     366    ksReducePoly(h, &(strat->T[j]),
    222367                 strat->kNoether);
    223368#ifdef KDEBUG
     
    284429      wrp(strat->T[j].p);
    285430    }
    286     kbReducePoly(h, &(strat->T[j]), strat->kNoether);
     431    ksReducePoly(h, &(strat->T[j]), strat->kNoether);
    287432    if (TEST_OPT_DEBUG)
    288433    {
     
    440585      h->p = pCopy(h->p);
    441586    }
    442     kbReducePoly(h, &(strat->T[ii]), strat->kNoether);
     587    ksReducePoly(h, &(strat->T[ii]), strat->kNoether);
    443588    if (TEST_OPT_DEBUG)
    444589    {
     
    527672      /* compute the s-polynomial */
    528673      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);
    530675      /* computes only the first monomial of the spoly  */
    531676      if (p)
     
    542687            if (pDivisibleBy(strat->T[j].p,(*h).p))
    543688            {
    544               ph = spSpolyShortBba(strat->T[j].p,(*h).p);
     689              ph = ksCreateShortSpoly(strat->T[j].p,(*h).p);
    545690              if (ph==NULL)
    546691              {
     
    567712        }
    568713        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);
    571715      }
    572716      else
     
    649793        wrp(strat->S[j]);
    650794      }
    651       h = spSpolyRed(strat->S[j],h,strat->kNoether, strat->spSpolyLoop);
     795      h = ksOldSpolyRed(strat->S[j],h,strat->kNoether);
    652796      if (TEST_OPT_DEBUG)
    653797      {
     
    775919      pFree1(strat->P.p);
    776920      /* the real one */
    777       kbCreateSpoly(&(strat->P),
     921      ksCreateSpoly(&(strat->P),
    778922                    strat->kNoether);
    779923    }
     
    8901034  /*- set S -*/
    8911035  strat->sl = -1;
    892   strat->spSpolyLoop = spGetSpolyLoop(currRing, max(strat->ak, pMaxComp(q)),
    893                                       strat->syzComp, FALSE);
    8941036  /*- init local data struct.---------------------------------------- -*/
    8951037  /*Shdl=*/initS(F,Q,strat);
     
    9351077  /*- set S -*/
    9361078  strat->sl = -1;
    937   strat->spSpolyLoop =  spGetSpolyLoop(currRing,
    938                                        max(strat->ak, idRankFreeModule(q)),
    939                                        strat->syzComp, FALSE);
    9401079  /*- init local data struct.---------------------------------------- -*/
    9411080  /*Shdl=*/initS(F,Q,strat);
     
    10291168  }
    10301169  strat->homog=h;
    1031   spSet(currRing);
    1032   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    10331170  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
    10341171  initBuchMoraPos(strat);
  • Singular/kstdfac.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstdfac.cc,v 1.23 1999-09-27 15:04:58 obachman Exp $ */
     4/* $Id: kstdfac.cc,v 1.24 1999-09-29 10:59:31 obachman Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: factorizing alg. of Buchberger
     
    1515#include "kutil.h"
    1616#include "kstd1.h"
    17 #include "kstd2.h"
    1817#include "khstd.h"
    19 #include "spolys.h"
    2018#include "cntrlc.h"
    2119#include "weight.h"
    22 //#include "ipid.h"
    2320#include "ipshell.h"
    2421#include "intvec.h"
     
    2825#include "lists.h"
    2926#include "ideals.h"
    30 #include "spSpolyLoop.h"
    3127#include "timer.h"
    3228#include "kstdfac.h"
     
    207203  s->fromT=o->fromT;
    208204  s->noetherSet=o->noetherSet;
    209   s->spSpolyLoop = o->spSpolyLoop;
    210205  return s;
    211206}
     
    453448      pFree1(strat->P.p);
    454449      /* 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);
    459453    }
    460454    if (strat->honey)
     
    783777  }
    784778  strat->homog=h;
    785   spSet(currRing);
    786   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    787779  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
    788780  initBuchMoraPos(strat);
  • Singular/kutil.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.36 1999-09-27 14:57:11 obachman Exp $ */
     4/* $Id: kutil.cc,v 1.37 1999-09-29 10:59:31 obachman Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for kStd
     
    1212#include "tok.h"
    1313#include "febase.h"
    14 #include "spolys.h"
    1514#include "mmemory.h"
    1615#include "numbers.h"
    1716#include "polys.h"
    18 //#include "ipid.h"
    1917#include "ring.h"
    2018#include "ideals.h"
     
    2523#include "kstd1.h"
    2624#include "kutil.h"
    27 #include "spSpolyLoop.h"
    28 //#include "longrat.h"
    2925
    3026static poly redMora (poly h,int maxIndex,kStrategy strat);
    3127static poly redBba (poly h,int maxIndex,kStrategy strat);
    3228
    33 //int     cp, c3;
    34 //BOOLEAN interpt;
    35 //BOOLEAN news=FALSE;
    36 //static BOOLEAN newt=FALSE;/*used for messageSets*/
    3729BITSET  test=(BITSET)0;
    38 //int     ak;
    39 //int     syzComp=0;
    4030int     HCord;
    41 //LObject P;
    42 //poly    tail;
    43 //BOOLEAN *pairtest;/*used for enterOnePair*/
    44 //int    // LazyPass=100,
    45 //        LazyDegree=1;
    4631int        Kstd1_deg;
    4732int        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 */
    9633
    9734/*2
     
    608545  pLcm(p,strat->S[i],Lp.lcm);
    609546  pSetm(Lp.lcm);
    610 #ifdef DRING
    611 //  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 #endif
    626547  if (strat->sugarCrit)
    627548  {
    628549    if(
    629 #ifdef SDRING
    630     (!pSDRING) &&
    631 #endif
    632550    (!((strat->ecartS[i]>0)&&(ecart>0)))
    633551    && pHasNotCF(p,strat->S[i]))
     
    665583    *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
    666584    */
    667 #ifdef SDRING
    668     if (!pSDRING)
    669 #endif
    670585    {
    671586      j = strat->Bl;
     
    699614  {
    700615    if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
    701 #ifdef SDRING
    702     (!pSDRING) &&
    703 #endif
    704616    pHasNotCF(p,strat->S[i]))
    705617    {
     
    734646    *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
    735647    */
    736 #ifdef SDRING
    737     if (!pSDRING)
    738 #endif
    739648    for(j = strat->Bl;j>=0;j--)
    740649    {
     
    769678    Lp.p=NULL;
    770679  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);
    783682  }
    784683  if (Lp.p == NULL)
     
    814713    enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
    815714  }
    816 #ifdef DRING
    817   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 #endif
    833715}
    834716
     
    845727  pLcm(p,strat->S[i],Lp.lcm);
    846728  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]))
    852730  {
    853731    strat->cp++;
     
    873751  /*-  compute the short s-polynomial -*/
    874752
    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);
    888754  if (Lp.p == NULL)
    889755  {
     
    904770    enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
    905771  }
    906 #ifdef DRING
    907   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 #endif
    923772}
    924773
     
    938787  if (strat->pairtest!=NULL)
    939788  {
    940 #ifdef SDRING
    941     if (!pSDRING)
    942 #endif
    943789    {
    944790      /*- i.e. there is an i with pairtest[i]==TRUE -*/
     
    961807    strat->pairtest=NULL;
    962808  }
    963   if ((strat->Gebauer || strat->fromT)
    964 #ifdef SDRING
    965   && (!pSDRING)
    966 #endif
    967   )
     809  if (strat->Gebauer || strat->fromT)
    968810  {
    969811    if (strat->sugarCrit)
     
    1074916  else
    1075917  {
    1076 #ifdef SDRING
    1077     if (!pSDRING)
    1078 #endif
    1079918    for (j=strat->Ll; j>=0; j--)
    1080919    {
     
    1109948    strat->Bl = -1;
    1110949    j = strat->Ll;
    1111 #ifdef SDRING
    1112     if (!pSDRING)
    1113 #endif
    1114950    loop  /*cannot be changed into a for !!! */
    1115951    {
     
    23512187      )
    23522188      {
    2353         spSpolyTail(strat->S[j], p, h, strat->kNoether, strat->spSpolyLoop);
     2189        ksOldSpolyTail(strat->S[j], p, h, strat->kNoether);
    23542190        hn = pNext(h);
    23552191        if (hn == NULL)
     
    23962232      {
    23972233        strat->redTailChange=TRUE;
    2398         spSpolyTail(strat->S[j], p, h, strat->kNoether, strat->spSpolyLoop);
     2234        ksOldSpolyTail(strat->S[j], p, h, strat->kNoether);
    23992235        hn = pNext(h);
    24002236        if (hn == NULL)
     
    24372273      if (pDivisibleBy(strat->S[j], hn) && (!pEqual(strat->S[j],h)))
    24382274      {
    2439         spSpolyTail(strat->S[j], p, h, strat->kNoether, strat->spSpolyLoop);
     2275        ksOldSpolyTail(strat->S[j], p, h, strat->kNoether);
    24402276        hn = pNext(h);
    24412277        if (hn == NULL)
     
    25442380  LObject h;
    25452381  int   i,pos;
    2546 #ifdef SDRING
    2547   polyset aug=(polyset)Alloc(setmax*sizeof(poly));
    2548   int augmax=setmax, augl=-1;
    2549 #endif
    25502382
    25512383  h.ecart=0; h.length=0;
     
    26002432    {
    26012433      h.p = pCopy(F->m[i]);
    2602 #ifdef SDRING
    2603       aug[0]=h.p;
    2604       augl=0;
    2605 #ifdef SRING
    2606       if (pSRING)
    2607         psAug(pCopy(h.p),pOne(),&aug,&augl,&augmax);
    2608 #endif
    2609 #ifdef DRING
    2610       if (pDRING)
    2611         pdAug(pCopy(h.p),&aug,&augl,&augmax);
    2612 #endif
    2613       for (augl++;augl != 0;)
    2614       {
    2615         h.p=aug[--augl];
    2616 #ifdef KDEBUG
    2617         pHeapTest(h.p, h.heap);
    2618 #endif
    2619 #ifdef KDEBUG
    2620         if (TEST_OPT_DEBUG && pSDRING)
    2621         {
    2622           PrintS("new (aug) s:");
    2623           wrp(h.p);
    2624           PrintLn();
    2625         }
    2626 #endif
    2627 #endif
    26282434        if (TEST_OPT_INTSTRATEGY)
    26292435        {
     
    26562462          strat->enterS(h,pos,strat);
    26572463        }
    2658 #ifdef SDRING
    2659       }
    2660 #endif
    26612464    }
    26622465  }
     
    26662469    while (strat->sl>0) deleteInS(strat->sl,strat);
    26672470  }
    2668 #ifdef SDRING
    2669   Free((ADDRESS)aug,augmax*sizeof(poly));
    2670 #endif
    26712471}
    26722472
     
    26752475  LObject h;
    26762476  int   i,pos;
    2677 #ifdef SDRING
    2678   polyset aug=(polyset)Alloc(setmax*sizeof(poly));
    2679   int augmax=setmax, augl=-1;
    2680 #endif
    26812477
    26822478  h.ecart=0; h.length=0;
     
    27342530      h.p2=NULL;
    27352531      h.lcm=NULL;
    2736 #ifdef SDRING
    2737       aug[0]=h.p;
    2738       augl=0;
    2739 #ifdef SRING
    2740       if (pSRING)
    2741         psAug(pCopy(h.p),pOne(),&aug,&augl,&augmax);
    2742 #endif
    2743 #ifdef DRING
    2744       if (pDRING)
    2745         pdAug(pCopy(h.p),&aug,&augl,&augmax);
    2746 #endif
    2747       for (augl++;augl != 0;)
    2748       {
    2749         h.p=aug[--augl];
    2750 #ifdef KDEBUG
    2751         pTest(h.p);
    2752 #endif
    2753 #ifdef SDRING
    2754         if (TEST_OPT_DEBUG && pSDRING)
    2755         {
    2756           PrintS("new (aug) s:");
    2757           wrp(h.p);
    2758           PrintLn();
    2759         }
    2760 #endif
    2761 #endif
    27622532        if (TEST_OPT_INTSTRATEGY)
    27632533        {
     
    27902560          enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
    27912561        }
    2792 #ifdef SDRING
    2793       }
    2794 #endif
    27952562    }
    27962563  }
     
    28002567    while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
    28012568  }
    2802 #ifdef SDRING
    2803   Free((ADDRESS)aug,augmax*sizeof(poly));
    2804 #endif
    28052569}
    28062570
     
    28132577  LObject h;
    28142578  int   i,pos;
    2815 #ifdef SDRING
    2816   polyset aug=(polyset)Alloc(setmax*sizeof(poly));
    2817   int augmax=setmax, augl=-1;
    2818 #endif
    28192579
    28202580  h.ecart=0; h.length=0;
     
    29502710    }
    29512711  }
    2952 #ifdef SDRING
    2953   Free((ADDRESS)aug,augmax*sizeof(poly));
    2954 #endif
    29552712}
    29562713/*2
     
    29652722  {
    29662723    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);
    29682725    else j++;
    29692726  }
     
    30382795    if (pDivisibleBy(strat->S[j],h))
    30392796    {
    3040       h = spSpolyRed(strat->S[j],h,strat->kNoether, strat->spSpolyLoop);
     2797      h = ksOldSpolyRed(strat->S[j],h,strat->kNoether);
    30412798      if (h==NULL) return NULL;
    30422799      j = start;
     
    30592816    if (pDivisibleBy(strat->S[j],h))
    30602817    {
    3061       h = spSpolyRed(strat->S[j],h,strat->kNoether, strat->spSpolyLoop);
     2818      h = ksOldSpolyRed(strat->S[j],h,strat->kNoether);
    30622819      if (h==NULL) return NULL;
    30632820      j = 0;
     
    30872844      && ((e >= strat->ecartS[j]) || strat->kHEdgeFound))
    30882845      {
    3089         h1 = spSpolyRedNew(strat->S[j],h,strat->kNoether, strat->spSpolyLoop);
     2846        h1 = ksOldSpolyRedNew(strat->S[j],h,strat->kNoether);
    30902847        if(TEST_OPT_DEBUG)
    30912848        {
     
    31162873  int i, suc=0;
    31172874  poly redSi=NULL;
    3118 #ifdef SDRING
    3119   polyset aug=(polyset)Alloc(setmax*sizeof(poly));
    3120   int augmax=setmax;
    3121   int augl;
    3122   int pos;
    3123   BOOLEAN recursiv=FALSE;
    3124 #endif
    31252875
    31262876//Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
     
    31662916            i--;
    31672917          }
    3168 #ifdef SDRING
    3169           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 SRING
    3180             if (pSRING) psAug(pCopy(redSi),pOne(),&aug,&augl,&augmax);
    3181 #endif
    3182 #ifdef DRING
    3183             if (pDRING) pdAug(pCopy(redSi),&aug,&augl,&augmax);
    3184 #endif
    3185             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 pContent
    3203                 }
    3204                 else
    3205                 {
    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 #endif
    32162918          else
    32172919          {
     
    32372939      {
    32382940        if (((strat->fromQ==NULL) || (strat->fromQ[i]==0))
    3239 #ifdef SDRING
    3240         && (!pSDRING)
    3241 #endif
    32422941        )
    32432942          h.p = redtailBba(strat->S[i],i-1,strat);
     
    32752974            i--;
    32762975          }
    3277 #ifdef SDRING
    3278           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 SRING
    3288             if (pSRING) psAug(pCopy(redSi),pOne(),&aug,&augl,&augmax);
    3289 #endif
    3290 #ifdef DRING
    3291             if (pDRING) pdAug(pCopy(redSi),&aug,&augl,&augmax);
    3292 #endif
    3293             redSi=NULL;
    3294             if (augl>0) recursiv=TRUE;
    3295             for (augl++;augl != 0;)
    3296             {
    3297               h.p=aug[--augl];
    3298 #ifdef KDEBUG
    3299               if (TEST_OPT_DEBUG)
    3300               {
    3301                 PrintS("new (aug) s:");
    3302                 wrp(h.p);
    3303                 PrintLn();
    3304               }
    3305 #endif
    3306               if (!TEST_OPT_INTSTRATEGY)
    3307                 pNorm(h.p);
    3308               else
    3309               {
    3310                 //pContent(h.p);
    3311                 pCleardenom(h.p);// also does a pContent
    3312               }
    3313               strat->initEcart(&h);
    3314               pos = posInS(strat->S,strat->sl,h.p);
    3315               strat->enterS(h,pos,strat);
    3316             }
    3317           }
    3318 #endif
    33192976          else if (TEST_OPT_INTSTRATEGY)
    33202977          {
     
    33543011    {
    33553012      if (((strat->fromQ==NULL) || (strat->fromQ[i]==0))
    3356 #ifdef SDRING
    3357       && (!pSDRING)
    3358 #endif
    33593013      )
    33603014      {
     
    33763030  }
    33773031  if (redSi!=NULL) pDelete1(&redSi);
    3378 #ifdef SDRING
    3379   Free((ADDRESS)aug,augmax*sizeof(poly));
    3380   if (recursiv) updateS(FALSE,strat);
    3381 #endif
    33823032#ifdef KDEBUG
    33833033  kTest(strat);
     
    33933043  int i;
    33943044
    3395 #ifdef SDRING
    3396   if (pSDRING
    3397   && (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 (pSDRING
    3406   && (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 (pSDRING
    3415   && (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 #endif
    34243045  strat->news = TRUE;
    34253046  /*- puts p to the standardbasis s at position at -*/
     
    36643285  else
    36653286  {
    3666     #ifdef SDRING
    3667     if (
    3668     #ifdef SRING
    3669         pSRING ||
    3670     #endif
    3671     #ifdef DRING
    3672         pDRING ||
    3673     #endif
    3674         0)
    3675          initS(F, Q,strat); /*sets also S, ecartS, fromQ */
    3676     else
    3677     #endif
    36783287    /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
    36793288    // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
  • Singular/kutil.h

    rc88c949 rd14712  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kutil.h,v 1.15 1999-09-27 14:57:12 obachman Exp $ */
     6/* $Id: kutil.h,v 1.16 1999-09-29 10:59:32 obachman Exp $ */
    77/*
    88* ABSTRACT: kernel: utils for kStd
     
    6868    int (*posInLOld)(const LSet Ls,const int Ll,
    6969                     const LObject &Lo,const kStrategy strat);
    70     void (*spSpolyLoop)(poly p1, poly p2, poly m, poly spNoether);
    7170    pFDegProc pOldFDeg;
    7271    ideal Shdl;
     
    173172BOOLEAN newHEdge(polyset S, int ak,kStrategy strat);
    174173
    175 rOrderType_t spGetOrderType(ring r, int modrank, int syzcomp);
    176 extern int spCheckCoeff(number *a, number *b);
    177 
    178174inline TSet initT () { return (TSet)Alloc0(setmax*sizeof(TObject)); }
    179175
     
    197193#endif
    198194
     195/***************************************************************
     196 *
     197 * From kstd2.cc
     198 *
     199 ***************************************************************/
     200ideal bba (ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat);
     201poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce);
     202ideal kNF2 (ideal F,ideal Q,ideal q, kStrategy strat, int lazyReduce);
     203void 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)
     215void 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
     225void 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
     234void 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*/
     245poly 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*/
     259int ksCheckCoeff(number *a, number *b);
     260
     261// old stuff
     262poly ksOldSpolyRed(poly p1, poly p2, poly spNoether = NULL);
     263poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether = NULL);
     264poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether = NULL);
     265void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether);
    199266
    200267#ifdef HAVE_SHORT_EVECTORS
  • Singular/mmheap.h

    rc88c949 rd14712  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: mmheap.h,v 1.9 1999-09-27 15:05:25 obachman Exp $ */
     6/* $Id: mmheap.h,v 1.10 1999-09-29 10:59:33 obachman Exp $ */
    77#include <stdlib.h>
    88#include "mod2.h"
     
    5656 *
    5757 *****************************************************************/
    58 
    5958#ifndef HEAP_DEBUG
    6059
     
    8988 
    9089#endif
     90/* use this for unknown heaps */
     91#define MM_UNKNOWN_HEAP ((memHeap) 1)
    9192
    9293/*****************************************************************
  • Singular/mod2.h.in

    rc88c949 rd14712  
    55 *          DO NOT EDIT!
    66 *
    7  *  Version: $Id: mod2.h.in,v 1.68 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 $
    88 *******************************************************************/
    99#ifndef MOD2_H
     
    157157/* Define to enable TCL interface */
    158158#undef HAVE_TCL
    159 /* Define to enable working in Weyl algebras */
    160 #undef DRING
    161 /* Define to enable working in exterior algebras */
    162 #undef SRING
    163159
    164160/* Undefine to disable Gerhard's and Wilfried's fast and dirty std computations */
     
    244240
    245241#define SINGULAR_VERSION (SINGULAR_MAJOR_VERSION*1000 + SINGULAR_MINOR_VERSION*100 + SINGULAR_SUB_VERSION)
    246 #ifdef DRING
    247 #define SDRING
    248 #endif
    249 
    250 #ifdef SRING
    251 #define SDRING
    252 #endif
    253242
    254243#if SIZEOF_EXPONENT == 1
     
    365354#endif
    366355
    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
    373378/* define LDEBUG checking numbers, undefine otherwise */
    374379#define LDEBUG
  • Singular/mpsr_Error.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mpsr_Error.cc,v 1.9 1999-09-27 15:05:26 obachman Exp $ */
     4/* $Id: mpsr_Error.cc,v 1.10 1999-09-29 10:59:34 obachman Exp $ */
    55
    66/***************************************************************
     
    5454{
    5555  mpsr_SetError(mpsr_MP_Failure);
    56   mpsr_MP_errno = link->MP_errno;
     56  mpsr_MP_errno = (enum MP_Errors) link->MP_errno;
    5757  return mpsr_MP_Failure;
    5858}
  • Singular/numbers.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR      *
    33*****************************************/
    4 /* $Id: numbers.cc,v 1.19 1999-09-16 12:34:00 Singular Exp $ */
     4/* $Id: numbers.cc,v 1.20 1999-09-29 10:59:34 obachman Exp $ */
    55
    66/*
     
    2121#include "gnumpc.h"
    2222#include "ring.h"
    23 #ifndef FAST_AND_DIRTY
    24 #undef npMultM
    25 #undef npSubM
    26 #undef npNegM
    27 #undef npEqualM
    28 #endif
    2923#include "ffields.h"
    3024#include "shortfl.h"
  • Singular/numbers.h

    rc88c949 rd14712  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: numbers.h,v 1.9 1999-09-16 12:34:01 Singular Exp $ */
     6/* $Id: numbers.h,v 1.10 1999-09-29 10:59:34 obachman Exp $ */
    77/*
    88* ABSTRACT: interface to coefficient aritmetics
     
    6868void nSetChar(ring r, BOOLEAN complete);
    6969
    70 #ifndef FAST_AND_DIRTY
    71 #define npMultM  nMult
    72 #define npSubM   nSub
    73 #define npNegM   nNeg
    74 #define npEqualM nEqual
    7570#endif
    76 
    77 #endif
  • Singular/polys-comp.h

    rc88c949 rd14712  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys-comp.h,v 1.11 1999-09-27 15:05:28 obachman Exp $ */
     6/* $Id: polys-comp.h,v 1.12 1999-09-29 10:59:35 obachman Exp $ */
    77
    88/***************************************************************
     
    358358{
    359359  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]);
    363363
    364364  for (;;)
  • Singular/polys-impl.h

    rc88c949 rd14712  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys-impl.h,v 1.34 1999-09-29 09:52:38 Singular Exp $ */
     6/* $Id: polys-impl.h,v 1.35 1999-09-29 10:59:36 obachman Exp $ */
    77
    88/***************************************************************
     
    4141typedef Exponent_t* Exponent_pt;
    4242
    43 typedef long Order_t;
     43typedef unsigned long Order_t;
    4444struct  spolyrec
    4545{
     
    324324{
    325325  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]);
    328328  for (;;)
    329329  {
     
    345345{
    346346  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]);
    349349
    350350  for (;;)
     
    367367#endif // defined(PDEBUG) && PDEBUG > 1
    368368{
    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;
    373373
    374374  p1->next = p2->next;
     
    484484DECLARE(BOOLEAN, _pEqual(poly p1, poly p2))
    485485{
    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;
    489489
    490490  for(;;)
  • Singular/polys.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys.cc,v 1.42 1999-09-28 15:02:32 obachman Exp $ */
     4/* $Id: polys.cc,v 1.43 1999-09-29 10:59:36 obachman Exp $ */
    55
    66/*
     
    5454/* 1 for c ordering, -1 otherwise (i.e. for C ordering) */
    5555int  pComponentOrder;
    56 
    57 #ifdef DRING
    58 int      p2;
    59 BOOLEAN  pDRING=FALSE;
    60 #endif
    61 
    62 #ifdef SRING
    63 int      pAltVars;
    64 BOOLEAN  pSRING=FALSE;
    65 #endif
    66 
    67 #ifdef SDRING
    68 BOOLEAN  pSDRING=FALSE;
    69 #include "polys.inc"
    70 #endif
    7156
    7257/* ----------- global variables, set by procedures from hecke/kstd1 ----- */
     
    719704  pComponentOrder=1;
    720705  if (ppNoether!=NULL) pDelete(&ppNoether);
    721 #ifdef SRING
    722   pSRING=FALSE;
    723   pAltVars=r->N+1;
    724 #endif
    725706  pVariables = r->N;
    726707
     
    861842  poly aa=a;
    862843  poly prev=NULL;
    863 #ifdef SDRING
    864   poly pDRINGres=NULL;
    865 #endif
    866844
    867845  pMultT_nok = pGetComp(exp);
     
    883861    else
    884862    {
    885 #ifdef DRING
    886       if (pDRING)
    887       {
    888          if (pdDFlag(a)==1)
    889          {
    890            if (pdDFlag(exp)==1)
    891            {
    892              pDRINGres=pAdd(pDRINGres,pMultDD(a,exp));
    893            }
    894            else
    895            {
    896              pDRINGres=pAdd(pDRINGres,pMultDT(a,exp));
    897            }
    898          }
    899          else
    900          {
    901            if (pdDFlag(exp)==1)
    902            {
    903              pDRINGres=pAdd(pDRINGres,pMultDD(a,exp));
    904            }
    905            else
    906            {
    907              pDRINGres=pAdd(pDRINGres,pMultTT(a,exp));
    908            }
    909          }
    910       }
    911       else
    912 #endif
    913 #ifdef SRING
    914       if (pSRING)
    915       {
    916         pDRINGres=pAdd(pDRINGres,psMultM(a,exp));
    917       }
    918       else
    919 #endif
    920863      {
    921864        if (pMultT_nok)  /* comp of exp != 0 */
     
    933876  }
    934877  pMultT_nok=0;
    935 #ifdef SDRING
    936   if (
    937   #ifdef DRING
    938   pDRING ||
    939   #endif
    940   #ifdef SRING
    941   pSRING ||
    942   #endif
    943   0 )
    944   {
    945     pDelete(&aa);
    946     pTest(pDRINGres);
    947     return pDRINGres;
    948   }
    949 #endif
    950878  pTest(aa);
    951879  return aa; /*TRUE*/
     
    11871115  else
    11881116  {
    1189 #ifdef DRING
    1190     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 #endif
    12021117    pSetm(rc);
    12031118  }
     
    15891504BOOLEAN pHasNotCF(poly p1, poly p2)
    15901505{
    1591 #ifdef SRING
    1592   if (pSRING)
    1593     return FALSE;
    1594 #endif
    15951506
    15961507  if (pGetComp(p1) > 0 || pGetComp(p2) > 0)
  • Singular/polys.h

    rc88c949 rd14712  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys.h,v 1.23 1999-09-28 15:01:20 obachman Exp $ */
     6/* $Id: polys.h,v 1.24 1999-09-29 10:59:37 obachman Exp $ */
    77/*
    88* ABSTRACT - all basic methods to manipulate polynomials
     
    2020extern int pComponentOrder;
    2121
    22 #ifdef DRING
    23 // D=k[x,d,y] is the Weyl-Algebra [y], y commuting with all others
    24 // M=k[x,x^(-1),y] is a D-module
    25 // 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)==0
    35 // a monomial m belongs to an ideal in the Weyl-Algebra D iff pdDFlag(m)==1
    36 #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 #endif
    48 #ifdef SRING
    49 extern int      pAltVars;
    50 extern BOOLEAN  pSRING;
    51 #endif
    52 #ifdef SDRING
    53 void   psAug(poly q, poly done, polyset *s, int *l, int *m);
    54 void   pdAug(poly q, polyset *s, int *l, int *m);
    55 #endif
    56 #ifdef SDRING
    57 extern BOOLEAN pSDRING;
    58 #endif
    59 
    6022/* function prototypes */
    6123
     
    12183BOOLEAN   pHasNotCF(poly p1, poly p2);   /*has no common factor ?*/
    12284void      pSplit(poly p, poly * r);   /*p => IN(p), r => REST(p) */
     85// Returns TRUE if m is monom of p, FALSE otherwise
     86BOOLEAN pIsMonomOf(poly p, poly m);
    12387
    12488
     
    349313// This is something weird -- Don't use it, unless you know what you are doing
    350314poly      pTakeOutComp(poly * p, int k);
     315void      pSetPolyComp(poly p, int comp);
    351316void      pDeleteComp(poly * p,int k);
    352317void      pNorm(poly p);
     
    375340// tests (see polys-impl.cc )
    376341unsigned long pGetShortExpVector(poly p);
     342
     343
    377344
    378345
  • Singular/polys0.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys0.cc,v 1.11 1999-09-27 15:05:31 obachman Exp $ */
     4/* $Id: polys0.cc,v 1.12 1999-09-29 10:59:37 obachman Exp $ */
    55
    66/*
     
    3535    && (!nIsMOne(pGetCoeff(p)))
    3636  )
    37 #ifdef DRING
    38   || (pDRING && pdIsConstantComp(p))
    39 #endif
    4037  )
    4138  {
     
    5956  for (i=0; i<pVariables; i++)
    6057  {
    61 #ifdef DRING
    62     if ((!pDRING)||(i!=2*pdN))
    63 #endif
    6458    {
    6559      Exponent_t ee = pGetExp(p,i+1);
     
    7165          wroteCoef=(pShortOut==0);
    7266        writeGen=TRUE;
    73 #ifdef DRING
    74         if((pDRING)&&(pdN<=i)&&(i<2*pdN)&&(pdDFlag(p)==0))
    75         {
    76           StringAppendS(RingVar(i-pdN));
    77           ee=-ee;
    78         }
    79         else
    80           StringAppendS(RingVar(i));
    81 #else
    8267        StringAppendS(RingVar(i));
    83 #endif
    8468        if (ee != 1)
    8569        {
  • Singular/polys1.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys1.cc,v 1.28 1999-09-28 15:02:33 obachman Exp $ */
     4/* $Id: polys1.cc,v 1.29 1999-09-29 10:59:38 obachman Exp $ */
    55
    66/*
     
    7777  }
    7878  return k;
     79}
     80
     81BOOLEAN 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;
    7990}
    8091
     
    478489          }
    479490        }
    480 #ifdef SDRING
    481         if(pSDRING)
    482         {
    483           return pPow(p,i);
    484         }
    485         else
    486 #endif
    487491        {
    488492          rc = pNext(p);
  • Singular/ring.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ring.cc,v 1.65 1999-09-27 14:39:25 obachman Exp $ */
     4/* $Id: ring.cc,v 1.66 1999-09-29 10:59:38 obachman Exp $ */
    55
    66/*
     
    2222#include "longalg.h"
    2323#include "ffields.h"
    24 #include "spolys.h"
    2524#include "subexpr.h"
    2625#include "ideals.h"
     
    5352// complete == FALSE : only delete operations are enabled
    5453// complete == TRUE  : full reset of all variables
    55 #ifdef DRING
    56 void rChangeCurrRing(ring r, BOOLEAN complete, idhdl h)
    57 #else
    5854void rChangeCurrRing(ring r, BOOLEAN complete)
    59 #endif
    6055{
    6156  /*------------ set global ring vars --------------------------------*/
     
    8984      }
    9085
    91 #ifdef DRING
    92       pDRING=FALSE;
    93       pSDRING=FALSE;
    94       if ((h!=NULL) && (hasFlag(h,FLAG_DRING))) rDSet();
    95 #endif // DRING
    96 
    97 #ifdef SRING
    98       if ((currRing->partN<=currRing->N)
    99 #ifdef DRING
    100           && ((h==NULL) || (!hasFlag(h,FLAG_DRING)))
    101 #endif
    102           )
    103       {
    104         pAltVars=currRing->partN;
    105         pSRING=TRUE;
    106         pSDRING=TRUE;
    107       }
    108       else
    109       {
    110         pAltVars=currRing->N+1;
    111       }
    112 #endif // SRING
    113 
    11486    /*------------ set spolys ------------------------------------------*/
    115       spSet(r);
    11687    }
    11788  }
     
    140111
    141112   /*------------ change the global ring -----------------------*/
    142   #ifdef DRING
    143   rChangeCurrRing(rg,complete,h);
    144   #else
    145113  rChangeCurrRing(rg,complete);
    146   #endif
    147114  currRingHdl = h;
    148115
     
    206173  r->N     = 3;
    207174  /*r->P     = 0; Alloc0 in idhdl::set, ipid.cc*/
    208 #ifdef SRING
    209   r->partN = 4;
    210 #endif
    211175  /*names*/
    212176  r->names = (char **) Alloc(3 * sizeof(char *));
     
    650614 s: name, chr: ch, varnames: rv, ordering: ord, typ: typ
    651615 */
    652 #ifdef DRING
    653 void rDSet()
    654 {
    655   pDRING=TRUE;
    656   pSDRING=TRUE;
    657   pdN=currRing->partN;
    658   pdK=pVariables-pdN*2-1;
    659 }
    660 #endif
    661616
    662617int rIsRingVar(char *n)
     
    24092364  r->ExpLSize=j/(sizeof(long)/sizeof(Exponent_t));
    24102365  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 
    24112375
    24122376  // ----------------------------
  • Singular/ring.h

    rc88c949 rd14712  
    77* ABSTRACT - the interpreter related ring operations
    88*/
    9 /* $Id: ring.h,v 1.33 1999-09-27 14:39:26 obachman Exp $ */
     9/* $Id: ring.h,v 1.34 1999-09-29 10:59:39 obachman Exp $ */
    1010
    1111/* includes */
     
    1616
    1717
    18 #ifdef DRING
    19 void   rChangeCurrRing(ring r, BOOLEAN complete = TRUE, idhdl h = NULL);
    20 #else
    2118void   rChangeCurrRing(ring r, BOOLEAN complete = TRUE);
    22 #endif
    2319void   rSetHdl(idhdl h, BOOLEAN complete = TRUE);
    2420idhdl  rInit(char *s, sleftv* pn, sleftv* rv, sleftv* ord);
     
    5147
    5248idhdl  rFindHdl(ring r, idhdl n, idhdl w);
    53 #ifdef DRING
    54 void rDSet();
    55 #endif
    5649void   rDInit();
    5750int 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_nwEVEN
    6 (poly a1, poly a2, poly monom, poly spNoether)
    7 {
    8   poly a = monom,                         // collects the result
    9        b = NULL,                          // stores a1*monom
    10        c;                                 // used for temporary storage
    11   number tm   = pGetCoeff(monom),         // coefficient of monom
    12          tneg = npNegM(tm),        // - (coefficient of monom)
    13          tb,                              // used for tm*coeff(a1)
    14          tc;                              // used for intermediate coeff
    15 
    16   Order_t order;                          // used for homog case
    17 
    18   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    19   b = pNew();   
    20 
    21   ;              // inits order for homog case
    22  
    23 
    24   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    25 
    26   // MAIN LOOP:
    27   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    28     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 a2
    36     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 a2
    44       a = pNext(a) = a2; // append a2 to result and advance a2
    45       pIter(a2);
    46     }
    47     else
    48     { // coeffs are equal, so their difference is 0:
    49       c = a2;  // do not append anything to result: Delete a2 and advance
    50       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*monom
    58     goto Top;
    59 
    60   NotEqual:     // b != a2
    61     if (d < 0)  // b < a2:
    62     {
    63       assume(pComp0(b, a2) == -1);
    64       a = pNext(a) = a2;// append a2 to result and advance a2
    65       pIter(a2);
    66       if (a2==NULL) goto Finish;;
    67       goto Top;
    68     }
    69     else // now d >= 0, i.e., b > a2
    70     {
    71       assume(pComp0(b, a2) == 1);
    72       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    73       a = pNext(a) = b;       // append b to result and advance a1
    74       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*monom
    82       goto Top;
    83     }
    84  
    85  Finish: // a1 or a2 is NULL: Clean-up time
    86    assume(a1 == NULL || a2 == NULL);
    87    if (a1 == NULL) // append rest of a2 to result
    88      pNext(a) = a2;
    89    else  // append (- a1*monom) to result
    90      spMultCopyX(a1, monom, a, tneg, spNoether);
    91    ;
    92    if (b != NULL) pFree1(b);
    93 }
    94 static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwODD
    95 (poly a1, poly a2, poly monom, poly spNoether)
    96 {
    97   poly a = monom,                         // collects the result
    98        b = NULL,                          // stores a1*monom
    99        c;                                 // used for temporary storage
    100   number tm   = pGetCoeff(monom),         // coefficient of monom
    101          tneg = npNegM(tm),        // - (coefficient of monom)
    102          tb,                              // used for tm*coeff(a1)
    103          tc;                              // used for intermediate coeff
    104 
    105   Order_t order;                          // used for homog case
    106 
    107   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    108   b = pNew();   
    109 
    110   ;              // inits order for homog case
    111  
    112 
    113   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    114 
    115   // MAIN LOOP:
    116   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    117     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 a2
    125     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 a2
    133       a = pNext(a) = a2; // append a2 to result and advance a2
    134       pIter(a2);
    135     }
    136     else
    137     { // coeffs are equal, so their difference is 0:
    138       c = a2;  // do not append anything to result: Delete a2 and advance
    139       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*monom
    147     goto Top;
    148 
    149   NotEqual:     // b != a2
    150     if (d < 0)  // b < a2:
    151     {
    152       assume(pComp0(b, a2) == -1);
    153       a = pNext(a) = a2;// append a2 to result and advance a2
    154       pIter(a2);
    155       if (a2==NULL) goto Finish;;
    156       goto Top;
    157     }
    158     else // now d >= 0, i.e., b > a2
    159     {
    160       assume(pComp0(b, a2) == 1);
    161       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    162       a = pNext(a) = b;       // append b to result and advance a1
    163       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*monom
    171       goto Top;
    172     }
    173  
    174  Finish: // a1 or a2 is NULL: Clean-up time
    175    assume(a1 == NULL || a2 == NULL);
    176    if (a1 == NULL) // append rest of a2 to result
    177      pNext(a) = a2;
    178    else  // append (- a1*monom) to result
    179      spMultCopyX(a1, monom, a, tneg, spNoether);
    180    ;
    181    if (b != NULL) pFree1(b);
    182 }
    183 static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwONE
    184 (poly a1, poly a2, poly monom, poly spNoether)
    185 {
    186   poly a = monom,                         // collects the result
    187        b = NULL,                          // stores a1*monom
    188        c;                                 // used for temporary storage
    189   number tm   = pGetCoeff(monom),         // coefficient of monom
    190          tneg = npNegM(tm),        // - (coefficient of monom)
    191          tb,                              // used for tm*coeff(a1)
    192          tc;                              // used for intermediate coeff
    193 
    194   Order_t order;                          // used for homog case
    195 
    196   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    197   b = pNew();   
    198 
    199   ;              // inits order for homog case
    200  
    201 
    202   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    203 
    204   // MAIN LOOP:
    205   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    206     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 a2
    214     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 a2
    222       a = pNext(a) = a2; // append a2 to result and advance a2
    223       pIter(a2);
    224     }
    225     else
    226     { // coeffs are equal, so their difference is 0:
    227       c = a2;  // do not append anything to result: Delete a2 and advance
    228       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*monom
    236     goto Top;
    237 
    238   NotEqual:     // b != a2
    239     if (d < 0)  // b < a2:
    240     {
    241       assume(pComp0(b, a2) == -1);
    242       a = pNext(a) = a2;// append a2 to result and advance a2
    243       pIter(a2);
    244       if (a2==NULL) goto Finish;;
    245       goto Top;
    246     }
    247     else // now d >= 0, i.e., b > a2
    248     {
    249       assume(pComp0(b, a2) == 1);
    250       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    251       a = pNext(a) = b;       // append b to result and advance a1
    252       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*monom
    260       goto Top;
    261     }
    262  
    263  Finish: // a1 or a2 is NULL: Clean-up time
    264    assume(a1 == NULL || a2 == NULL);
    265    if (a1 == NULL) // append rest of a2 to result
    266      pNext(a) = a2;
    267    else  // append (- a1*monom) to result
    268      spMultCopyX(a1, monom, a, tneg, spNoether);
    269    ;
    270    if (b != NULL) pFree1(b);
    271 }
    272 static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwTWO
    273 (poly a1, poly a2, poly monom, poly spNoether)
    274 {
    275   poly a = monom,                         // collects the result
    276        b = NULL,                          // stores a1*monom
    277        c;                                 // used for temporary storage
    278   number tm   = pGetCoeff(monom),         // coefficient of monom
    279          tneg = npNegM(tm),        // - (coefficient of monom)
    280          tb,                              // used for tm*coeff(a1)
    281          tc;                              // used for intermediate coeff
    282 
    283   Order_t order;                          // used for homog case
    284 
    285   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    286   b = pNew();   
    287 
    288   ;              // inits order for homog case
    289  
    290 
    291   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    292 
    293   // MAIN LOOP:
    294   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    295     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 a2
    303     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 a2
    311       a = pNext(a) = a2; // append a2 to result and advance a2
    312       pIter(a2);
    313     }
    314     else
    315     { // coeffs are equal, so their difference is 0:
    316       c = a2;  // do not append anything to result: Delete a2 and advance
    317       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*monom
    325     goto Top;
    326 
    327   NotEqual:     // b != a2
    328     if (d < 0)  // b < a2:
    329     {
    330       assume(pComp0(b, a2) == -1);
    331       a = pNext(a) = a2;// append a2 to result and advance a2
    332       pIter(a2);
    333       if (a2==NULL) goto Finish;;
    334       goto Top;
    335     }
    336     else // now d >= 0, i.e., b > a2
    337     {
    338       assume(pComp0(b, a2) == 1);
    339       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    340       a = pNext(a) = b;       // append b to result and advance a1
    341       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*monom
    349       goto Top;
    350     }
    351  
    352  Finish: // a1 or a2 is NULL: Clean-up time
    353    assume(a1 == NULL || a2 == NULL);
    354    if (a1 == NULL) // append rest of a2 to result
    355      pNext(a) = a2;
    356    else  // append (- a1*monom) to result
    357      spMultCopyX(a1, monom, a, tneg, spNoether);
    358    ;
    359    if (b != NULL) pFree1(b);
    360 }
    361 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwEVEN
    362 (poly a1, poly a2, poly monom, poly spNoether)
    363 {
    364   poly a = monom,                         // collects the result
    365        b = NULL,                          // stores a1*monom
    366        c;                                 // used for temporary storage
    367   number tm   = pGetCoeff(monom),         // coefficient of monom
    368          tneg = npNegM(tm),        // - (coefficient of monom)
    369          tb,                              // used for tm*coeff(a1)
    370          tc;                              // used for intermediate coeff
    371 
    372   Order_t order;                          // used for homog case
    373 
    374   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    375   b = pNew();   
    376 
    377   order = pGetOrder(a2);              // inits order for homog case
    378  
    379 
    380   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    381 
    382   // MAIN LOOP:
    383   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    384     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 a2
    390     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 a2
    398       a = pNext(a) = a2; // append a2 to result and advance a2
    399       pIter(a2);
    400     }
    401     else
    402     { // coeffs are equal, so their difference is 0:
    403       c = a2;  // do not append anything to result: Delete a2 and advance
    404       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*monom
    412     goto Top;
    413 
    414   NotEqual:     // b != a2
    415     if (d < 0)  // b < a2:
    416     {
    417       assume(pComp0(b, a2) == -1);
    418       a = pNext(a) = a2;// append a2 to result and advance a2
    419       pIter(a2);
    420       if (a2==NULL) goto Finish;;
    421       goto Top;
    422     }
    423     else // now d >= 0, i.e., b > a2
    424     {
    425       assume(pComp0(b, a2) == 1);
    426       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    427       a = pNext(a) = b;       // append b to result and advance a1
    428       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*monom
    436       goto Top;
    437     }
    438  
    439  Finish: // a1 or a2 is NULL: Clean-up time
    440    assume(a1 == NULL || a2 == NULL);
    441    if (a1 == NULL) // append rest of a2 to result
    442      pNext(a) = a2;
    443    else  // append (- a1*monom) to result
    444      spMultCopyX(a1, monom, a, tneg, spNoether);
    445    ;
    446    if (b != NULL) pFree1(b);
    447 }
    448 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwODD
    449 (poly a1, poly a2, poly monom, poly spNoether)
    450 {
    451   poly a = monom,                         // collects the result
    452        b = NULL,                          // stores a1*monom
    453        c;                                 // used for temporary storage
    454   number tm   = pGetCoeff(monom),         // coefficient of monom
    455          tneg = npNegM(tm),        // - (coefficient of monom)
    456          tb,                              // used for tm*coeff(a1)
    457          tc;                              // used for intermediate coeff
    458 
    459   Order_t order;                          // used for homog case
    460 
    461   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    462   b = pNew();   
    463 
    464   order = pGetOrder(a2);              // inits order for homog case
    465  
    466 
    467   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    468 
    469   // MAIN LOOP:
    470   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    471     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 a2
    477     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 a2
    485       a = pNext(a) = a2; // append a2 to result and advance a2
    486       pIter(a2);
    487     }
    488     else
    489     { // coeffs are equal, so their difference is 0:
    490       c = a2;  // do not append anything to result: Delete a2 and advance
    491       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*monom
    499     goto Top;
    500 
    501   NotEqual:     // b != a2
    502     if (d < 0)  // b < a2:
    503     {
    504       assume(pComp0(b, a2) == -1);
    505       a = pNext(a) = a2;// append a2 to result and advance a2
    506       pIter(a2);
    507       if (a2==NULL) goto Finish;;
    508       goto Top;
    509     }
    510     else // now d >= 0, i.e., b > a2
    511     {
    512       assume(pComp0(b, a2) == 1);
    513       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    514       a = pNext(a) = b;       // append b to result and advance a1
    515       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*monom
    523       goto Top;
    524     }
    525  
    526  Finish: // a1 or a2 is NULL: Clean-up time
    527    assume(a1 == NULL || a2 == NULL);
    528    if (a1 == NULL) // append rest of a2 to result
    529      pNext(a) = a2;
    530    else  // append (- a1*monom) to result
    531      spMultCopyX(a1, monom, a, tneg, spNoether);
    532    ;
    533    if (b != NULL) pFree1(b);
    534 }
    535 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwONE
    536 (poly a1, poly a2, poly monom, poly spNoether)
    537 {
    538   poly a = monom,                         // collects the result
    539        b = NULL,                          // stores a1*monom
    540        c;                                 // used for temporary storage
    541   number tm   = pGetCoeff(monom),         // coefficient of monom
    542          tneg = npNegM(tm),        // - (coefficient of monom)
    543          tb,                              // used for tm*coeff(a1)
    544          tc;                              // used for intermediate coeff
    545 
    546   Order_t order;                          // used for homog case
    547 
    548   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    549   b = pNew();   
    550 
    551   order = pGetOrder(a2);              // inits order for homog case
    552  
    553 
    554   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    555 
    556   // MAIN LOOP:
    557   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    558     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 a2
    564     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 a2
    572       a = pNext(a) = a2; // append a2 to result and advance a2
    573       pIter(a2);
    574     }
    575     else
    576     { // coeffs are equal, so their difference is 0:
    577       c = a2;  // do not append anything to result: Delete a2 and advance
    578       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*monom
    586     goto Top;
    587 
    588   NotEqual:     // b != a2
    589     if (d < 0)  // b < a2:
    590     {
    591       assume(pComp0(b, a2) == -1);
    592       a = pNext(a) = a2;// append a2 to result and advance a2
    593       pIter(a2);
    594       if (a2==NULL) goto Finish;;
    595       goto Top;
    596     }
    597     else // now d >= 0, i.e., b > a2
    598     {
    599       assume(pComp0(b, a2) == 1);
    600       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    601       a = pNext(a) = b;       // append b to result and advance a1
    602       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*monom
    610       goto Top;
    611     }
    612  
    613  Finish: // a1 or a2 is NULL: Clean-up time
    614    assume(a1 == NULL || a2 == NULL);
    615    if (a1 == NULL) // append rest of a2 to result
    616      pNext(a) = a2;
    617    else  // append (- a1*monom) to result
    618      spMultCopyX(a1, monom, a, tneg, spNoether);
    619    ;
    620    if (b != NULL) pFree1(b);
    621 }
    622 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwTWO
    623 (poly a1, poly a2, poly monom, poly spNoether)
    624 {
    625   poly a = monom,                         // collects the result
    626        b = NULL,                          // stores a1*monom
    627        c;                                 // used for temporary storage
    628   number tm   = pGetCoeff(monom),         // coefficient of monom
    629          tneg = npNegM(tm),        // - (coefficient of monom)
    630          tb,                              // used for tm*coeff(a1)
    631          tc;                              // used for intermediate coeff
    632 
    633   Order_t order;                          // used for homog case
    634 
    635   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    636   b = pNew();   
    637 
    638   order = pGetOrder(a2);              // inits order for homog case
    639  
    640 
    641   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    642 
    643   // MAIN LOOP:
    644   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    645     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 a2
    651     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 a2
    659       a = pNext(a) = a2; // append a2 to result and advance a2
    660       pIter(a2);
    661     }
    662     else
    663     { // coeffs are equal, so their difference is 0:
    664       c = a2;  // do not append anything to result: Delete a2 and advance
    665       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*monom
    673     goto Top;
    674 
    675   NotEqual:     // b != a2
    676     if (d < 0)  // b < a2:
    677     {
    678       assume(pComp0(b, a2) == -1);
    679       a = pNext(a) = a2;// append a2 to result and advance a2
    680       pIter(a2);
    681       if (a2==NULL) goto Finish;;
    682       goto Top;
    683     }
    684     else // now d >= 0, i.e., b > a2
    685     {
    686       assume(pComp0(b, a2) == 1);
    687       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    688       a = pNext(a) = b;       // append b to result and advance a1
    689       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*monom
    697       goto Top;
    698     }
    699  
    700  Finish: // a1 or a2 is NULL: Clean-up time
    701    assume(a1 == NULL || a2 == NULL);
    702    if (a1 == NULL) // append rest of a2 to result
    703      pNext(a) = a2;
    704    else  // append (- a1*monom) to result
    705      spMultCopyX(a1, monom, a, tneg, spNoether);
    706    ;
    707    if (b != NULL) pFree1(b);
    708 }
    709 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwEVEN
    710 (poly a1, poly a2, poly monom, poly spNoether)
    711 {
    712   poly a = monom,                         // collects the result
    713        b = NULL,                          // stores a1*monom
    714        c;                                 // used for temporary storage
    715   number tm   = pGetCoeff(monom),         // coefficient of monom
    716          tneg = npNegM(tm),        // - (coefficient of monom)
    717          tb,                              // used for tm*coeff(a1)
    718          tc;                              // used for intermediate coeff
    719 
    720   Order_t order;                          // used for homog case
    721 
    722   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    723   b = pNew();   
    724 
    725   ;              // inits order for homog case
    726  
    727 
    728   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    729 
    730   // MAIN LOOP:
    731   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    732     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 a2
    738     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 a2
    746       a = pNext(a) = a2; // append a2 to result and advance a2
    747       pIter(a2);
    748     }
    749     else
    750     { // coeffs are equal, so their difference is 0:
    751       c = a2;  // do not append anything to result: Delete a2 and advance
    752       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*monom
    760     goto Top;
    761 
    762   NotEqual:     // b != a2
    763     if (d < 0)  // b < a2:
    764     {
    765       assume(pComp0(b, a2) == -1);
    766       a = pNext(a) = a2;// append a2 to result and advance a2
    767       pIter(a2);
    768       if (a2==NULL) goto Finish;;
    769       goto Top;
    770     }
    771     else // now d >= 0, i.e., b > a2
    772     {
    773       assume(pComp0(b, a2) == 1);
    774       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    775       a = pNext(a) = b;       // append b to result and advance a1
    776       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*monom
    784       goto Top;
    785     }
    786  
    787  Finish: // a1 or a2 is NULL: Clean-up time
    788    assume(a1 == NULL || a2 == NULL);
    789    if (a1 == NULL) // append rest of a2 to result
    790      pNext(a) = a2;
    791    else  // append (- a1*monom) to result
    792      spMultCopyX(a1, monom, a, tneg, spNoether);
    793    ;
    794    if (b != NULL) pFree1(b);
    795 }
    796 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwODD
    797 (poly a1, poly a2, poly monom, poly spNoether)
    798 {
    799   poly a = monom,                         // collects the result
    800        b = NULL,                          // stores a1*monom
    801        c;                                 // used for temporary storage
    802   number tm   = pGetCoeff(monom),         // coefficient of monom
    803          tneg = npNegM(tm),        // - (coefficient of monom)
    804          tb,                              // used for tm*coeff(a1)
    805          tc;                              // used for intermediate coeff
    806 
    807   Order_t order;                          // used for homog case
    808 
    809   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    810   b = pNew();   
    811 
    812   ;              // inits order for homog case
    813  
    814 
    815   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    816 
    817   // MAIN LOOP:
    818   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    819     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 a2
    825     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 a2
    833       a = pNext(a) = a2; // append a2 to result and advance a2
    834       pIter(a2);
    835     }
    836     else
    837     { // coeffs are equal, so their difference is 0:
    838       c = a2;  // do not append anything to result: Delete a2 and advance
    839       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*monom
    847     goto Top;
    848 
    849   NotEqual:     // b != a2
    850     if (d < 0)  // b < a2:
    851     {
    852       assume(pComp0(b, a2) == -1);
    853       a = pNext(a) = a2;// append a2 to result and advance a2
    854       pIter(a2);
    855       if (a2==NULL) goto Finish;;
    856       goto Top;
    857     }
    858     else // now d >= 0, i.e., b > a2
    859     {
    860       assume(pComp0(b, a2) == 1);
    861       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    862       a = pNext(a) = b;       // append b to result and advance a1
    863       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*monom
    871       goto Top;
    872     }
    873  
    874  Finish: // a1 or a2 is NULL: Clean-up time
    875    assume(a1 == NULL || a2 == NULL);
    876    if (a1 == NULL) // append rest of a2 to result
    877      pNext(a) = a2;
    878    else  // append (- a1*monom) to result
    879      spMultCopyX(a1, monom, a, tneg, spNoether);
    880    ;
    881    if (b != NULL) pFree1(b);
    882 }
    883 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwONE
    884 (poly a1, poly a2, poly monom, poly spNoether)
    885 {
    886   poly a = monom,                         // collects the result
    887        b = NULL,                          // stores a1*monom
    888        c;                                 // used for temporary storage
    889   number tm   = pGetCoeff(monom),         // coefficient of monom
    890          tneg = npNegM(tm),        // - (coefficient of monom)
    891          tb,                              // used for tm*coeff(a1)
    892          tc;                              // used for intermediate coeff
    893 
    894   Order_t order;                          // used for homog case
    895 
    896   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    897   b = pNew();   
    898 
    899   ;              // inits order for homog case
    900  
    901 
    902   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    903 
    904   // MAIN LOOP:
    905   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    906     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 a2
    912     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 a2
    920       a = pNext(a) = a2; // append a2 to result and advance a2
    921       pIter(a2);
    922     }
    923     else
    924     { // coeffs are equal, so their difference is 0:
    925       c = a2;  // do not append anything to result: Delete a2 and advance
    926       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*monom
    934     goto Top;
    935 
    936   NotEqual:     // b != a2
    937     if (d < 0)  // b < a2:
    938     {
    939       assume(pComp0(b, a2) == -1);
    940       a = pNext(a) = a2;// append a2 to result and advance a2
    941       pIter(a2);
    942       if (a2==NULL) goto Finish;;
    943       goto Top;
    944     }
    945     else // now d >= 0, i.e., b > a2
    946     {
    947       assume(pComp0(b, a2) == 1);
    948       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    949       a = pNext(a) = b;       // append b to result and advance a1
    950       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*monom
    958       goto Top;
    959     }
    960  
    961  Finish: // a1 or a2 is NULL: Clean-up time
    962    assume(a1 == NULL || a2 == NULL);
    963    if (a1 == NULL) // append rest of a2 to result
    964      pNext(a) = a2;
    965    else  // append (- a1*monom) to result
    966      spMultCopyX(a1, monom, a, tneg, spNoether);
    967    ;
    968    if (b != NULL) pFree1(b);
    969 }
    970 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwTWO
    971 (poly a1, poly a2, poly monom, poly spNoether)
    972 {
    973   poly a = monom,                         // collects the result
    974        b = NULL,                          // stores a1*monom
    975        c;                                 // used for temporary storage
    976   number tm   = pGetCoeff(monom),         // coefficient of monom
    977          tneg = npNegM(tm),        // - (coefficient of monom)
    978          tb,                              // used for tm*coeff(a1)
    979          tc;                              // used for intermediate coeff
    980 
    981   Order_t order;                          // used for homog case
    982 
    983   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    984   b = pNew();   
    985 
    986   ;              // inits order for homog case
    987  
    988 
    989   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    990 
    991   // MAIN LOOP:
    992   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    993     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 a2
    999     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 a2
    1007       a = pNext(a) = a2; // append a2 to result and advance a2
    1008       pIter(a2);
    1009     }
    1010     else
    1011     { // coeffs are equal, so their difference is 0:
    1012       c = a2;  // do not append anything to result: Delete a2 and advance
    1013       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*monom
    1021     goto Top;
    1022 
    1023   NotEqual:     // b != a2
    1024     if (d < 0)  // b < a2:
    1025     {
    1026       assume(pComp0(b, a2) == -1);
    1027       a = pNext(a) = a2;// append a2 to result and advance a2
    1028       pIter(a2);
    1029       if (a2==NULL) goto Finish;;
    1030       goto Top;
    1031     }
    1032     else // now d >= 0, i.e., b > a2
    1033     {
    1034       assume(pComp0(b, a2) == 1);
    1035       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1036       a = pNext(a) = b;       // append b to result and advance a1
    1037       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*monom
    1045       goto Top;
    1046     }
    1047  
    1048  Finish: // a1 or a2 is NULL: Clean-up time
    1049    assume(a1 == NULL || a2 == NULL);
    1050    if (a1 == NULL) // append rest of a2 to result
    1051      pNext(a) = a2;
    1052    else  // append (- a1*monom) to result
    1053      spMultCopyX(a1, monom, a, tneg, spNoether);
    1054    ;
    1055    if (b != NULL) pFree1(b);
    1056 }
    1057 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwEVEN
    1058 (poly a1, poly a2, poly monom, poly spNoether)
    1059 {
    1060   poly a = monom,                         // collects the result
    1061        b = NULL,                          // stores a1*monom
    1062        c;                                 // used for temporary storage
    1063   number tm   = pGetCoeff(monom),         // coefficient of monom
    1064          tneg = npNegM(tm),        // - (coefficient of monom)
    1065          tb,                              // used for tm*coeff(a1)
    1066          tc;                              // used for intermediate coeff
    1067 
    1068   Order_t order;                          // used for homog case
    1069 
    1070   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1071   b = pNew();   
    1072 
    1073   order = pGetOrder(a2);              // inits order for homog case
    1074  
    1075 
    1076   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    1077 
    1078   // MAIN LOOP:
    1079   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1080     register long d;
    1081     _pMonComp_otEXPCOMP_nwEVEN(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;
    1082 
    1083   Equal:   // b equals a2
    1084     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 a2
    1092       a = pNext(a) = a2; // append a2 to result and advance a2
    1093       pIter(a2);
    1094     }
    1095     else
    1096     { // coeffs are equal, so their difference is 0:
    1097       c = a2;  // do not append anything to result: Delete a2 and advance
    1098       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*monom
    1106     goto Top;
    1107 
    1108   NotEqual:     // b != a2
    1109     if (d < 0)  // b < a2:
    1110     {
    1111       assume(pComp0(b, a2) == -1);
    1112       a = pNext(a) = a2;// append a2 to result and advance a2
    1113       pIter(a2);
    1114       if (a2==NULL) goto Finish;;
    1115       goto Top;
    1116     }
    1117     else // now d >= 0, i.e., b > a2
    1118     {
    1119       assume(pComp0(b, a2) == 1);
    1120       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1121       a = pNext(a) = b;       // append b to result and advance a1
    1122       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*monom
    1130       goto Top;
    1131     }
    1132  
    1133  Finish: // a1 or a2 is NULL: Clean-up time
    1134    assume(a1 == NULL || a2 == NULL);
    1135    if (a1 == NULL) // append rest of a2 to result
    1136      pNext(a) = a2;
    1137    else  // append (- a1*monom) to result
    1138      spMultCopyX(a1, monom, a, tneg, spNoether);
    1139    ;
    1140    if (b != NULL) pFree1(b);
    1141 }
    1142 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwODD
    1143 (poly a1, poly a2, poly monom, poly spNoether)
    1144 {
    1145   poly a = monom,                         // collects the result
    1146        b = NULL,                          // stores a1*monom
    1147        c;                                 // used for temporary storage
    1148   number tm   = pGetCoeff(monom),         // coefficient of monom
    1149          tneg = npNegM(tm),        // - (coefficient of monom)
    1150          tb,                              // used for tm*coeff(a1)
    1151          tc;                              // used for intermediate coeff
    1152 
    1153   Order_t order;                          // used for homog case
    1154 
    1155   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1156   b = pNew();   
    1157 
    1158   order = pGetOrder(a2);              // inits order for homog case
    1159  
    1160 
    1161   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    1162 
    1163   // MAIN LOOP:
    1164   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1165     register long d;
    1166     _pMonComp_otEXPCOMP_nwODD(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;
    1167 
    1168   Equal:   // b equals a2
    1169     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 a2
    1177       a = pNext(a) = a2; // append a2 to result and advance a2
    1178       pIter(a2);
    1179     }
    1180     else
    1181     { // coeffs are equal, so their difference is 0:
    1182       c = a2;  // do not append anything to result: Delete a2 and advance
    1183       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*monom
    1191     goto Top;
    1192 
    1193   NotEqual:     // b != a2
    1194     if (d < 0)  // b < a2:
    1195     {
    1196       assume(pComp0(b, a2) == -1);
    1197       a = pNext(a) = a2;// append a2 to result and advance a2
    1198       pIter(a2);
    1199       if (a2==NULL) goto Finish;;
    1200       goto Top;
    1201     }
    1202     else // now d >= 0, i.e., b > a2
    1203     {
    1204       assume(pComp0(b, a2) == 1);
    1205       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1206       a = pNext(a) = b;       // append b to result and advance a1
    1207       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*monom
    1215       goto Top;
    1216     }
    1217  
    1218  Finish: // a1 or a2 is NULL: Clean-up time
    1219    assume(a1 == NULL || a2 == NULL);
    1220    if (a1 == NULL) // append rest of a2 to result
    1221      pNext(a) = a2;
    1222    else  // append (- a1*monom) to result
    1223      spMultCopyX(a1, monom, a, tneg, spNoether);
    1224    ;
    1225    if (b != NULL) pFree1(b);
    1226 }
    1227 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwONE
    1228 (poly a1, poly a2, poly monom, poly spNoether)
    1229 {
    1230   poly a = monom,                         // collects the result
    1231        b = NULL,                          // stores a1*monom
    1232        c;                                 // used for temporary storage
    1233   number tm   = pGetCoeff(monom),         // coefficient of monom
    1234          tneg = npNegM(tm),        // - (coefficient of monom)
    1235          tb,                              // used for tm*coeff(a1)
    1236          tc;                              // used for intermediate coeff
    1237 
    1238   Order_t order;                          // used for homog case
    1239 
    1240   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1241   b = pNew();   
    1242 
    1243   order = pGetOrder(a2);              // inits order for homog case
    1244  
    1245 
    1246   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    1247 
    1248   // MAIN LOOP:
    1249   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1250     register long d;
    1251     _pMonComp_otEXPCOMP_nwONE(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;
    1252 
    1253   Equal:   // b equals a2
    1254     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 a2
    1262       a = pNext(a) = a2; // append a2 to result and advance a2
    1263       pIter(a2);
    1264     }
    1265     else
    1266     { // coeffs are equal, so their difference is 0:
    1267       c = a2;  // do not append anything to result: Delete a2 and advance
    1268       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*monom
    1276     goto Top;
    1277 
    1278   NotEqual:     // b != a2
    1279     if (d < 0)  // b < a2:
    1280     {
    1281       assume(pComp0(b, a2) == -1);
    1282       a = pNext(a) = a2;// append a2 to result and advance a2
    1283       pIter(a2);
    1284       if (a2==NULL) goto Finish;;
    1285       goto Top;
    1286     }
    1287     else // now d >= 0, i.e., b > a2
    1288     {
    1289       assume(pComp0(b, a2) == 1);
    1290       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1291       a = pNext(a) = b;       // append b to result and advance a1
    1292       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*monom
    1300       goto Top;
    1301     }
    1302  
    1303  Finish: // a1 or a2 is NULL: Clean-up time
    1304    assume(a1 == NULL || a2 == NULL);
    1305    if (a1 == NULL) // append rest of a2 to result
    1306      pNext(a) = a2;
    1307    else  // append (- a1*monom) to result
    1308      spMultCopyX(a1, monom, a, tneg, spNoether);
    1309    ;
    1310    if (b != NULL) pFree1(b);
    1311 }
    1312 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwTWO
    1313 (poly a1, poly a2, poly monom, poly spNoether)
    1314 {
    1315   poly a = monom,                         // collects the result
    1316        b = NULL,                          // stores a1*monom
    1317        c;                                 // used for temporary storage
    1318   number tm   = pGetCoeff(monom),         // coefficient of monom
    1319          tneg = npNegM(tm),        // - (coefficient of monom)
    1320          tb,                              // used for tm*coeff(a1)
    1321          tc;                              // used for intermediate coeff
    1322 
    1323   Order_t order;                          // used for homog case
    1324 
    1325   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1326   b = pNew();   
    1327 
    1328   order = pGetOrder(a2);              // inits order for homog case
    1329  
    1330 
    1331   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    1332 
    1333   // MAIN LOOP:
    1334   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1335     register long d;
    1336     _pMonComp_otEXPCOMP_nwTWO(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;
    1337 
    1338   Equal:   // b equals a2
    1339     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 a2
    1347       a = pNext(a) = a2; // append a2 to result and advance a2
    1348       pIter(a2);
    1349     }
    1350     else
    1351     { // coeffs are equal, so their difference is 0:
    1352       c = a2;  // do not append anything to result: Delete a2 and advance
    1353       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*monom
    1361     goto Top;
    1362 
    1363   NotEqual:     // b != a2
    1364     if (d < 0)  // b < a2:
    1365     {
    1366       assume(pComp0(b, a2) == -1);
    1367       a = pNext(a) = a2;// append a2 to result and advance a2
    1368       pIter(a2);
    1369       if (a2==NULL) goto Finish;;
    1370       goto Top;
    1371     }
    1372     else // now d >= 0, i.e., b > a2
    1373     {
    1374       assume(pComp0(b, a2) == 1);
    1375       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1376       a = pNext(a) = b;       // append b to result and advance a1
    1377       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*monom
    1385       goto Top;
    1386     }
    1387  
    1388  Finish: // a1 or a2 is NULL: Clean-up time
    1389    assume(a1 == NULL || a2 == NULL);
    1390    if (a1 == NULL) // append rest of a2 to result
    1391      pNext(a) = a2;
    1392    else  // append (- a1*monom) to result
    1393      spMultCopyX(a1, monom, a, tneg, spNoether);
    1394    ;
    1395    if (b != NULL) pFree1(b);
    1396 }
    1397 static void spSpolyLoop_chMODP_otEXP_homGEN_nwEVEN
    1398 (poly a1, poly a2, poly monom, poly spNoether)
    1399 {
    1400   poly a = monom,                         // collects the result
    1401        b = NULL,                          // stores a1*monom
    1402        c;                                 // used for temporary storage
    1403   number tm   = pGetCoeff(monom),         // coefficient of monom
    1404          tneg = npNegM(tm),        // - (coefficient of monom)
    1405          tb,                              // used for tm*coeff(a1)
    1406          tc;                              // used for intermediate coeff
    1407 
    1408   Order_t order;                          // used for homog case
    1409 
    1410   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1411   b = pNew();   
    1412 
    1413   ;              // inits order for homog case
    1414  
    1415 
    1416   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    1417 
    1418   // MAIN LOOP:
    1419   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1420     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 a2
    1426     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 a2
    1434       a = pNext(a) = a2; // append a2 to result and advance a2
    1435       pIter(a2);
    1436     }
    1437     else
    1438     { // coeffs are equal, so their difference is 0:
    1439       c = a2;  // do not append anything to result: Delete a2 and advance
    1440       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*monom
    1448     goto Top;
    1449 
    1450   NotEqual:     // b != a2
    1451     if (d < 0)  // b < a2:
    1452     {
    1453       assume(pComp0(b, a2) == -1);
    1454       a = pNext(a) = a2;// append a2 to result and advance a2
    1455       pIter(a2);
    1456       if (a2==NULL) goto Finish;;
    1457       goto Top;
    1458     }
    1459     else // now d >= 0, i.e., b > a2
    1460     {
    1461       assume(pComp0(b, a2) == 1);
    1462       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1463       a = pNext(a) = b;       // append b to result and advance a1
    1464       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*monom
    1472       goto Top;
    1473     }
    1474  
    1475  Finish: // a1 or a2 is NULL: Clean-up time
    1476    assume(a1 == NULL || a2 == NULL);
    1477    if (a1 == NULL) // append rest of a2 to result
    1478      pNext(a) = a2;
    1479    else  // append (- a1*monom) to result
    1480      spMultCopyX(a1, monom, a, tneg, spNoether);
    1481    ;
    1482    if (b != NULL) pFree1(b);
    1483 }
    1484 static void spSpolyLoop_chMODP_otEXP_homGEN_nwODD
    1485 (poly a1, poly a2, poly monom, poly spNoether)
    1486 {
    1487   poly a = monom,                         // collects the result
    1488        b = NULL,                          // stores a1*monom
    1489        c;                                 // used for temporary storage
    1490   number tm   = pGetCoeff(monom),         // coefficient of monom
    1491          tneg = npNegM(tm),        // - (coefficient of monom)
    1492          tb,                              // used for tm*coeff(a1)
    1493          tc;                              // used for intermediate coeff
    1494 
    1495   Order_t order;                          // used for homog case
    1496 
    1497   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1498   b = pNew();   
    1499 
    1500   ;              // inits order for homog case
    1501  
    1502 
    1503   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    1504 
    1505   // MAIN LOOP:
    1506   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1507     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 a2
    1513     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 a2
    1521       a = pNext(a) = a2; // append a2 to result and advance a2
    1522       pIter(a2);
    1523     }
    1524     else
    1525     { // coeffs are equal, so their difference is 0:
    1526       c = a2;  // do not append anything to result: Delete a2 and advance
    1527       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*monom
    1535     goto Top;
    1536 
    1537   NotEqual:     // b != a2
    1538     if (d < 0)  // b < a2:
    1539     {
    1540       assume(pComp0(b, a2) == -1);
    1541       a = pNext(a) = a2;// append a2 to result and advance a2
    1542       pIter(a2);
    1543       if (a2==NULL) goto Finish;;
    1544       goto Top;
    1545     }
    1546     else // now d >= 0, i.e., b > a2
    1547     {
    1548       assume(pComp0(b, a2) == 1);
    1549       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1550       a = pNext(a) = b;       // append b to result and advance a1
    1551       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*monom
    1559       goto Top;
    1560     }
    1561  
    1562  Finish: // a1 or a2 is NULL: Clean-up time
    1563    assume(a1 == NULL || a2 == NULL);
    1564    if (a1 == NULL) // append rest of a2 to result
    1565      pNext(a) = a2;
    1566    else  // append (- a1*monom) to result
    1567      spMultCopyX(a1, monom, a, tneg, spNoether);
    1568    ;
    1569    if (b != NULL) pFree1(b);
    1570 }
    1571 static void spSpolyLoop_chMODP_otEXP_homGEN_nwONE
    1572 (poly a1, poly a2, poly monom, poly spNoether)
    1573 {
    1574   poly a = monom,                         // collects the result
    1575        b = NULL,                          // stores a1*monom
    1576        c;                                 // used for temporary storage
    1577   number tm   = pGetCoeff(monom),         // coefficient of monom
    1578          tneg = npNegM(tm),        // - (coefficient of monom)
    1579          tb,                              // used for tm*coeff(a1)
    1580          tc;                              // used for intermediate coeff
    1581 
    1582   Order_t order;                          // used for homog case
    1583 
    1584   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1585   b = pNew();   
    1586 
    1587   ;              // inits order for homog case
    1588  
    1589 
    1590   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    1591 
    1592   // MAIN LOOP:
    1593   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1594     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 a2
    1600     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 a2
    1608       a = pNext(a) = a2; // append a2 to result and advance a2
    1609       pIter(a2);
    1610     }
    1611     else
    1612     { // coeffs are equal, so their difference is 0:
    1613       c = a2;  // do not append anything to result: Delete a2 and advance
    1614       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*monom
    1622     goto Top;
    1623 
    1624   NotEqual:     // b != a2
    1625     if (d < 0)  // b < a2:
    1626     {
    1627       assume(pComp0(b, a2) == -1);
    1628       a = pNext(a) = a2;// append a2 to result and advance a2
    1629       pIter(a2);
    1630       if (a2==NULL) goto Finish;;
    1631       goto Top;
    1632     }
    1633     else // now d >= 0, i.e., b > a2
    1634     {
    1635       assume(pComp0(b, a2) == 1);
    1636       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1637       a = pNext(a) = b;       // append b to result and advance a1
    1638       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*monom
    1646       goto Top;
    1647     }
    1648  
    1649  Finish: // a1 or a2 is NULL: Clean-up time
    1650    assume(a1 == NULL || a2 == NULL);
    1651    if (a1 == NULL) // append rest of a2 to result
    1652      pNext(a) = a2;
    1653    else  // append (- a1*monom) to result
    1654      spMultCopyX(a1, monom, a, tneg, spNoether);
    1655    ;
    1656    if (b != NULL) pFree1(b);
    1657 }
    1658 static void spSpolyLoop_chMODP_otEXP_homGEN_nwTWO
    1659 (poly a1, poly a2, poly monom, poly spNoether)
    1660 {
    1661   poly a = monom,                         // collects the result
    1662        b = NULL,                          // stores a1*monom
    1663        c;                                 // used for temporary storage
    1664   number tm   = pGetCoeff(monom),         // coefficient of monom
    1665          tneg = npNegM(tm),        // - (coefficient of monom)
    1666          tb,                              // used for tm*coeff(a1)
    1667          tc;                              // used for intermediate coeff
    1668 
    1669   Order_t order;                          // used for homog case
    1670 
    1671   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1672   b = pNew();   
    1673 
    1674   ;              // inits order for homog case
    1675  
    1676 
    1677   pCopyAddFast0(b, a1, monom);  // now a2 != NULL -- set up b
    1678 
    1679   // MAIN LOOP:
    1680   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1681     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 a2
    1687     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 a2
    1695       a = pNext(a) = a2; // append a2 to result and advance a2
    1696       pIter(a2);
    1697     }
    1698     else
    1699     { // coeffs are equal, so their difference is 0:
    1700       c = a2;  // do not append anything to result: Delete a2 and advance
    1701       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*monom
    1709     goto Top;
    1710 
    1711   NotEqual:     // b != a2
    1712     if (d < 0)  // b < a2:
    1713     {
    1714       assume(pComp0(b, a2) == -1);
    1715       a = pNext(a) = a2;// append a2 to result and advance a2
    1716       pIter(a2);
    1717       if (a2==NULL) goto Finish;;
    1718       goto Top;
    1719     }
    1720     else // now d >= 0, i.e., b > a2
    1721     {
    1722       assume(pComp0(b, a2) == 1);
    1723       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1724       a = pNext(a) = b;       // append b to result and advance a1
    1725       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*monom
    1733       goto Top;
    1734     }
    1735  
    1736  Finish: // a1 or a2 is NULL: Clean-up time
    1737    assume(a1 == NULL || a2 == NULL);
    1738    if (a1 == NULL) // append rest of a2 to result
    1739      pNext(a) = a2;
    1740    else  // append (- a1*monom) to result
    1741      spMultCopyX(a1, monom, a, tneg, spNoether);
    1742    ;
    1743    if (b != NULL) pFree1(b);
    1744 }
    1745 static void spSpolyLoop_chMODP_otEXP_homYES_nwEVEN
    1746 (poly a1, poly a2, poly monom, poly spNoether)
    1747 {
    1748   poly a = monom,                         // collects the result
    1749        b = NULL,                          // stores a1*monom
    1750        c;                                 // used for temporary storage
    1751   number tm   = pGetCoeff(monom),         // coefficient of monom
    1752          tneg = npNegM(tm),        // - (coefficient of monom)
    1753          tb,                              // used for tm*coeff(a1)
    1754          tc;                              // used for intermediate coeff
    1755 
    1756   Order_t order;                          // used for homog case
    1757 
    1758   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1759   b = pNew();   
    1760 
    1761   order = pGetOrder(a2);              // inits order for homog case
    1762  
    1763 
    1764   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    1765 
    1766   // MAIN LOOP:
    1767   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1768     register long d;
    1769     _pMonComp_otEXP_nwEVEN(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;
    1770 
    1771   Equal:   // b equals a2
    1772     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 a2
    1780       a = pNext(a) = a2; // append a2 to result and advance a2
    1781       pIter(a2);
    1782     }
    1783     else
    1784     { // coeffs are equal, so their difference is 0:
    1785       c = a2;  // do not append anything to result: Delete a2 and advance
    1786       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*monom
    1794     goto Top;
    1795 
    1796   NotEqual:     // b != a2
    1797     if (d < 0)  // b < a2:
    1798     {
    1799       assume(pComp0(b, a2) == -1);
    1800       a = pNext(a) = a2;// append a2 to result and advance a2
    1801       pIter(a2);
    1802       if (a2==NULL) goto Finish;;
    1803       goto Top;
    1804     }
    1805     else // now d >= 0, i.e., b > a2
    1806     {
    1807       assume(pComp0(b, a2) == 1);
    1808       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1809       a = pNext(a) = b;       // append b to result and advance a1
    1810       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*monom
    1818       goto Top;
    1819     }
    1820  
    1821  Finish: // a1 or a2 is NULL: Clean-up time
    1822    assume(a1 == NULL || a2 == NULL);
    1823    if (a1 == NULL) // append rest of a2 to result
    1824      pNext(a) = a2;
    1825    else  // append (- a1*monom) to result
    1826      spMultCopyX(a1, monom, a, tneg, spNoether);
    1827    ;
    1828    if (b != NULL) pFree1(b);
    1829 }
    1830 static void spSpolyLoop_chMODP_otEXP_homYES_nwODD
    1831 (poly a1, poly a2, poly monom, poly spNoether)
    1832 {
    1833   poly a = monom,                         // collects the result
    1834        b = NULL,                          // stores a1*monom
    1835        c;                                 // used for temporary storage
    1836   number tm   = pGetCoeff(monom),         // coefficient of monom
    1837          tneg = npNegM(tm),        // - (coefficient of monom)
    1838          tb,                              // used for tm*coeff(a1)
    1839          tc;                              // used for intermediate coeff
    1840 
    1841   Order_t order;                          // used for homog case
    1842 
    1843   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1844   b = pNew();   
    1845 
    1846   order = pGetOrder(a2);              // inits order for homog case
    1847  
    1848 
    1849   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    1850 
    1851   // MAIN LOOP:
    1852   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1853     register long d;
    1854     _pMonComp_otEXP_nwODD(b, a2, pVariables1W, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;
    1855 
    1856   Equal:   // b equals a2
    1857     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 a2
    1865       a = pNext(a) = a2; // append a2 to result and advance a2
    1866       pIter(a2);
    1867     }
    1868     else
    1869     { // coeffs are equal, so their difference is 0:
    1870       c = a2;  // do not append anything to result: Delete a2 and advance
    1871       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*monom
    1879     goto Top;
    1880 
    1881   NotEqual:     // b != a2
    1882     if (d < 0)  // b < a2:
    1883     {
    1884       assume(pComp0(b, a2) == -1);
    1885       a = pNext(a) = a2;// append a2 to result and advance a2
    1886       pIter(a2);
    1887       if (a2==NULL) goto Finish;;
    1888       goto Top;
    1889     }
    1890     else // now d >= 0, i.e., b > a2
    1891     {
    1892       assume(pComp0(b, a2) == 1);
    1893       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1894       a = pNext(a) = b;       // append b to result and advance a1
    1895       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*monom
    1903       goto Top;
    1904     }
    1905  
    1906  Finish: // a1 or a2 is NULL: Clean-up time
    1907    assume(a1 == NULL || a2 == NULL);
    1908    if (a1 == NULL) // append rest of a2 to result
    1909      pNext(a) = a2;
    1910    else  // append (- a1*monom) to result
    1911      spMultCopyX(a1, monom, a, tneg, spNoether);
    1912    ;
    1913    if (b != NULL) pFree1(b);
    1914 }
    1915 static void spSpolyLoop_chMODP_otEXP_homYES_nwONE
    1916 (poly a1, poly a2, poly monom, poly spNoether)
    1917 {
    1918   poly a = monom,                         // collects the result
    1919        b = NULL,                          // stores a1*monom
    1920        c;                                 // used for temporary storage
    1921   number tm   = pGetCoeff(monom),         // coefficient of monom
    1922          tneg = npNegM(tm),        // - (coefficient of monom)
    1923          tb,                              // used for tm*coeff(a1)
    1924          tc;                              // used for intermediate coeff
    1925 
    1926   Order_t order;                          // used for homog case
    1927 
    1928   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    1929   b = pNew();   
    1930 
    1931   order = pGetOrder(a2);              // inits order for homog case
    1932  
    1933 
    1934   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    1935 
    1936   // MAIN LOOP:
    1937   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    1938     register long d;
    1939     _pMonComp_otEXP_nwONE(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;
    1940 
    1941   Equal:   // b equals a2
    1942     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 a2
    1950       a = pNext(a) = a2; // append a2 to result and advance a2
    1951       pIter(a2);
    1952     }
    1953     else
    1954     { // coeffs are equal, so their difference is 0:
    1955       c = a2;  // do not append anything to result: Delete a2 and advance
    1956       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*monom
    1964     goto Top;
    1965 
    1966   NotEqual:     // b != a2
    1967     if (d < 0)  // b < a2:
    1968     {
    1969       assume(pComp0(b, a2) == -1);
    1970       a = pNext(a) = a2;// append a2 to result and advance a2
    1971       pIter(a2);
    1972       if (a2==NULL) goto Finish;;
    1973       goto Top;
    1974     }
    1975     else // now d >= 0, i.e., b > a2
    1976     {
    1977       assume(pComp0(b, a2) == 1);
    1978       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    1979       a = pNext(a) = b;       // append b to result and advance a1
    1980       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*monom
    1988       goto Top;
    1989     }
    1990  
    1991  Finish: // a1 or a2 is NULL: Clean-up time
    1992    assume(a1 == NULL || a2 == NULL);
    1993    if (a1 == NULL) // append rest of a2 to result
    1994      pNext(a) = a2;
    1995    else  // append (- a1*monom) to result
    1996      spMultCopyX(a1, monom, a, tneg, spNoether);
    1997    ;
    1998    if (b != NULL) pFree1(b);
    1999 }
    2000 static void spSpolyLoop_chMODP_otEXP_homYES_nwTWO
    2001 (poly a1, poly a2, poly monom, poly spNoether)
    2002 {
    2003   poly a = monom,                         // collects the result
    2004        b = NULL,                          // stores a1*monom
    2005        c;                                 // used for temporary storage
    2006   number tm   = pGetCoeff(monom),         // coefficient of monom
    2007          tneg = npNegM(tm),        // - (coefficient of monom)
    2008          tb,                              // used for tm*coeff(a1)
    2009          tc;                              // used for intermediate coeff
    2010 
    2011   Order_t order;                          // used for homog case
    2012 
    2013   if (a2==NULL) goto Finish;              // we are done if a2 is 0
    2014   b = pNew();   
    2015 
    2016   order = pGetOrder(a2);              // inits order for homog case
    2017  
    2018 
    2019   pCopyAddFastHomog(b, a1, monom, order);  // now a2 != NULL -- set up b
    2020 
    2021   // MAIN LOOP:
    2022   Top:     // compare b = monom*a1 and a2 w.r.t. monomial ordering
    2023     register long d;
    2024     _pMonComp_otEXP_nwTWO(b, a2, d, NonZeroA(d, pLexSgn, goto NotEqual ), goto Equal);;
    2025 
    2026   Equal:   // b equals a2
    2027     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 a2
    2035       a = pNext(a) = a2; // append a2 to result and advance a2
    2036       pIter(a2);
    2037     }
    2038     else
    2039     { // coeffs are equal, so their difference is 0:
    2040       c = a2;  // do not append anything to result: Delete a2 and advance
    2041       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*monom
    2049     goto Top;
    2050 
    2051   NotEqual:     // b != a2
    2052     if (d < 0)  // b < a2:
    2053     {
    2054       assume(pComp0(b, a2) == -1);
    2055       a = pNext(a) = a2;// append a2 to result and advance a2
    2056       pIter(a2);
    2057       if (a2==NULL) goto Finish;;
    2058       goto Top;
    2059     }
    2060     else // now d >= 0, i.e., b > a2
    2061     {
    2062       assume(pComp0(b, a2) == 1);
    2063       pSetCoeff0(b,npMultM(pGetCoeff(a1), tneg));
    2064       a = pNext(a) = b;       // append b to result and advance a1
    2065       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*monom
    2073       goto Top;
    2074     }
    2075  
    2076  Finish: // a1 or a2 is NULL: Clean-up time
    2077    assume(a1 == NULL || a2 == NULL);
    2078    if (a1 == NULL) // append rest of a2 to result
    2079      pNext(a) = a2;
    2080    else  // append (- a1*monom) to result
    2081      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  
    77* ABSTRACT: s-polynomials
    88*/
    9 /* $Id: spolys.h,v 1.7 1999-09-27 14:43:43 obachman Exp $ */
     9/* $Id: spolys.h,v 1.8 1999-09-29 10:59:40 obachman Exp $ */
    1010#include "structs.h"
    11 #include "spSpolyLoop.h"
    1211
    1312/* reduction */
  • Singular/structs.h

    rc88c949 rd14712  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: structs.h,v 1.24 1999-09-28 17:37:22 Singular Exp $ */
     6/* $Id: structs.h,v 1.25 1999-09-29 10:59:40 obachman Exp $ */
    77/*
    88* ABSTRACT
     
    215215
    216216  memHeap   mm_specHeap; /* Heap from where monoms are allocated */
    217 #ifdef SDRING
    218   short      partN;
    219 #endif
    220217  short      ch;     /* characteristic */
    221218  short      ch_flags; /* additional char-flags */
  • Singular/syz.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz.cc,v 1.22 1999-09-27 15:32:56 obachman Exp $ */
     4/* $Id: syz.cc,v 1.23 1999-09-29 10:59:40 obachman Exp $ */
    55
    66/*
     
    1616#include "kstd1.h"
    1717#include "kutil.h"
    18 #include "spolys.h"
    1918#include "stairc.h"
    20 //#include "ipid.h"
    2119#include "cntrlc.h"
    2220#include "ipid.h"
  • Singular/syz.h

    rc88c949 rd14712  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: syz.h,v 1.17 1999-09-27 15:05:33 obachman Exp $ */
     6/* $Id: syz.h,v 1.18 1999-09-29 10:59:41 obachman Exp $ */
    77/*
    88* ABSTRACT: Resolutions
    99*/
    1010#include "structs.h"
    11 #include "kbPolyProcs.h"
    1211
    1312struct sSObject{
     
    5049  kBucket_pt syz_bucket;
    5150  ring syRing;
    52   kbPolyProcs pProcs;
    5351  int length;
    5452  resolvente fullres;
  • Singular/syz0.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz0.cc,v 1.20 1999-09-27 15:32:56 obachman Exp $ */
     4/* $Id: syz0.cc,v 1.21 1999-09-29 10:59:41 obachman Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    1212#include "mmemory.h"
    1313#include "polys.h"
    14 #include "spolys.h"
    1514#include "febase.h"
    1615#include "kstd1.h"
    1716#include "kutil.h"
    18 #include "spolys.h"
    1917#include "stairc.h"
    2018#include "ipid.h"
     
    3129
    3230static kBucket_pt sy0buck;
    33 static kbPolyProcs sy0pProcs;
    3431
    3532static polyset syInitSort(polyset oldF,int rkF,int Fmax,
     
    125122}
    126123
    127 static poly syRedtail2(poly p, polyset redWith, intvec *modcomp, spSpolyLoopProc SpolyLoop = NULL)
     124static poly syRedtail2(poly p, polyset redWith, intvec *modcomp)
    128125{
    129126  poly h, hn;
     
    143140      {
    144141        //if (TEST_OPT_PROT) Print("r");
    145         hn = spSpolyRed(redWith[j],hn,NULL, SpolyLoop);
     142        hn = ksOldSpolyRed(redWith[j],hn);
    146143        if (hn == NULL)
    147144        {
     
    202199  rkF=idRankFreeModule(idF);
    203200  Free((ADDRESS)idF,sizeof(ip_sideal));
    204   spSet(currRing);
    205201/*-------------sorting of F for index handling------------*/
    206202  if (noSort)
     
    286282        tl = smax;
    287283/*--------------begin to reduce-----------------------------*/
    288         toRed = spSpolyCreate(S[j],S[k],NULL, NULL);
     284        toRed = ksOldCreateSpoly(S[j],S[k]);
    289285        ecartToRed = 1;
    290286        bestEcart = 1;
     
    383379            }
    384380
    385             toRed = spSpolyRed(p,toRed,NULL, NULL);
     381            toRed = ksOldSpolyRed(p,toRed);
    386382          }
    387383        }
     
    433429*special Normalform for Schreyer in factor rings
    434430*/
    435 poly sySpecNormalize(poly toNorm,ideal mW=NULL, spSpolyLoopProc SpolyLoop=NULL)
     431poly sySpecNormalize(poly toNorm,ideal mW=NULL)
    436432{
    437433  int j,i=0;
     
    450446    {
    451447      //pNorm(toNorm);
    452       toNorm = spSpolyRed(currQuotient->m[i],toNorm,NULL, SpolyLoop);
     448      toNorm = ksOldSpolyRed(currQuotient->m[i],toNorm);
    453449      pDelete(&p);
    454450      if (toNorm==NULL) return NULL;
     
    550546        {
    551547          number an=nCopy(pGetCoeff(F[k])),bn=nCopy(pGetCoeff(F[j]));
    552           int ct = spCheckCoeff(&an, &bn);
     548          int ct = ksCheckCoeff(&an, &bn);
    553549          syz = pCopy(pairs[k]);
    554550          //syz->coef = nCopy(F[k]->coef);
     
    587583        }
    588584        if (k<Fl)
    589           toRed = spSpolyCreate(F[j],F[k],NULL, NULL);
     585          toRed = ksOldCreateSpoly(F[j],F[k]);
    590586        else
    591587        {
    592588          q = pMultT(pCopy(F[j]),multWith);
    593           toRed = sySpecNormalize(q,mW, NULL);
     589          toRed = sySpecNormalize(q,mW);
    594590          pDelete(&multWith);
    595591        }
     
    614610          printf("toRed in Pair[%d, %d]:", j, k);
    615611          pWrite(toRed);
    616           kBucketInit(sy0buck,toRed,-1,&sy0pProcs);
     612          kBucketInit(sy0buck,toRed,-1);
    617613#endif
    618614
     
    622618            {
    623619              kBucketClear(sy0buck,&toRed,&ltR);
    624               toRed = sySpecNormalize(toRed,mW, NULL);
     620              toRed = sySpecNormalize(toRed,mW);
    625621#ifdef WRITE_BUCKETS
    626622              printf("toRed in Pair[%d, %d]:", j, k);
     
    691687          {
    692688            (*newmodcomp)[j+2] = Sl;
    693             (*Shdl)[Sl] = syRedtail2(syz,*Shdl,newmodcomp, NULL);
     689            (*Shdl)[Sl] = syRedtail2(syz,*Shdl,newmodcomp);
    694690            (*newmodcomp)[j+2] = 0;
    695691          }
     
    844840    //while ((i!=0) && (!res[syzIndex]->m[i-1])) i--;
    845841    sy0buck = kBucketCreate();
    846     kbSetPolyProcs(&sy0pProcs,currRing,spGetOrderType(currRing,1,0));
    847842    if (syzIndex+1==*length)
    848843    {
  • Singular/syz1.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz1.cc,v 1.40 1999-09-27 15:05:33 obachman Exp $ */
     4/* $Id: syz1.cc,v 1.41 1999-09-29 10:59:41 obachman Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    1414#include "kstd1.h"
    1515#include "kutil.h"
    16 #include "spolys.h"
    17 #include "spolys0.h"
    1816#include "stairc.h"
    1917#include "ipid.h"
     
    3129#include "syz.h"
    3230#include "kbuckets.h"
    33 #include "kbPolyProcs.h"
    3431#include <limits.h>
    3532
     
    3835/*--------------static variables------------------------*/
    3936/*---points to the real components, shifted of the actual module-*/
    40 static int *  currcomponents=NULL;
    41 static long *  currShiftedComponents=NULL;
     37int *  currcomponents=NULL;
     38long *  currShiftedComponents=NULL;
    4239
    4340// Logarithm of estimate of maximal number of new components
     
    374371        {
    375372          //hn = sySPolyRed(hn,redWith->m[j]);
    376           hn = spSpolyRed(redWith->m[j],hn,NULL,spSpolyLoop_General);
     373          hn = ksOldSpolyRed(redWith->m[j],hn);
    377374          if (hn == NULL)
    378375          {
     
    805802      pTest(tso.p1);
    806803      nextPairs[i].p =
    807         spSpolyCreate(tso.p2, tso.p1,NULL,spSpolyLoop_General);
     804        ksOldCreateSpoly(tso.p2, tso.p1,NULL);
    808805      (*spl)[i] = pLength(nextPairs[i].p);
    809806    }
     
    10461043        {
    10471044          (sPairs)[i].syz =
    1048             spSpolyRed(res->m[j],(sPairs)[i].syz,NULL,spSpolyLoop_General);
     1045            ksOldSpolyRed(res->m[j],(sPairs)[i].syz);
    10491046            //sySPolyRed((sPairs)[i].syz,res->m[j]);
    10501047          j = k-1;
     
    15351532static void syStatistics(resolvente res,int length)
    15361533{
    1537   int i,j=1,k,deg=0;
     1534  int i,j=1,k;
     1535  Order_t deg = 0;
    15381536
    15391537  PrintLn();
     
    25182516  pComp0 = syzcomp2dpc;
    25192517  syzstr->bucket = kBucketCreate();
    2520   kbSetPolyProcs(&syzstr->pProcs,currRing,rOrderType_Syz2dpc,FALSE);
    25212518  for (index=syzstr->length-1;index>0;index--)
    25222519  {
     
    27142711  syzstr->Firstelem = (int**)Alloc0((*length+1)*sizeof(int*));
    27152712  syzstr->bucket = kBucketCreate();
    2716   kbSetPolyProcs(&syzstr->pProcs,currRing,rOrderType_Syz2dpc,FALSE);
    27172713  int len0=idRankFreeModule(arg)+1;
    27182714  startdeg = actdeg;
  • Singular/syz2.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz2.cc,v 1.1 1999-09-27 15:05:34 obachman Exp $ */
     4/* $Id: syz2.cc,v 1.2 1999-09-29 10:59:42 obachman Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    605605    {
    606606      //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);
    608608#ifdef SHOW_PROT
    609609Print("reduziere Paar mit: \n");
     
    966966  syzstr->bucket = kBucketCreate();
    967967  syzstr->syz_bucket = kBucketCreate();
    968   kbSetPolyProcs(&syzstr->pProcs,currRing,rOrderType_Syz2dpc,FALSE);
    969968  startdeg = actdeg;
    970969  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
  • Singular/tesths.cc

    rc88c949 rd14712  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: tesths.cc,v 1.75 1999-09-24 12:24:41 Singular Exp $ */
     4/* $Id: tesths.cc,v 1.76 1999-09-29 10:59:43 obachman Exp $ */
    55
    66/*
     
    122122"                                                       0<\n"
    123123"     by: G.-M. Greuel, G. Pfister, H. Schoenemann        \\   %s\n"
    124 #ifdef SDRING
    125 "       preliminary experimental version\n"
    126 #endif
    127124"FB Mathematik der Universitaet, D-67653 Kaiserslautern    \\\n"
    128125, S_VERSION1,S_VERSION2);
Note: See TracChangeset for help on using the changeset viewer.