Changeset d4cb43b in git


Ignore:
Timestamp:
Jan 30, 2002, 3:33:07 PM (22 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
c658ed43f0faca30bee15dba7bad146606a58727
Parents:
70981176bc24302d6a91e9beb7523f2aec93937a
Message:
* hannes: icc-port (code cleanup)


git-svn-id: file:///usr/local/Singular/svn/trunk@5823 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • Singular/kstd1.cc

    r7098117 rd4cb43b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd1.cc,v 1.85 2001-08-28 11:49:48 Singular Exp $ */
     4/* $Id: kstd1.cc,v 1.86 2002-01-30 14:33:01 Singular Exp $ */
    55/*
    66* ABSTRACT:
     
    682682* in the case of looking for the pure powers
    683683*/
    684 int posInL10 (LSet const set, int length, LObject* p,kStrategy const strat)
     684int posInL10 (const LSet set,const int length, LObject* p,const kStrategy strat)
    685685{
    686686  int j,dp,dL;
  • Singular/kstd2.cc

    r7098117 rd4cb43b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.75 2001-08-27 14:47:05 Singular Exp $ */
     4/* $Id: kstd2.cc,v 1.76 2002-01-30 14:33:02 Singular Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    3333//        number of first divisor, otherwise
    3434int kFindDivisibleByInT(const TSet &T, const unsigned long* sevT,
    35                         const int tl, const LObject* L, int start)
     35                        const int tl, const LObject* L, const int start)
    3636{
    3737  unsigned long not_sev = ~L->sev;
     
    601601      int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
    602602
    603       // reduce the tail and normailze poly
     603      // reduce the tail and normalize poly
    604604      if (TEST_OPT_INTSTRATEGY)
    605605      {
  • Singular/longalg.cc

    r7098117 rd4cb43b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longalg.cc,v 1.63 2002-01-10 12:33:21 Singular Exp $ */
     4/* $Id: longalg.cc,v 1.64 2002-01-30 14:33:02 Singular Exp $ */
    55/*
    66* ABSTRACT:   algebraic numbers
     
    5252static number   (*nacGcd)(number a, number b, const ring r);
    5353static number   (*nacLcm)(number a, number b, const ring r);
    54 static void     (*nacDelete)(number *a, ring r);
     54static void     (*nacDelete)(number *a, const ring r);
    5555       number   (*nacInit)(int i);
    5656static int      (*nacInt)(number &n);
     
    253253}
    254254
    255 void nap_Delete(napoly *p, ring r)
     255void nap_Delete(napoly *p, const ring r)
    256256{
    257257  napoly w, h = *p;
     
    13701370*  deletes p
    13711371*/
    1372 void naDelete(number *p, ring r)
     1372void naDelete(number *p, const ring r)
    13731373{
    13741374  lnumber l = (lnumber) * p;
     
    20612061* result =gcd(a,b)
    20622062*/
    2063 number naGcd(number a, number b, ring r)
     2063number naGcd(number a, number b, const ring r)
    20642064{
    20652065  lnumber x, y;
     
    23552355* and in     result->z the lcm(a->z,b->n)
    23562356*/
    2357 number naLcm(number la, number lb, ring r)
     2357number naLcm(number la, number lb, const ring r)
    23582358{
    23592359  lnumber result;
  • Singular/longalg.h

    r7098117 rd4cb43b  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: longalg.h,v 1.28 2002-01-10 12:33:22 Singular Exp $ */
     6/* $Id: longalg.h,v 1.29 2002-01-30 14:33:03 Singular Exp $ */
    77/*
    88* ABSTRACT:   algebraic numbers
     
    4747#define napLength(p)      pLength((poly)p)
    4848napoly napNeg(napoly a);
    49 void    naDelete (number *p, ring r);
     49void    naDelete (number *p, const ring r);
    5050#else /* LONGALGNEW */
    5151void    naDelete (number *p, const ring r);
  • Singular/misc.cc

    r7098117 rd4cb43b  
    303303{
    304304  char * name;
    305   int   setval;
    306   int   resetval;
     305  unsigned   setval;
     306  unsigned   resetval;
    307307};
    308308
     
    701701          else
    702702            PrintLn();
    703         } 
     703        }
    704704        hh=IDNEXT(hh);
    705705      }
     
    726726              Print("%s::%s, typ %s level %d data %x\n",
    727727              IDID(hh),IDID(h2),Tok2Cmdname(IDTYP(h2)),IDLEV(h2),IDDATA(h2));
    728             } 
     728            }
    729729            h2=IDNEXT(h2);
    730730          }
  • Singular/mpr_base.cc

    r7098117 rd4cb43b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mpr_base.cc,v 1.27 2001-08-27 14:47:12 Singular Exp $ */
     4/* $Id: mpr_base.cc,v 1.28 2002-01-30 14:33:04 Singular Exp $ */
    55
    66/*
     
    24452445}
    24462446
    2447 resVector *resMatrixDense::getMVector(int i)
     2447resVector *resMatrixDense::getMVector(const int i)
    24482448{
    24492449  assume( i >= 0 && i < numVectors );
     
    31603160}
    31613161
    3162 int uResultant::nextPrime( int i )
     3162int uResultant::nextPrime( const int i )
    31633163{
    31643164  int init=i;
    3165   i+=2;
    3166   int j= IsPrime( i );
     3165  int ii=i+2;
     3166  int j= IsPrime( ii );
    31673167  while ( j <= init )
    31683168  {
    3169     i+=2;
    3170     j= IsPrime( i );
     3169    ii+=2;
     3170    j= IsPrime( ii );
    31713171  }
    31723172  return j;
  • Singular/numbers.cc

    r7098117 rd4cb43b  
    22*  Computer Algebra System SINGULAR      *
    33*****************************************/
    4 /* $Id: numbers.cc,v 1.43 2001-08-24 14:10:09 Singular Exp $ */
     4/* $Id: numbers.cc,v 1.44 2002-01-30 14:33:04 Singular Exp $ */
    55
    66/*
     
    7979int    ndParDeg(number n) { return 0; }
    8080
    81 number ndGcd(number a, number b, ring r) { return r->cf->nInit(1); }
     81number ndGcd(number a, number b, const ring r) { return r->cf->nInit(1); }
    8282
    8383number ndIntMod(number a, number b) { return nInit(0); }
  • Singular/numbers.h

    r7098117 rd4cb43b  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: numbers.h,v 1.27 2001-03-22 19:11:08 Singular Exp $ */
     6/* $Id: numbers.h,v 1.28 2002-01-30 14:33:05 Singular Exp $ */
    77/*
    88* ABSTRACT: interface to coefficient aritmetics
     
    7070void ndDelete(number* d, const ring r);
    7171void nDummy2(number &d);
    72 number ndGcd(number a, number b);
     72number ndGcd(number a, number b, const ring r);
    7373number ndCopy(number a);
    7474number nd_Copy(number a, ring r);
  • Singular/pInline0.h

    r7098117 rd4cb43b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: pInline0.h,v 1.8 2001-08-27 14:47:20 Singular Exp $
     9 *  Version: $Id: pInline0.h,v 1.9 2002-01-30 14:33:05 Singular Exp $
    1010 *******************************************************************/
    1111#ifndef PINLINE0_H
     
    112112}
    113113
    114 BOOLEAN   p_IsConstantPoly(poly p, ring r)
     114BOOLEAN   p_IsConstantPoly(const poly p, const ring r)
    115115{
    116   while(p!=NULL)
     116  poly pp=p;
     117  while(pp!=NULL)
    117118  {
    118     if (! p_LmIsConstantComp(p, r))
     119    if (! p_LmIsConstantComp(pp, r))
    119120      return FALSE;
    120     pIter(p);
     121    pIter(pp);
    121122  }
    122123  return TRUE;
     
    182183
    183184#endif // PINLINE_CC
     185
  • Singular/p_Procs_Generate.cc

    r7098117 rd4cb43b  
    88 *  Author:  obachman (Olaf Bachmann)
    99 *  Created: 8/00
    10  *  Version: $Id: p_Procs_Generate.cc,v 1.5 2001-08-27 14:47:28 Singular Exp $
     10 *  Version: $Id: p_Procs_Generate.cc,v 1.6 2002-01-30 14:33:05 Singular Exp $
    1111 *******************************************************************/
    1212
     
    243243#ifdef p_Procs_Static
    244244  int j;
    245   printf("
    246 /***************************************************************
    247   Names of procs for RDEBUG */
    248 #ifdef RDEBUG\n");
     245  printf("\n"
     246  "/***************************************************************\n"
     247  "Names of procs for RDEBUG */\n"
     248  "#ifdef RDEBUG\n");
    249249
    250250  for (i=0; i<p_Unknown_Proc; i++)
     
    264264    printf("\n};\n");
    265265  }
    266   printf("
    267 #endif // RDEBUG
    268 
    269 
    270 /***************************************************************/
    271 /* Tables for lookup of procedures: */\n");
     266  printf("\n #endif // RDEBUG\n\n"
     267  "/***************************************************************/\n"
     268  "/* Tables for lookup of procedures: */\n");
    272269
    273270  for (i=0; i<p_Unknown_Proc; i++)
  • Singular/p_Procs_Impl.h

    r7098117 rd4cb43b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 12/00
    9  *  Version: $Id: p_Procs_Impl.h,v 1.6 2001-10-09 16:36:16 Singular Exp $
     9 *  Version: $Id: p_Procs_Impl.h,v 1.7 2002-01-30 14:33:05 Singular Exp $
    1010 *******************************************************************/
    1111#ifndef P_PROCS_IMPL_H
     
    1313
    1414/***************************************************************
    15  *
     15 * 
    1616 * Configurations
    17  *
     17 * 
    1818 *******************************************************************/
    1919
    2020/***************************************************************
    2121 Here is how it works:
    22  At run-time, SetProcs is used to choose the appropriate PolyProcs
     22 At run-time, SetProcs is used to choose the appropriate PolyProcs 
    2323              based on the ring properies.
    24  At generate-time, SetProcs is used to generate all
     24 At generate-time, SetProcs is used to generate all 
    2525              possible PolyProcs.
    26  Which PolyProcs are generated/used can be controled by values of
     26 Which PolyProcs are generated/used can be controled by values of 
    2727 HAVE_FAST_P_PROCS, HAVE_FAST_LENGTH, HAVE_FAST_ORD, and FAST_FIELD
    28 
     28 
    2929 At generate-time, the file p_Procs.inc is generated,
    3030 which provides implementations of the p_Procs, based on
     
    3232 macros.
    3333
    34  At run-time, a fast proc is set/choosen if found/generated, else
     34 At run-time, a fast proc is set/choosen if found/generated, else 
    3535 a general proc is set/choosen.
    3636 *******************************************************************/
     
    5252//   2 -- plus special cases for FieldQ
    5353//   nothing else is implemented, yet
    54 #ifndef HAVE_FAST_FIELD
     54#ifndef HAVE_FAST_FIELD 
    5555#define HAVE_FAST_FIELD 0
    5656#endif
     
    6262//   3 -- special cases for length <= 4
    6363//   4 -- special cases for length <= 8
    64 #ifndef HAVE_FAST_LENGTH
     64#ifndef HAVE_FAST_LENGTH 
    6565#define HAVE_FAST_LENGTH 0
    6666#endif
     
    7272//  3  -- special ords for with n_min <= 3
    7373//  4  -- special for all ords
    74 #ifndef HAVE_FAST_ORD
     74#ifndef HAVE_FAST_ORD 
    7575#define HAVE_FAST_ORD 0
    7676#endif
    7777
    7878// Define HAVE_FAST_ZERO_ORD to:
    79 //  0 -- no zero ords are considered
     79//  0 -- no zero ords are considered 
    8080//  1 -- only ZeroOrds for OrdPosNomogPosZero, OrdNomogPosZero, OrdPomogNegZero
    8181//  2 -- ZeroOrds for all
    82 #ifndef HAVE_FAST_ZERO_ORD
     82#ifndef HAVE_FAST_ZERO_ORD 
    8383#define HAVE_FAST_ZERO_ORD 0
    8484#endif
     
    9494
    9595/***************************************************************
    96  *
     96 * 
    9797 * Definitions of our fields, lengths, ords, procs we work with
    98  *
     98 * 
    9999 *******************************************************************/
    100100
     
    106106{
    107107  FieldGeneral = 0,
    108   FieldZp,
     108  FieldZp,         
    109109  FieldQ,
    110110  FieldR,
     
    117117#endif
    118118  FieldUnknown
    119 };
     119} p_Field;
    120120typedef enum p_Length // Length of exponent vector in words
    121121{
    122122  LengthGeneral = 0, // n >= 1
    123   LengthEight,       // n == 8
     123  LengthEight,       // n == 8   
    124124  LengthSeven,
    125125  LengthSix,
     
    130130  LengthOne,
    131131  LengthUnknown
    132 };
    133 typedef enum p_Ord
    134 {
    135   OrdGeneral = 0,
    136                     //     ordsgn
     132} p_Length;
     133typedef enum p_Ord 
     134{                   
     135  OrdGeneral = 0,   
     136                    //     ordsgn   
    137137                    //  0   1   i   n-1 n   n_min   Example
    138138  OrdPomog,         //  +   +   +   +   +   1       (lp,C)
     
    172172
    173173  OrdUnknown
    174 };
     174} p_Ord;
    175175
    176176typedef enum p_Proc
     
    192192  p_kBucketSetLm_Proc,
    193193  p_Unknown_Proc
    194 };
     194} p_Proc;
    195195
    196196static inline char* p_FieldEnum_2_String(p_Field field)
     
    199199  {
    200200      case FieldGeneral: return "FieldGeneral";
    201       case FieldZp: return "FieldZp";
     201      case FieldZp: return "FieldZp";         
    202202      case FieldQ: return "FieldQ";
    203203      case FieldR: return "FieldR";
     
    218218  switch(length)
    219219  {
    220       case LengthGeneral: return "LengthGeneral";
    221       case LengthEight: return "LengthEight";
     220      case LengthGeneral: return "LengthGeneral"; 
     221      case LengthEight: return "LengthEight";       
    222222      case LengthSeven: return "LengthSeven";
    223223      case LengthSix: return "LengthSix";
     
    236236  switch(ord)
    237237  {
    238       case OrdGeneral: return "OrdGeneral";
    239       case OrdPomog: return "OrdPomog";
    240       case OrdNomog: return "OrdNomog";
    241       case OrdNegPomog: return "OrdNegPomog";
    242       case OrdPomogNeg: return "OrdPomogNeg";
    243       case OrdPosNomog: return "OrdPosNomog";
    244       case OrdNomogPos: return "OrdNomogPos";
    245       case OrdPosPosNomog: return "OrdPosPosNomog";
    246       case OrdPosNomogPos: return "OrdPosNomogPos";
    247       case OrdNegPosNomog: return "OrdNegPosNomog";
     238      case OrdGeneral: return "OrdGeneral";   
     239      case OrdPomog: return "OrdPomog";         
     240      case OrdNomog: return "OrdNomog";         
     241      case OrdNegPomog: return "OrdNegPomog";     
     242      case OrdPomogNeg: return "OrdPomogNeg";     
     243      case OrdPosNomog: return "OrdPosNomog";     
     244      case OrdNomogPos: return "OrdNomogPos";     
     245      case OrdPosPosNomog: return "OrdPosPosNomog";   
     246      case OrdPosNomogPos: return "OrdPosNomogPos";   
     247      case OrdNegPosNomog: return "OrdNegPosNomog";   
    248248#ifdef HAVE_LENGTH_DIFF
    249       case OrdNegPomogZero: return "OrdNegPomogZero";
    250       case OrdPomogNegZero: return "OrdPomogNegZero";
    251       case OrdPomogZero: return "OrdPomogZero";
    252       case OrdNomogZero: return "OrdNomogZero";
    253       case OrdNomogPosZero: return "OrdNomogPosZero";
    254       case OrdPosNomogZero: return "OrdPosNomogZero";
     249      case OrdNegPomogZero: return "OrdNegPomogZero"; 
     250      case OrdPomogNegZero: return "OrdPomogNegZero"; 
     251      case OrdPomogZero: return "OrdPomogZero";     
     252      case OrdNomogZero: return "OrdNomogZero";     
     253      case OrdNomogPosZero: return "OrdNomogPosZero"; 
     254      case OrdPosNomogZero: return "OrdPosNomogZero"; 
    255255      case OrdPosPosNomogZero: return "OrdPosPosNomogZero";
    256256      case OrdPosNomogPosZero: return "OrdPosNomogPosZero";
     
    304304      case p_Merge_q_Proc:
    305305        return 1;
    306 
     306       
    307307      default:
    308308        return 0;
     
    318318      case p_Neg_Proc:
    319319        return 0;
    320 
     320       
    321321      default:
    322322        return 1;
    323323  }
    324324}
    325 
     325 
    326326// returns string specifying the module into which the p_Proc
    327327// should go
     
    338338
    339339/***************************************************************
    340  *
    341  *
     340 * 
     341 * 
    342342 * Deal with OrdZero
    343  *
     343 * 
    344344 *******************************************************************/
    345345#ifdef HAVE_LENGTH_DIFF
     
    365365        case OrdPosPosNomogZero:    return OrdPosPosNomog;
    366366        case OrdNegPosNomogZero:    return OrdNegPosNomog;
    367         default:
     367        default:   
    368368          if (strict) return OrdGeneral;
    369369          else if (ord == OrdPomogNegZero) return OrdPomogNeg;
     
    384384
    385385/***************************************************************
    386  *
    387  * Filters which are applied to field/length/ord, before a proc is
     386 * 
     387 * Filters which are applied to field/length/ord, before a proc is 
    388388 * choosen
    389  *
     389 * 
    390390 *******************************************************************/
    391391#ifdef p_Procs_Static
    392 static inline void StaticKernelFilter(p_Field &field, p_Length &length,
     392static inline void StaticKernelFilter(p_Field &field, p_Length &length, 
    393393                                      p_Ord &ord, const p_Proc proc)
    394394{
     
    407407{
    408408  if (HAVE_FAST_P_PROCS >= 5) return;
    409 
     409 
    410410  if (HAVE_FAST_P_PROCS < 3 && field == FieldQ)
    411411    field = FieldGeneral;
    412 
     412 
    413413  if ((HAVE_FAST_P_PROCS == 0) ||
    414414      (HAVE_FAST_P_PROCS <= 4 && field != FieldZp && field != FieldQ &&
     
    420420    return;
    421421  }
    422   if (HAVE_FAST_P_PROCS == 1 ||
     422  if (HAVE_FAST_P_PROCS == 1 || 
    423423      (HAVE_FAST_P_PROCS == 4 && field != FieldZp && proc != p_Merge_q_Proc))
    424424    ord = OrdGeneral;
     
    427427static inline void FastFieldFilter(p_Field &field)
    428428{
    429   if (HAVE_FAST_FIELD <= 0 ||
     429  if (HAVE_FAST_FIELD <= 0 || 
    430430      (HAVE_FAST_FIELD == 1 && field != FieldZp) ||
    431431      (field != FieldZp && field != FieldQ))
    432432    field = FieldGeneral;
    433433}
    434 
     434     
    435435static inline void FastLengthFilter(p_Length &length)
    436436{
     
    457457  if (IsZeroOrd(ord))
    458458  {
    459     if ((HAVE_FAST_ZERO_ORD == 1 && (ord != OrdPosNomogPosZero &&
    460                                      ord != OrdNomogPosZero &&
     459    if ((HAVE_FAST_ZERO_ORD == 1 && (ord != OrdPosNomogPosZero && 
     460                                     ord != OrdNomogPosZero && 
    461461                                     ord != OrdPomogNegZero)) ||
    462462        (HAVE_FAST_ZERO_ORD <= 0))
     
    484484}
    485485
    486 static inline void pp_Mult_mm_Noether_Filter(p_Field &field,
     486static inline void pp_Mult_mm_Noether_Filter(p_Field &field, 
    487487                                             p_Length &length, p_Ord &ord)
    488488{
    489   if (ord == OrdPomog
     489  if (ord == OrdPomog 
    490490      || ord == OrdPomogZero
    491       || (ord == OrdPomogNeg && length > LengthTwo)
     491      || (ord == OrdPomogNeg && length > LengthTwo) 
    492492#ifdef HAVE_LENGTH_DIFF
    493493      || (ord == OrdPomogZero)
     
    502502  }
    503503}
    504 
    505 static inline void FastProcFilter(p_Proc proc, p_Field &field,
     504     
     505static inline void FastProcFilter(p_Proc proc, p_Field &field, 
    506506                                  p_Length &length, p_Ord &ord)
    507507{
     
    512512        p_Add_q__Filter(length, ord);
    513513        break;
    514 
     514       
    515515      case p_Copy_Proc:
    516516      case p_Delete_Proc:
    517517        NCopy__Filter(field);
    518518        break;
    519 
     519       
    520520      case pp_Mult_mm_Noether_Proc:
    521521        pp_Mult_mm_Noether_Filter(field, length, ord);
     
    531531          }
    532532          break;
    533 
     533         
    534534      default: break;
    535535  }
     
    554554      ord > ORD_MAX_N_3)       //  i.e. OrdNomogPosZero and below
    555555    return 0;
    556 
     556 
    557557  if (length >= LengthTwo &&    // i.e. 1 or 2
    558558      ord > ORD_MAX_N_2)        // i.e. PosNomog and below
    559559    return 0;
    560560
    561   if (length == LengthOne &&
     561  if (length == LengthOne && 
    562562      ord > ORD_MAX_N_1)           // i.e. PosPomogZero and below
    563563    return 0;
     
    569569}
    570570
    571 
     571 
    572572static inline int index(p_Length length, p_Ord ord)
    573573{
     
    593593      case p_Neg_Proc:
    594594        return field;
    595 
     595       
    596596      case p_ShallowCopyDelete_Proc:
    597597        return length;
    598 
     598       
    599599      case p_Copy_Proc:
    600600      case pp_Mult_mm_Proc:
     
    610610      case p_kBucketSetLm_Proc:
    611611        return index(field, length, ord);
    612 
     612       
    613613      case p_Merge_q_Proc:
    614614        return index(length, ord);
    615 
     615       
    616616      default:
    617617        assume(0);
     
    623623
    624624/***************************************************************
    625  *
    626  * Macros for setting procs -- these are used for
     625 * 
     626 * Macros for setting procs -- these are used for 
    627627 * generation and setting
    628628 *
     
    639639}                                                           \
    640640while (0)                                                   \
    641 
     641 
    642642#define SetProcs(field, length, ord)                                    \
    643643do                                                                      \
  • Singular/syz2.cc

    r7098117 rd4cb43b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz2.cc,v 1.23 2001-08-27 14:47:42 Singular Exp $ */
     4/* $Id: syz2.cc,v 1.24 2002-01-30 14:33:06 Singular Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    8282  while ((l>0) && ((syzstr->resPairs[index])[l-1].lcm==NULL)) l--;
    8383  rr = l-1;
    84   while ((rr>=0) && (((syzstr->resPairs[index])[rr].p==NULL) ||
     84  while ((rr>=0) && (((syzstr->resPairs[index])[rr].p==NULL) || 
    8585        ((syzstr->resPairs[index])[rr].order>actdeg))) rr--;
    86   r2 = rr+1;
     86  r2 = rr+1; 
    8787  while ((rr>=0) && ((syzstr->resPairs[index])[rr].order==actdeg)
    8888         && ((syzstr->resPairs[index])[rr].syzind<0))
     
    117117          if (tcp!=NULL)
    118118          {
    119             while ((tcp!=NULL) &&
     119            while ((tcp!=NULL) && 
    120120              ((tcp->first_poly!=i)||(tcp->second_poly!=r1))) tcp = tcp->next;
    121121          }
     
    128128            j = 0;
    129129            while (j<i)
    130             {
     130            { 
    131131              if (nP->m[j]!=NULL)
    132132              {
     
    169169                      while ((ti<l) && (((syzstr->resPairs[index])[ti].ind1!=j)||
    170170                             ((syzstr->resPairs[index])[ti].ind2!=i))) ti++;
    171                       if (ti<l)
     171                      if (ti<l) 
    172172                      {
    173173#ifdef SHOW_SPRFL
     
    292292{
    293293  SObject tso;
     294  memset(&tso,0,sizeof(tso));
    294295  int l=(*syzstr->Tl)[index];
    295296
     
    566567  while (kk>=0)
    567568  {
    568     if (toGo==0)
     569    if (toGo==0) 
    569570    {
    570571      while (kk>=0)
     
    612613        q = kBucketGetLm(syzstr->bucket);
    613614        j = 0;
    614         while (j<kres)
     615        while (j<kres) 
    615616        {
    616           if ((redset[j].p!=NULL) && (pLmDivisibleBy(redset[j].p,q))
     617          if ((redset[j].p!=NULL) && (pLmDivisibleBy(redset[j].p,q)) 
    617618              && ((redset[j].ind1!=tso.ind1) || (redset[j].ind2!=tso.ind2)))
    618619          {
     
    756757      i = 0;
    757758      delete spl1;
    758       spl1 = ivStrip(spl2);
     759      spl1 = ivStrip(spl2); 
    759760      delete spl2;
    760761      if (spl1!=NULL)
     
    763764        kk = (*spl1)[i]-1;
    764765      }
    765     }
     766    } 
    766767#endif
    767768#ifdef USE_HEURISTIC2
     
    914915  for (i=1;i<=syzstr->length;i++)
    915916  {
    916     if (!idIs0(syzstr->orderedRes[i]))
     917    if (!idIs0(syzstr->orderedRes[i])) 
    917918    {
    918919      toreor = syzstr->orderedRes[i];
     
    927928        toreor->m[j] = NULL;
    928929      }
    929       m = 0;
     930      m = 0; 
    930931      for (j=0;j<togo;j++)
    931932      {
     
    948949
    949950/*2
    950 * the CoCoA-algorithm for free resolutions, using a formula
     951* the CoCoA-algorithm for free resolutions, using a formula 
    951952* for remaining pairs based on Hilbert-functions
    952953*/
     
    968969    return syzstr;
    969970  }
    970 
     971 
    971972  // Creare dp,S ring and change to it
    972973  syzstr->syRing = rCurrRingAssure_dp_C();
     
    10821083  kBucketDestroy(&(syzstr->bucket));
    10831084  kBucketDestroy(&(syzstr->syz_bucket));
    1084   if (origR != syzstr->syRing)
     1085  if (origR != syzstr->syRing) 
    10851086    rChangeCurrRing(origR);
    10861087  else
  • Singular/syz3.cc

    r7098117 rd4cb43b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz3.cc,v 1.9 2001-08-27 14:47:43 Singular Exp $ */
     4/* $Id: syz3.cc,v 1.10 2002-01-30 14:33:06 Singular Exp $ */
    55/*
    66* ABSTRACT: resolutions
    77*/
    8 
     8 
    99#include "mod2.h"
    1010#include <mylimits.h>
     
    3333#include "timer.h"
    3434#include "matpol.h"
    35 
     35 
    3636//#define SHOW_PROT
    3737//#define SHOW_RED
     
    5353int discard_pairs;
    5454int short_pairs;
    55 
    56 /*3
     55 
     56/*3 
    5757* assumes the ideals old_ideal and new_ideal to be homogeneous
    5858* tests wether the new_ideal is a regular extension of the old_ideal
     
    6868  int i;
    6969  BOOLEAN isRegular=TRUE;
    70 
     70 
    7171  for (i=old_hilbs->length()+deg-1;i>=deg;i--)
    7272    (*shifted_old_hilbs)[i] = (*old_hilbs)[i-deg];
     
    9090  return isRegular;
    9191}
    92 
     92 
    9393/*3
    9494* shows the resolution stored in syzstr->orderedRes
     
    9797{
    9898  int i=0;
    99 
     99 
    100100  while ((i<syzstr->length) && (!idIs0(syzstr->res[i])))
    101101  {
     
    108108  }
    109109}
    110 
     110 
    111111/*3
    112112* produces the next subresolution for a regular extension
     
    123123  pSetComp(w_gen,0);
    124124  pSetmComp(w_gen);
    125 
     125 
    126126  //syShowRes(syzstr);
    127127  neg_gen = pNeg(neg_gen);
     
    131131    pShift(&neg_gen,-1);
    132132  }
    133   while (index>0)
     133  while (index>0) 
    134134  {
    135135    if (index%2==0)
     
    203203            ppMult_qq(current_repr->m[i],p));
    204204          syzstr->orderedRes[index]->m[i+start] = pCopy(current_repr->m[i]);
    205           syzstr->orderedRes[index]->m[i+start] =
     205          syzstr->orderedRes[index]->m[i+start] = 
    206206            pMult_mm(syzstr->orderedRes[index]->m[i+start],w_gen);
    207207          if ((*syzstr->Tl)[index]!=0)
     
    215215          if ((index==1) && ((i==IDELEMS(current_ideal) ||
    216216               (totake[index-1]->m[i+1]==NULL)))) break;
    217           totake[index]->m[i+start_ttk] =
     217          totake[index]->m[i+start_ttk] = 
    218218            pMult_mm(pCopy(totake[index-1]->m[i]),w_gen);
    219219          pShift(&totake[index]->m[i+start_ttk],current_tl);
     
    234234  //syShowRes(syzstr);
    235235}
    236 
     236 
    237237/*3
    238238* proves the consistence of the pairset resPairs with the corresponding
     
    243243{
    244244  int i=0;
    245 
    246   while (i<length)
     245 
     246  while (i<length) 
    247247  {
    248248    if (resPairs[i].lcm!=NULL)
     
    256256  }
    257257}
    258 
     258 
    259259/*3
    260260* cancels the weight monomials given by the leading terms of totake
     
    268268  resolvente res=syzstr->fullres;
    269269  poly p;
    270 
     270 
    271271  while ((syzIndex!=0) && (res[syzIndex]==NULL)) syzIndex--;
    272272  while (syzIndex>0)
     
    301301  }
    302302}
    303 
     303 
    304304/*3
    305305* updates the pairset resPairs by generating all pairs including the
     
    320320  poly p=NULL;
    321321  SObject tso;
    322 
     322 
    323323  syInitializePair(&tso);
    324   while ((og_elem<og_idel) && (old_generators->m[og_elem]!=NULL))
     324  while ((og_elem<og_idel) && (old_generators->m[og_elem]!=NULL)) 
    325325  {
    326326    if ((index>0) && (pGetComp(old_generators->m[og_elem])<=crit_comp))
     
    399399                int ti=0;
    400400                while ((ti<l) && (((*resPairs)[ti].ind1!=j1)|| ((*resPairs)[ti].ind2!=jj))) ti++;
    401                 if (ti<l)
     401                if (ti<l) 
    402402                {
    403403                  if (TEST_OPT_PROT) Print("cc");
     
    470470  idDelete(&pairs);
    471471}
    472 
     472 
    473473/*3
    474474* performs the modification of a single reduction on the syzygy-level
     
    481481  pDelete(&p);
    482482}
    483 
     483 
    484484/*3
    485485* normalizes the poly bucket by the ideal;
     
    494494  number n;
    495495  BOOLEAN isChanged=FALSE;
    496 
     496 
    497497  loop
    498498  {
     
    511511  return isChanged;
    512512}
    513 
     513 
    514514/*3
    515515* a tail reduction for the syzygies yielding new generators
     
    521521  poly h,hn;
    522522  BOOLEAN dummy;
    523 
     523 
    524524  while ((i>0) && (red->m[i-1]==NULL)) i--;
    525525  i--;
     
    570570  return tored;
    571571}
    572 
     572 
    573573/*3
    574574* the complete reduction of a single pair which is just stored
    575 * in bucket and syz_bucket
     575* in bucket and syz_bucket 
    576576*/
    577577static BOOLEAN syRedSyzPair(syStrategy syzstr,int index,int* g_l,int* orp_l)
     
    583583  number n;
    584584  BOOLEAN isChanged=FALSE;
    585 
     585 
    586586  loop
    587587  {
     
    601601  return isChanged;
    602602}
    603 
     603 
    604604/*3
    605605* the tailreduction for generators (which includes the correction of
     
    612612  poly h,hn;
    613613  BOOLEAN dummy;
    614 
     614 
    615615  h = tso.p;
    616616  kBucketInit(syzstr->syz_bucket,tso.syz,*syzred_l);
     
    642642  assume(pLength(tso.p)==*tored_l);
    643643}
    644 
     644 
    645645/*3
    646646* the reduction of a pair in the 0-th module
    647647*/
    648 static void redOnePair(SSet resPairs,int itso,int l, ideal syzygies,
     648static void redOnePair(SSet resPairs,int itso,int l, ideal syzygies, 
    649649            int crit_comp, syStrategy syzstr,int index,ideal new_generators,
    650650            ideal new_repr,int * ogm_l,int * orp_l)
     
    665665#endif
    666666  int syz_place=IDELEMS(syzygies);
    667 
     667 
    668668  while ((syz_place>0) && (syzygies->m[syz_place-1]==NULL)) syz_place--;
    669669  while ((ng_place>0) && (new_generators->m[ng_place-1]==NULL)) ng_place--;
     
    690690#ifdef EXPERIMENT3
    691691/*--- tests wether the product criterion applies --------------*/
    692     if ((index==0) && (old_generators->rank==1) &&
     692    if ((index==0) && (old_generators->rank==1) && 
    693693        (pFDeg(tso.p1)+pFDeg(tso.p2)==tso.order))
    694694    {
     
    753753      tso.syz = pAdd(p,tso.syz);
    754754#ifdef EXPERIMENT2
    755       if ((tso.syz!=NULL) && (pGetComp(tso.syz)<=crit_comp))
     755      if ((tso.syz!=NULL) && (pGetComp(tso.syz)<=crit_comp)) 
    756756      {
    757757/*--- breaks when the leading component is less than crit_comp ------*/
     
    778778      loop
    779779      {
    780         if (j>=og_idel)
     780        if (j>=og_idel) 
    781781        {
    782782/*--- reduction with generators computed in this procedure ---*/
     
    795795            break;
    796796          }
    797           //if (syzp==NULL)
     797          //if (syzp==NULL) 
    798798            //assume(p==NULL);
    799           //else
     799          //else 
    800800            //if (pGetComp(syzp)<=crit_comp) short_pairs++;
    801801#endif
     
    817817            deleteP =TRUE;
    818818          }
    819           //if (syzp==NULL)
     819          //if (syzp==NULL) 
    820820            //assume(p==NULL);
    821           //else
     821          //else 
    822822            //if ((pGetComp(syzp)<=crit_comp) && (p!=NULL)) short_pairs++;
    823823#endif
     
    861861    for (i=itso+1;i<l;i++)
    862862    {
    863       if (resPairs[i].lcm!=NULL)
    864       {
     863      if (resPairs[i].lcm!=NULL) 
     864      { 
    865865        if ((resPairs[i].ind1==toReplace-1)||(resPairs[i].ind2==toReplace-1))
    866866          syDeletePair(&resPairs[i]);
    867         else
     867        else 
    868868        {
    869869          if (resPairs[i].ind1>=toReplace)
     
    930930  syTestPairs(resPairs,l,old_generators);
    931931}
    932 
     932 
    933933/*3
    934934* reduction of all pairs of a fixed degree of the 0-th module
     
    943943  int * orp_l=(int*)omAlloc0(IDELEMS(syzstr->orderedRes[index])*sizeof(int));
    944944  int t1=IDELEMS(syzstr->res[index]),t2=IDELEMS(syzstr->orderedRes[index]);
    945 
    946   for (j=IDELEMS(syzstr->res[index])-1;j>=0;j--)
     945 
     946  for (j=IDELEMS(syzstr->res[index])-1;j>=0;j--) 
    947947  {
    948948    if (syzstr->res[index]->m[j]!=NULL)
    949949      ogm_l[j] = pLength(syzstr->res[index]->m[j]);
    950950  }
    951   for (j=IDELEMS(syzstr->orderedRes[index])-1;j>=0;j--)
     951  for (j=IDELEMS(syzstr->orderedRes[index])-1;j>=0;j--) 
    952952  {
    953953    if (syzstr->orderedRes[index]->m[j]!=NULL)
     
    986986  return FALSE;
    987987}
    988 
     988 
    989989/*3
    990990* extends the standard basis old_generators with new_generators;
     
    992992* assumes that the components of the new_generators are sperated
    993993* from those of old_generators, i.e. whenever the leading term
    994 * of a syzygy lies in the part of the old_generators, the syzygy
    995 * lie just in the module old_generators
     994* of a syzygy lies in the part of the old_generators, the syzygy 
     995* lie just in the module old_generators 
    996996* assumes that the new_generators are reduced w.r.t. old_generators
    997997*/
     
    10021002  int l_pairs=2*og_idel;
    10031003  ideal syzygies=idInit(16,syzstr->res[index]->rank+1);
    1004   ideal result;
    10051004  if ((idIs0(new_generators)) || (new_generators->m[0]==NULL))
    10061005  {
    10071006    Werror("Hier ist was faul!\n");
    1008     return result;
     1007    return NULL;
    10091008  }
    10101009  SSet resPairs=(SSet)omAlloc0(l_pairs*sizeof(SObject));
     
    10191018  return syzygies;
    10201019}
    1021 
     1020 
    10221021/*3
    10231022* normalizes the incoming generators
     
    10301029  poly p = kBucketGetLm(syzstr->bucket),result;
    10311030  number n;
    1032 
     1031 
    10331032  loop
    10341033  {
     
    10471046  return result;
    10481047}
    1049 
     1048 
    10501049/*3
    10511050* updates the pairs inthe higher modules
     
    10601059  poly p=NULL;
    10611060  SObject tso;
    1062 
     1061 
    10631062  syInitializePair(&tso);
    10641063  while ((l>0) && ((*resPairs)[l-1].lcm==NULL)) l--;
     
    10991098                int ti=0;
    11001099                while ((ti<l) && (((*resPairs)[ti].ind1!=j1)|| ((*resPairs)[ti].ind2!=j))) ti++;
    1101                 if (ti<l)
     1100                if (ti<l) 
    11021101                {
    11031102                  if (TEST_OPT_PROT) Print("cc");
     
    11711170  idDelete(&pairs);
    11721171}
    1173 
     1172 
    11741173/*3
    11751174* reduction of a single pair in the higher moduls
    11761175*/
    1177 static void redOnePairHIndex(SSet resPairs,int itso, int crit_comp,
     1176static void redOnePairHIndex(SSet resPairs,int itso, int crit_comp, 
    11781177            syStrategy syzstr,int index,ideal add_generators, ideal add_repr,
    11791178            ideal new_generators, ideal new_repr,int * next_place_add,int ** g_l,
     
    11901189  poly syzp;
    11911190#endif
    1192 
     1191 
    11931192  assume (tso.ind1<*next_place_add);
    11941193  assume (tso.ind2<*next_place_add);
     
    13631362  syDeletePair(&resPairs[itso]);
    13641363}
    1365 
     1364 
    13661365/*3
    13671366* reduction of all pairs of a fixed degree of a fixed module
     
    13751374  int i=0,j;
    13761375  poly deg_soc;
    1377 
     1376 
    13781377  if (TEST_OPT_PROT)
    13791378    Print("(%d,%d)",index,resPairs[0].order);
     
    13951394  return TRUE;
    13961395}
    1397 
     1396 
    13981397/*3
    13991398* we proceed the generators of the next module;
    14001399* they are stored in add_generators and add_repr;
    1401 * if the normal form of a new genrators w.r.t. add_generators has
     1400* if the normal form of a new genrators w.r.t. add_generators has 
    14021401* pGetComp<crit_comp it is skipped from the reduction;
    1403 * new_generators and new_repr (which are empty) stores the result of the
     1402* new_generators and new_repr (which are empty) stores the result of the 
    14041403* reduction which is normalized afterwards
    14051404*/
     
    14181417  BOOLEAN pairs_left;
    14191418  SSet resPairs=(SSet)omAlloc0(l_pairs*sizeof(SObject));
    1420 
     1419 
    14211420  for (j=IDELEMS(syzstr->res[index])-1;j>=0;j--)
    14221421  {
     
    14371436    if (syzstr->regularity>0)
    14381437    {
    1439       if (next_deg >= syzstr->regularity+index)
     1438      if (next_deg >= syzstr->regularity+index) 
    14401439      {
    14411440        while ((i<idel_temp) && (temp_generators->m[i]!=NULL))
     
    14711470            pEnlargeSet(&add_generators->m,IDELEMS(add_generators),16);
    14721471            pEnlargeSet(&add_repr->m,IDELEMS(add_repr),16);
    1473             gen_length = (int*)omRealloc0Size((ADDRESS)gen_length, IDELEMS(add_generators)*sizeof(int),
     1472            gen_length = (int*)omRealloc0Size((ADDRESS)gen_length, IDELEMS(add_generators)*sizeof(int), 
    14741473                                        (IDELEMS(add_generators)+16)*sizeof(int));
    14751474            IDELEMS(add_generators) += 16;
     
    15301529  omFreeSize((ADDRESS)secgen_length,IDELEMS(syzstr->res[index])*sizeof(int));
    15311530}
    1532 
     1531 
    15331532/*3
    15341533* normalizes the part of the next reduction lying within the block
     
    15441543  number n;
    15451544  int * g_l=(int*)omAlloc0(IDELEMS(old_generators)*sizeof(int));
    1546 
     1545 
    15471546  for (i=0;i<IDELEMS(old_generators);i++)
    15481547  {
     
    15521551    }
    15531552  }
    1554   for (i=IDELEMS(new_generators)-1;i>=0;i--)
     1553  for (i=IDELEMS(new_generators)-1;i>=0;i--) 
    15551554  {
    15561555    if (new_generators->m[i]!=NULL)
     
    15641563      {
    15651564        if ((j>=ii) || (p==NULL)) break;
    1566         if ((old_generators->m[j]!=NULL) &&
     1565        if ((old_generators->m[j]!=NULL) && 
    15671566            (pDivisibleBy(old_generators->m[j],p)))
    15681567        {
     
    15921591  return result;
    15931592}
    1594 
     1593 
    15951594/*3
    15961595* constructs the new subresolution for a nonregular extension
     
    16641663  return normalizeOldPart(new_generators,new_repr,syzstr,index,next_comp);
    16651664}
    1666 
     1665 
    16671666/*
    16681667* this procedure assumes that the first order is C !!!
     
    16931692  int ng_idel=IDELEMS(new_generators);
    16941693  ideal new_repr =idInit(ng_idel, crit_comp+ng_idel);
    1695 
     1694 
    16961695  if (index==0)
    16971696  {
     
    17521751  return result;
    17531752}
    1754 
     1753 
    17551754/*
    17561755* main call of the extended Koszul-resolution
     
    17651764  tHomog hom=isNotHomog;
    17661765  BOOLEAN isRegular;
    1767 
     1766 
    17681767  discard_pairs = 0;
    17691768  short_pairs = 0;
     
    19221921        new_generators = temp_gens;
    19231922#ifdef ONLY_STD
    1924         break;
     1923        break; 
    19251924#endif
    19261925        if (idIs0(new_generators)) break;
  • Singular/tok.h

    r7098117 rd4cb43b  
    77* ABSTRACT: tokens, types for interpreter; general macros
    88*/
    9 /* $Id: tok.h,v 1.51 2001-08-27 14:47:44 Singular Exp $ */
     9/* $Id: tok.h,v 1.52 2002-01-30 14:33:07 Singular Exp $ */
    1010
    1111#ifndef MYYSTYPE
     
    119119  RESERVEDNAME_CMD,
    120120  RESULTANT_CMD,
    121   RINGLIST_CMD,
    122121  ROWS_CMD,
    123122  SIMPLEX_CMD,
     
    157156*/
    158157
    159 #define Sy_bit(x)     (1<<(x))
     158#define Sy_bit(x)     ((unsigned)1<<(x))
    160159#define Sy_inset(x,s) ((Sy_bit(x)&(s))?TRUE:FALSE)
    161160#define BTEST1(a)     Sy_inset((a), test)
     
    205204#define OPT_WEIGHTM       31
    206205
    207 /* define ring dependent options */
     206/* define ring dependent options */ 
    208207#define TEST_RINGDEP_OPTS \
    209208 (Sy_bit(OPT_INTSTRATEGY) | Sy_bit(OPT_REDTHROUGH) | Sy_bit(OPT_REDTAIL))
Note: See TracChangeset for help on using the changeset viewer.