Changeset 25003c in git


Ignore:
Timestamp:
Apr 29, 1998, 9:05:32 AM (25 years ago)
Author:
Thomas Siebert <siebert@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
78ed39468e4c15713f8fffc0ca2afb422840e509
Parents:
fda59838bf7766c167e43fc1566967f60c60783f
Message:
*** empty log message ***


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

Legend:

Unmodified
Added
Removed
  • Singular/ideals.cc

    rfda5983 r25003c  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ideals.cc,v 1.22 1998-04-22 07:48:54 Singular Exp $ */
     4/* $Id: ideals.cc,v 1.23 1998-04-29 07:05:25 siebert Exp $ */
    55/*
    66* ABSTRACT - all basic methods to manipulate ideals
     
    21482148
    21492149  // change into the new ring
    2150   pChangeRing(pVariables,currRing->OrdSgn,ord,block0,block1,wv);
    2151   //  rChangeCurrRing(&tmpR, FALSE);
     2150  //pChangeRing(pVariables,currRing->OrdSgn,ord,block0,block1,wv);
     2151  rChangeCurrRing(&tmpR, TRUE);
    21522152  currRing = &tmpR;
    21532153  h = idInit(IDELEMS(h1),1);
     
    21592159
    21602160  // go back to the original ring
    2161   rChangeCurrRing(origR,FALSE);
     2161  rChangeCurrRing(origR,TRUE);
    21622162  i = IDELEMS(hh)-1;
    21632163  while ((i >= 0) && (hh->m[i] == NULL)) i--;
  • Singular/iparith.cc

    rfda5983 r25003c  
    16811681  }
    16821682  int l=0;
    1683   resolvente r;
     1683  //resolvente r;
     1684  syStrategy r;
    16841685  intvec **weights=NULL;
    16851686  int wmaxl=maxl;
     
    16891690  if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
    16901691  {
    1691     if (BTEST1(28))
    1692     {
    1693       r=syMinRes((ideal)u->Data(),maxl,&l, iiOp==MRES_CMD);
    1694     }
    1695     else
     1692    //if (BTEST1(28))
     1693    //{
     1694    //  r=syMinRes((ideal)u->Data(),maxl,&l, iiOp==MRES_CMD);
     1695    //}
     1696    //else
    16961697    {
    16971698      intvec * iv=(intvec*)atGet(u,"isHomog");
    1698       if (iv!=NULL)
    1699       {
    1700         weights = (intvec**)Alloc0(sizeof(intvec*));
    1701         weights[0] = ivCopy(iv);
    1702         l=1;
    1703       }
    1704       r=syResolvente((ideal)u->Data(),maxl,&l, &weights, iiOp==MRES_CMD);
     1699      //if (iv!=NULL)
     1700      //{
     1701      //  weights = (intvec**)Alloc0(sizeof(intvec*));
     1702      //  weights[0] = ivCopy(iv);
     1703      //  l=1;
     1704      //}
     1705      //r=syResolvente((ideal)u->Data(),maxl,&l, &weights, iiOp==MRES_CMD);
     1706      r=syResolution((ideal)u->Data(),maxl, iv, iiOp==MRES_CMD);
    17051707    }
    17061708  }
    17071709  else
    1708     r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
     1710  //  r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
     1711    r=sySchreyer((ideal)u->Data(),maxl+1);
    17091712  if (r==NULL) return TRUE;
    1710   res->data=(void *)liMakeResolv(r,l,wmaxl,u->Typ(),weights);
    1711   //res->data=(void *)syMakeResolution(r,l);
     1713  //res->data=(void *)liMakeResolv(r,l,wmaxl,u->Typ(),weights);
     1714  res->data=(void *)r;
    17121715  return FALSE;
    17131716}
     
    20502053,{jjMODULO,    MODULO_CMD,     MODUL_CMD,      MODUL_CMD,  MODUL_CMD PROFILER}
    20512054,{jjMONITOR2,  MONITOR_CMD,    NONE,           STRING_CMD, STRING_CMD PROFILER}
    2052 ,{jjRES,       MRES_CMD,       LIST_CMD,       IDEAL_CMD,  INT_CMD PROFILER}
    2053 ,{jjRES,       MRES_CMD,       LIST_CMD,       MODUL_CMD,  INT_CMD PROFILER}
    2054 //,{jjRES,       MRES_CMD,       RESOLUTION_CMD, IDEAL_CMD,  INT_CMD PROFILER}
    2055 //,{jjRES,       MRES_CMD,       RESOLUTION_CMD, MODUL_CMD,  INT_CMD PROFILER}
     2055//,{jjRES,       MRES_CMD,       LIST_CMD,       IDEAL_CMD,  INT_CMD PROFILER}
     2056//,{jjRES,       MRES_CMD,       LIST_CMD,       MODUL_CMD,  INT_CMD PROFILER}
     2057,{jjRES,       MRES_CMD,       RESOLUTION_CMD, IDEAL_CMD,  INT_CMD PROFILER}
     2058,{jjRES,       MRES_CMD,       RESOLUTION_CMD, MODUL_CMD,  INT_CMD PROFILER}
    20562059,{jjPARSTR2,   PARSTR_CMD,     STRING_CMD,     RING_CMD,   INT_CMD PROFILER}
    20572060,{jjPARSTR2,   PARSTR_CMD,     STRING_CMD,     QRING_CMD,  INT_CMD PROFILER}
     
    20682071,{jjREDUCE_ID, REDUCE_CMD,     MODUL_CMD,      MODUL_CMD,  MODUL_CMD PROFILER}
    20692072,{jjREDUCE_ID, REDUCE_CMD,     MODUL_CMD,      MODUL_CMD,  IDEAL_CMD PROFILER}
    2070 ,{jjRES,       RES_CMD,        LIST_CMD,       IDEAL_CMD,  INT_CMD PROFILER}
    2071 ,{jjRES,       RES_CMD,        LIST_CMD,       MODUL_CMD,  INT_CMD PROFILER}
    2072 //,{jjRES,       RES_CMD,        RESOLUTION_CMD, IDEAL_CMD,  INT_CMD PROFILER}
    2073 //,{jjRES,       RES_CMD,        RESOLUTION_CMD, MODUL_CMD,  INT_CMD PROFILER}
     2073//,{jjRES,       RES_CMD,        LIST_CMD,       IDEAL_CMD,  INT_CMD PROFILER}
     2074//,{jjRES,       RES_CMD,        LIST_CMD,       MODUL_CMD,  INT_CMD PROFILER}
     2075,{jjRES,       RES_CMD,        RESOLUTION_CMD, IDEAL_CMD,  INT_CMD PROFILER}
     2076,{jjRES,       RES_CMD,        RESOLUTION_CMD, MODUL_CMD,  INT_CMD PROFILER}
    20742077,{jjSTATUS2,   STATUS_CMD,     STRING_CMD,     LINK_CMD,   STRING_CMD PROFILER}
    20752078,{jjSIMPL_P,   SIMPLIFY_CMD,   POLY_CMD,       POLY_CMD,   INT_CMD PROFILER}
     
    20772080,{jjSIMPL_ID,  SIMPLIFY_CMD,   IDEAL_CMD,      IDEAL_CMD,  INT_CMD PROFILER}
    20782081,{jjSIMPL_ID,  SIMPLIFY_CMD,   MODUL_CMD,      MODUL_CMD,  INT_CMD PROFILER}
    2079 ,{jjRES,       SRES_CMD,       LIST_CMD,       IDEAL_CMD,  INT_CMD PROFILER}
    2080 ,{jjRES,       SRES_CMD,       LIST_CMD,       MODUL_CMD,  INT_CMD PROFILER}
    2081 //,{jjRES,       SRES_CMD,       RESOLUTION_CMD, IDEAL_CMD,  INT_CMD PROFILER}
    2082 //,{jjRES,       SRES_CMD,       RESOLUTION_CMD, MODUL_CMD,  INT_CMD PROFILER}
     2082//,{jjRES,       SRES_CMD,       LIST_CMD,       IDEAL_CMD,  INT_CMD PROFILER}
     2083//,{jjRES,       SRES_CMD,       LIST_CMD,       MODUL_CMD,  INT_CMD PROFILER}
     2084,{jjRES,       SRES_CMD,       RESOLUTION_CMD, IDEAL_CMD,  INT_CMD PROFILER}
     2085,{jjRES,       SRES_CMD,       RESOLUTION_CMD, MODUL_CMD,  INT_CMD PROFILER}
    20832086,{jjCALL2MANY, SYSTEM_CMD,     ANY_TYPE/*set by p*/,STRING_CMD, DEF_CMD PROFILER}
    20842087,{jjSTD_1,     STD_CMD,        IDEAL_CMD,      IDEAL_CMD,  POLY_CMD PROFILER}
     
    32133216,{jjREGULARITY, REGULARITY_CMD,  INT_CMD,        LIST_CMD }
    32143217,{jjRESERVEDNAME,RESERVEDNAME_CMD, INT_CMD,      STRING_CMD }
    3215 //,{jjL2R,        RESOLUTION_CMD,  RESOLUTION_CMD, LIST_CMD }
     3218,{jjL2R,        RESOLUTION_CMD,  RESOLUTION_CMD, LIST_CMD }
    32163219,{jjDUMMY,      RESOLUTION_CMD,  RESOLUTION_CMD, RESOLUTION_CMD }
    32173220,{jjWRONG,      ROWS_CMD,        0,              POLY_CMD }
  • Singular/lists.cc

    rfda5983 r25003c  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: lists.cc,v 1.6 1998-04-01 18:59:29 Singular Exp $ */
     4/* $Id: lists.cc,v 1.7 1998-04-29 07:05:29 siebert Exp $ */
    55/*
    66* ABSTRACT: handling of the list type
     
    1414#include "attrib.h"
    1515#include "ipshell.h"
     16#include "intvec.h"
    1617#include "lists.h"
    1718
     
    208209    L->Init(reallen);
    209210    int i=0;
    210  
     211
    211212    while (i<length)
    212213    {
     
    276277}
    277278
    278 resolvente liFindRes(lists L, int * len, int *typ0)
     279resolvente liFindRes(lists L, int * len, int *typ0,intvec *** weights)
    279280{
    280281  resolvente r;
     282  intvec ** w=NULL,*tw=NULL;
    281283
    282284  *len=L->nr+1;
     
    287289  }
    288290  r=(ideal *)Alloc0((*len)*sizeof(ideal));
     291  w=(intvec**)Alloc0((*len)*sizeof(intvec*));
    289292  int i=0;
    290293  *typ0=MODUL_CMD;
     
    307310    }
    308311    r[i]=(ideal)L->m[i].data;
     312    tw=(intvec*)atGet((idhdl)&L->m[i],mstrdup("isHomog"));
     313    if (tw!=NULL)
     314    {
     315      w[i]=ivCopy(tw);
     316    }
     317    tw = NULL;
    309318    i++;
     319  }
     320  BOOLEAN hom_complex=TRUE;
     321  int j=0;
     322  while ((j<i) && hom_complex)
     323  {
     324    hom_complex = hom_complex && (w[i]!=NULL);
     325    j++;
     326  }
     327  if ((!hom_complex) || (weights==NULL))
     328  {
     329    for (j=0;j<i;j++)
     330      if (w[j]!=NULL) delete w[j];
     331    Free((ADDRESS)w,(*len)*sizeof(intvec*));
     332  }
     333  else
     334  {
     335    *weights = w;
    310336  }
    311337  //Print("find res of length %d (0..%d) L:%d\n",*len,(*len)-1,L->nr);
  • Singular/lists.h

    rfda5983 r25003c  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: lists.h,v 1.3 1997-04-09 12:19:55 Singular Exp $ */
     6/* $Id: lists.h,v 1.4 1998-04-29 07:05:29 siebert Exp $ */
    77/*
    88* ABSTRACT: handling of the list type
     
    5050
    5151lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec ** weights);
    52 resolvente liFindRes(lists L, int * len, int *typ0);
     52resolvente liFindRes(lists L, int * len, int *typ0,intvec *** weights=NULL);
    5353#endif
  • Singular/syz.cc

    rfda5983 r25003c  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz.cc,v 1.8 1998-01-17 18:08:00 Singular Exp $ */
     4/* $Id: syz.cc,v 1.9 1998-04-29 07:05:30 siebert Exp $ */
    55
    66/*
     
    391391}
    392392
     393syStrategy syResolution(ideal arg, int maxlength,intvec * w, BOOLEAN minim)
     394{
     395  int typ0;
     396  syStrategy result=(syStrategy)Alloc0(sizeof(ssyStrategy));
     397
     398  if (w!=NULL)
     399  {
     400    result->weights = (intvec**)Alloc0(sizeof(intvec*));
     401    (result->weights)[0] = ivCopy(w);
     402    result->length = 1;
     403  }
     404  resolvente fr = syResolvente(arg,maxlength,&(result->length),&(result->weights),minim),fr1;
     405  if (minim)
     406  {
     407    result->minres = (resolvente)Alloc0((result->length+1)*sizeof(ideal));
     408    fr1 =  result->minres;
     409  }
     410  else
     411  {
     412    result->fullres = (resolvente)Alloc0((result->length+1)*sizeof(ideal));
     413    fr1 =  result->fullres;
     414  }
     415  for (int i=result->length-1;i>=0;i--)
     416  {
     417    if (fr[i]!=NULL)
     418      fr1[i] = fr[i];
     419    fr[i] = NULL;
     420  }
     421  Free((ADDRESS)fr,(result->length)*sizeof(ideal));
     422  return result;
     423}
     424
     425
    393426resolvente syMinRes(ideal arg, int maxlength, int * length, BOOLEAN minim)
    394427{
     
    676709    cols--;
    677710  }
     711  intvec * result;
     712  if (idIs0(res[0]))
     713  {
     714    if (res[0]==NULL)
     715      result = new intvec(1,1,1);
     716    else
     717      result = new intvec(1,1,res[0]->rank);
     718    return result;
     719  }
    678720  l = max(idRankFreeModule(res[0]),res[0]->rank);
    679721  i = 0;
     
    713755  }
    714756  /*------ computation betti numbers --------------*/
    715   intvec * result = new intvec(rows,cols,0);
     757  result = new intvec(rows,cols,0);
    716758  (*result)[0] = /*idRankFreeModule(res[0])*/ res[0]->rank;
    717759  if ((!idIs0(res[0])) && ((*result)[0]==0)) (*result)[0] = 1;
  • Singular/syz.h

    rfda5983 r25003c  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: syz.h,v 1.7 1998-04-03 17:38:44 Singular Exp $ */
     6/* $Id: syz.h,v 1.8 1998-04-29 07:05:30 siebert Exp $ */
    77/*
    88* ABSTRACT: Resolutions
     
    3333  int ** Howmuch;
    3434  int ** Firstelem;
     35  intvec ** weights;
    3536  resolvente res;
    3637  resolvente orderedRes;
     
    5556   BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE);
    5657
     58syStrategy sySchreyer(ideal arg, int maxlength);
     59
    5760resolvente syResolvente(ideal arg, int maxlength, int * length,
    5861                        intvec *** weights, BOOLEAN minim);
     62
     63syStrategy syResolution(ideal arg, int maxlength,intvec * w, BOOLEAN minim);
    5964
    6065resolvente syMinRes(ideal arg, int maxlength, int * length, BOOLEAN minim);
     
    8590syStrategy syForceMin(lists li);
    8691syStrategy syMinimize(syStrategy syzstr);
    87 syStrategy syMakeResolution(resolvente r, int length);
    8892#endif
  • Singular/syz0.cc

    rfda5983 r25003c  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz0.cc,v 1.14 1998-03-04 15:14:54 obachman Exp $ */
     4/* $Id: syz0.cc,v 1.15 1998-04-29 07:05:31 siebert Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    737737  sip_sring tmpR;
    738738
    739 #ifdef THROW_IT_AWAY_EVENTUALLY
    740   if((hom==isHomog)
    741   &&(maxlength==pVariables-1)
    742   &&(currQuotient==NULL)
    743   &&(idRankFreeModule(arg)==0)
    744   &&(!idIs0(arg)))
    745   {
    746    return syLaScala1(arg,length);
    747   } 
    748 #endif
    749  
    750739  if ((!isMonomial) && syTestOrder(arg))
    751740  {
     
    822811        tmpR.wvhdl = wv;
    823812        rComplete(&tmpR);
    824         rChangeCurrRing(&tmpR, FALSE);
     813        rChangeCurrRing(&tmpR, TRUE);
    825814      }
    826815    }
     
    856845  return res;
    857846}
     847
     848syStrategy sySchreyer(ideal arg, int maxlength)
     849{
     850  int typ0;
     851  syStrategy result=(syStrategy)Alloc0(sizeof(ssyStrategy));
     852
     853  resolvente fr = sySchreyerResolvente(arg,maxlength,&(result->length));
     854  result->fullres = (resolvente)Alloc0((result->length+1)*sizeof(ideal));
     855  for (int i=result->length-1;i>=0;i--)
     856  {
     857    if (fr[i]!=NULL)
     858      result->fullres[i] = fr[i];
     859      fr[i] = NULL;
     860  }
     861  Free((ADDRESS)fr,(result->length)*sizeof(ideal));
     862  return result;
     863}
     864
  • Singular/syz1.cc

    rfda5983 r25003c  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz1.cc,v 1.24 1998-04-03 17:38:45 Singular Exp $ */
     4/* $Id: syz1.cc,v 1.25 1998-04-29 07:05:32 siebert Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    18751875          }
    18761876        }
     1877        if (syzstr->weights!=0)
     1878        {
     1879          if (syzstr->weights[i]!=NULL)
     1880          {
     1881            delete syzstr->weights[i];
     1882          }
     1883          Free((ADDRESS)syzstr->weights,syzstr->length*sizeof(intvec*));
     1884        }
    18771885        idDelete(&(syzstr->res[i]));
    18781886        Free((ADDRESS)syzstr->resPairs[i],(*syzstr->Tl)[i]*sizeof(SObject));
     
    22362244    tr = syzstr->fullres;
    22372245  resolvente trueres=NULL;
     2246  intvec ** w=NULL;
    22382247  if (syzstr->length>0)
    22392248  {
     
    22462255      }
    22472256    }
    2248     if (idRankFreeModule(trueres[0])>0)
     2257    if (idRankFreeModule(trueres[0]) > 0)
    22492258      typ0 = MODUL_CMD;
    2250   }   
    2251   return liMakeResolv(trueres,syzstr->length,-1,typ0,NULL);
     2259    if (syzstr->weights!=NULL)
     2260    {
     2261      w = (intvec**)Alloc0((syzstr->length)*sizeof(intvec*));
     2262      for (int i=(syzstr->length)-1;i>=0;i--)
     2263      {
     2264        if (syzstr->weights[i]!=NULL) w[i] = ivCopy(syzstr->weights[i]);
     2265      }
     2266    }
     2267  }
     2268  return liMakeResolv(trueres,syzstr->length,-1,typ0,w);
    22522269}
    22532270
     
    22572274  syStrategy result=(syStrategy)Alloc0(sizeof(ssyStrategy));
    22582275
    2259   resolvente fr = liFindRes(li,&(result->length),&typ0);
     2276  resolvente fr = liFindRes(li,&(result->length),&typ0,&(result->weights));
    22602277  result->fullres = (resolvente)Alloc0((result->length+1)*sizeof(ideal));
    22612278  for (int i=result->length-1;i>=0;i--)
     
    22652282  }
    22662283  Free((ADDRESS)fr,(result->length)*sizeof(ideal));
    2267   return result;
    2268 }
    2269 
    2270 syStrategy syMakeResolution(resolvente r, int length,
    2271            intvec ** weights)
    2272 {
    2273   syStrategy result=(syStrategy)Alloc0(sizeof(ssyStrategy));
    2274 
    2275   length = max(length,0);
    2276   int i=0;
    2277  
    2278   while (i<length)
    2279   {
    2280     if (r[i]!=NULL)
    2281     {
    2282       if (i!=0)
    2283       {
    2284         int rank=IDELEMS(r[i-1]);
    2285         if (idIs0(r[i-1]))
    2286         {
    2287           idDelete(&(r[i]));
    2288           r[i]=idFreeModule(rank);
    2289         }
    2290         else
    2291         {
    2292           r[i]->rank=max(rank,idRankFreeModule(r[i]));
    2293         }
    2294         idSkipZeroes(r[i]);
    2295       }
    2296     }
    2297     else
    2298     {
    2299       // should not happen:
    2300       Warn("internal NULL in resolvente");
    2301       r[i]=idInit(1,1);
    2302     }
    2303     i++;
    2304   }
    2305   result->fullres = r;
    2306   result->length = length;
    23072284  return result;
    23082285}
     
    24622439  intvec * Strip;
    24632440  resolvente tres=(resolvente)Alloc0((syzstr->length+1)*sizeof(ideal));
     2441  sip_sring tmpR;
     2442  ring origR = currRing;
     2443
    24642444  if (computeStd)
    24652445  {
     
    24922472    b0[1] = 1;
    24932473    b1[0] = pVariables;
     2474    tmpR  = *origR;
     2475    tmpR.order = ord;
     2476    tmpR.block0 = b0;
     2477    tmpR.block1 = b1;
     2478    //rComplete(&tmpR);
    24942479    pChangeRing(pVariables,1,ord,b0,b1,currRing->wvhdl);
     2480    //rChangeCurrRing(&tmpR, TRUE);
    24952481  }
    24962482#if ! defined(HAVE_SY_VECTOR) || defined(SY_VEC_DEBUG) 
     
    25412527    pChangeRing(pVariables,currRing->OrdSgn,currRing->order,
    25422528    currRing->block0,currRing->block1,currRing->wvhdl);
     2529    //rChangeCurrRing(origR,TRUE);
    25432530  }
    25442531  else
     
    25862573}
    25872574
    2588 #if THROW_IT_AWAY_EVENTUALLY
    25892575/*2
    25902576* implementation of LaScala's algorithm
     
    25922578* works with slanted degree, uses syChosePairs
    25932579*/
    2594 //syStrategy syLaScala1(ideal arg,int * length)
    2595 resolvente syLaScala1(ideal arg,int * length)
     2580syStrategy syLaScala3(ideal arg,int * length)
    25962581{
    25972582  BOOLEAN noPair=FALSE;
     
    26022587  SSet nextPairs;
    26032588  syStrategy syzstr=(syStrategy)Alloc0(sizeof(ssyStrategy));
    2604   pSetmProc oldSetm=pSetm;
    2605   pCompProc oldComp0=pComp0;
    2606 
    2607   //crit = 0;
    2608   //zeroRed = 0;
    2609   //simple = 0;
    2610   //dsim = 0;
    2611   euler = -1;
    2612   redpol = pInit();
    2613   //orderingdepth = new intvec(pVariables+1);
    2614   if (*length<=0) *length = pVariables+2;
    2615   syzstr->length = *length;
    2616   if (idIs0(arg)) return NULL;
    2617   if ((currRing->order[0]==ringorder_dp)
    2618   &&  (currRing->order[1]==ringorder_C)
    2619   &&  (currRing->order[2]==0))
    2620   {
    2621     ord=NULL;
    2622   } 
    2623 /*--- changes to a dpC-ring with special comp0------*/
    2624   else
    2625   {
    2626     ord = (int*)Alloc0(3*sizeof(int));
    2627     b0 = (int*)Alloc0(3*sizeof(int));
    2628     b1 = (int*)Alloc0(3*sizeof(int));
    2629     ord[0] = ringorder_dp;
    2630     ord[1] = ringorder_C;
    2631     b0[1] = 1;
    2632     b1[0] = pVariables;
    2633     pChangeRing(pVariables,1,ord,b0,b1,currRing->wvhdl);
    2634   } 
    2635 /*--- initializes the data structures---------------*/
    2636   syzstr->Tl = new intvec(*length);
    2637   temp = idInit(IDELEMS(arg),arg->rank);
    2638   for (i=0;i<IDELEMS(arg);i++)
    2639   {
    2640     temp->m[i] = pOrdPolyInsertSetm(pCopy(arg->m[i]));
    2641     if (temp->m[i]!=NULL)
    2642     {
    2643       j = pTotaldegree(temp->m[i]);
    2644       if (j<actdeg) actdeg = j;
    2645     }
    2646   }
    2647   sySetHighdeg();
    2648   binomials = (int*)Alloc(pVariables*(highdeg+1)*sizeof(int));
    2649   syBinomSet();
    2650   pSetm =syzSetm;
    2651   for (i=0;i<IDELEMS(arg);i++)
    2652   {
    2653     p = temp->m[i];
    2654     while (p!=NULL)
    2655     {
    2656       pSetm(p);
    2657       pIter(p);
    2658     }
    2659   }
    2660   pComp0 = syzcomp2dpc;
    2661   syzstr->resPairs = syInitRes(temp,length,syzstr->Tl);
    2662   syzstr->res = (resolvente)Alloc0((*length+1)*sizeof(ideal));
    2663   syzstr->orderedRes = (resolvente)Alloc0((*length+1)*sizeof(ideal));
    2664   syzstr->truecomponents = (int**)Alloc0((*length+1)*sizeof(int*));
    2665   syzstr->backcomponents = (int**)Alloc0((*length+1)*sizeof(int*));
    2666   syzstr->Howmuch = (int**)Alloc0((*length+1)*sizeof(int*));
    2667   syzstr->Firstelem = (int**)Alloc0((*length+1)*sizeof(int*));
    2668   int len0=idRankFreeModule(arg)+1;
    2669   syzstr->truecomponents[0] = (int*)Alloc(len0*sizeof(int));
    2670   syzstr->backcomponents[0] = (int*)Alloc(len0*sizeof(int));
    2671   syzstr->Howmuch[0] = (int*)Alloc(len0*sizeof(int));
    2672   syzstr->Firstelem[0] = (int*)Alloc(len0*sizeof(int));
    2673 //Print("sort %d has now size %d\n",0,len0);
    2674   for (i=0;i<len0;i++)
    2675     syzstr->truecomponents[0][i] = i;
    2676   startdeg = actdeg;
    2677   nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
    2678   //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
    2679 /*--- computes the resolution ----------------------*/
    2680   while (nextPairs!=NULL)
    2681   {
    2682     if (TEST_OPT_PROT) Print("%d",actdeg);
    2683     if (TEST_OPT_PROT) Print("(m%d)",index);
    2684     currcomponents = syzstr->truecomponents[max(index-1,0)];
    2685     i = syInitSyzMod(syzstr,index);
    2686     j = syInitSyzMod(syzstr,index+1);
    2687     if (index>0)
    2688     {
    2689       syRedNextPairs(nextPairs,syzstr,howmuch,index);
    2690       syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
    2691     }
    2692     else
    2693       syRedGenerOfCurrDeg(syzstr,actdeg,index+1);
    2694 /*--- creates new pairs -----------------------------*/     
    2695     syCreateNewPairs(syzstr,index,i);
    2696     if (index<(*length)-1)
    2697     {
    2698       syCreateNewPairs(syzstr,index+1,j);
    2699       //currcomponents = syzstr->truecomponents[index];
    2700       //sySyzTail(syzstr,index+1,j);
    2701       //currcomponents = syzstr->truecomponents[index-1];
    2702     }
    2703     index++;
    2704     nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
    2705     //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
    2706   }
    2707   //return syzstr;
    2708 //}
    2709 /*--- deletes temporary data structures-------------*/
    2710   idDelete(&temp);
    2711   for (i=0;i<*length;i++)
    2712   {
    2713     for (j=0;j<(*syzstr->Tl)[i];j++)
    2714     {
    2715       if ((syzstr->resPairs[i])[j].lcm!=NULL)
    2716         pDelete(&((syzstr->resPairs[i])[j].lcm));
    2717     }
    2718     if (syzstr->orderedRes[i]!=NULL)
    2719     {
    2720       for (j=0;j<IDELEMS(syzstr->orderedRes[i]);j++)
    2721         syzstr->orderedRes[i]->m[j] = NULL;
    2722     }
    2723     idDelete(&(syzstr->orderedRes[i]));
    2724     if (syzstr->truecomponents[i]!=NULL)
    2725     {
    2726       Free((ADDRESS)syzstr->truecomponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
    2727       syzstr->truecomponents[i]=NULL;
    2728     }
    2729     if (syzstr->backcomponents[i]!=NULL)
    2730     {
    2731       Free((ADDRESS)syzstr->backcomponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
    2732       syzstr->backcomponents[i]=NULL;
    2733     }
    2734     if (syzstr->Howmuch[i]!=NULL)
    2735     {
    2736       Free((ADDRESS)syzstr->Howmuch[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
    2737       syzstr->Howmuch[i]=NULL;
    2738     }
    2739     if (syzstr->Firstelem[i]!=NULL)
    2740     {
    2741       Free((ADDRESS)syzstr->Firstelem[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
    2742       syzstr->Firstelem[i]=NULL;
    2743     }
    2744     Free((ADDRESS)syzstr->resPairs[i],(*syzstr->Tl)[i]*sizeof(SObject));
    2745   }
    2746   Free((ADDRESS)syzstr->resPairs,*length*sizeof(SObject*));
    2747   Free((ADDRESS)syzstr->orderedRes,(*length+1)*sizeof(ideal));
    2748   Free((ADDRESS)syzstr->truecomponents,(*length+1)*sizeof(int*));
    2749   Free((ADDRESS)syzstr->backcomponents,(*length+1)*sizeof(int*));
    2750   Free((ADDRESS)syzstr->Howmuch,(*length+1)*sizeof(int*));
    2751   Free((ADDRESS)syzstr->Firstelem,(*length+1)*sizeof(int*));
    2752   syzstr->truecomponents = NULL;
    2753   syzstr->backcomponents = NULL;
    2754   syzstr->Howmuch = NULL;
    2755   syzstr->Firstelem = NULL;
    2756   if (BTEST1(6)) syStatistics(syzstr->res,(*length+1));
    2757   (*length)++;
    2758 /*--- changes to the original ring------------------*/
    2759   if (ord!=NULL)
    2760   {
    2761     pChangeRing(pVariables,currRing->OrdSgn,currRing->order,
    2762     currRing->block0,currRing->block1,currRing->wvhdl);
    2763   }
    2764   else
    2765   {
    2766     pSetm=oldSetm;
    2767     pComp0=oldComp0;
    2768   }
    2769   syReOrderResolventFB(syzstr->res,*length,2);
    2770   for (i=0;i<*length-1;i++)
    2771   {
    2772     syzstr->res[i] = syzstr->res[i+1];
    2773     if (syzstr->res[i]!=NULL)
    2774     {
    2775       polyset rsi = syzstr->res[i]->m;
    2776       if (i>0)
    2777       {
    2778         for (j=IDELEMS(syzstr->res[i])-1;j>=0;j--)
    2779         {
    2780           rsi[j] = syOrdPolySchreyer(rsi[j]);
    2781         }
    2782       }
    2783       else
    2784       {
    2785         if (ord!=NULL)
    2786         {
    2787           for (j=IDELEMS(syzstr->res[i])-1;j>=0;j--)
    2788           {
    2789             rsi[j] = pOrdPolyInsertSetm(rsi[j]);
    2790           }
    2791         }
    2792         else
    2793         {
    2794           for (j=IDELEMS(syzstr->res[i])-1;j>=0;j--)
    2795           {
    2796             p = rsi[j];
    2797             while (p!=NULL)
    2798             {
    2799               pSetm(p);
    2800               pIter(p);
    2801             }
    2802           }
    2803         }
    2804       }
    2805       idSkipZeroes(syzstr->res[i]);
    2806     }
    2807   }
    2808   syzstr->res[*length-1] = NULL;
    2809   if (ord!=NULL)
    2810   {
    2811     Free((ADDRESS)ord,3*sizeof(int));
    2812     Free((ADDRESS)b0,3*sizeof(int));
    2813     Free((ADDRESS)b1,3*sizeof(int));
    2814   } 
    2815   Free((ADDRESS)binomials,pVariables*(highdeg_1)*sizeof(int));
    2816   pDelete1(&redpol);
    2817   if (TEST_OPT_PROT)
    2818   {
    2819     //Print("simple: %d\n",simple);
    2820     //Print("dsim: %d\n",dsim);
    2821     //Print("crit %d-times used \n",crit);
    2822     //Print("%d reductions to zero \n",zeroRed);
    2823   }
    2824   //delete orderingdepth;
    2825   if (TEST_OPT_PROT) PrintLn();
    2826   return syzstr->res;
    2827 }
    2828 #endif
    2829 
    2830 /*2
    2831 * implementation of LaScala's algorithm
    2832 * assumes that the given module is homogeneous
    2833 * works with slanted degree, uses syChosePairs
    2834 */
    2835 syStrategy syLaScala3(ideal arg,int * length)
    2836 {
    2837   BOOLEAN noPair=FALSE;
    2838   int i,j,* ord,*b0,*b1,actdeg=32000,index=0,reg=-1;
    2839   int startdeg,howmuch;
    2840   poly p;
    2841   ideal temp;
    2842   SSet nextPairs;
    2843   syStrategy syzstr=(syStrategy)Alloc0(sizeof(ssyStrategy));
     2589  sip_sring tmpR;
     2590  ring origR = currRing;
     2591
    28442592  if ((idIs0(arg)) ||
    28452593      ((idRankFreeModule(arg)>0) && (!idHomModule(arg,NULL,&(syzstr->cw)))))
     
    28782626    b0[1] = 1;
    28792627    b1[0] = pVariables;
     2628    tmpR  = *origR;
     2629    tmpR.order = ord;
     2630    tmpR.block0 = b0;
     2631    tmpR.block1 = b1;
     2632    //rComplete(&tmpR);
    28802633    pChangeRing(pVariables,1,ord,b0,b1,currRing->wvhdl);
     2634    //rChangeCurrRing(&tmpR, TRUE);
    28812635  } 
    28822636/*--- initializes the data structures---------------*/
     
    29692723    pChangeRing(pVariables,currRing->OrdSgn,currRing->order,
    29702724    currRing->block0,currRing->block1,currRing->wvhdl);
     2725    //rChangeCurrRing(origR,TRUE);
    29712726  }
    29722727  else
     
    29872742  return syzstr;
    29882743}
    2989 /*2
    2990 * second implementation of LaScala's algorithm
    2991 * assumes that the given module is homogeneous
    2992 * works deg by deg, uses syChosePairs1
    2993 */
    2994 /*
    2995 *resolvente syLaScala2(ideal arg,int * length)
    2996 *{
    2997 *  BOOLEAN noPair=FALSE;
    2998 *  int i,j,* ord,*b0,*b1,actdeg=32000,index=1,reg=-1;
    2999 *  int startdeg,howmuch;
    3000 *  intvec * Tl;
    3001 *  poly p;
    3002 *  ideal temp;
    3003 *  resolvente res,orderedRes;
    3004 *  SSet nextPairs;
    3005 *  SRes resPairs;
    3006 *
    3007 *  //crit = 0;
    3008 *  //zeroRed = 0;
    3009 *  //simple = 0;
    3010 *  //dsim = 0;
    3011 *  redpol = pNew();
    3012 *  //orderingdepth = new intvec(pVariables+1);
    3013 *  if (*length<=0) *length = pVariables+2;
    3014 *  if (idIs0(arg)) return NULL;
    3015 //--- changes to a dpC-ring with special comp0------
    3016 *  ord = (int*)Alloc0(3*sizeof(int));
    3017 *  b0 = (int*)Alloc0(3*sizeof(int));
    3018 *  b1 = (int*)Alloc0(3*sizeof(int));
    3019 *  ord[0] = ringorder_dp;
    3020 *  ord[1] = ringorder_C;
    3021 *  b0[1] = 1;
    3022 *  b1[0] = pVariables;
    3023 *  pChangeRing(pVariables,1,ord,b0,b1,currRing->wvhdl);
    3024 //--- initializes the data structures---------------
    3025 *  Tl = new intvec(*length);
    3026 *  temp = idInit(IDELEMS(arg),arg->rank);
    3027 *  for (i=0;i<IDELEMS(arg);i++)
    3028 *  {
    3029 *    temp->m[i] = pOrdPolyInsertSetm(pCopy(arg->m[i]));
    3030 *    if (temp->m[i]!=NULL)
    3031 *    {
    3032 *      j = pTotaldegree(temp->m[i]);
    3033 *      if (j<actdeg) actdeg = j;
    3034 *    }
    3035 *  }
    3036 *  {
    3037 *    highdeg=1;
    3038 *    long long t=1;
    3039 *    long long h_n=1+pVariables;
    3040 *    while ((t=(((long long)t*(long long)h_n)/(long long)highdeg))<INT_MAX)
    3041 *    {
    3042 *      highdeg++;
    3043 *      h_n++;
    3044 *    }
    3045 *    highdeg--;
    3046 *    Print("max deg=%d\n",highdeg);
    3047 *  } 
    3048 *  binomials = (int*)Alloc(pVariables*(highdeg+1)*sizeof(int));
    3049 *  syBinomSet();
    3050 *  pSetm =syzSetm;
    3051 *  for (i=0;i<IDELEMS(arg);i++)
    3052 *  {
    3053 *    p = temp->m[i];
    3054 *    while (p!=NULL)
    3055 *    {
    3056 *      pSetm(p);
    3057 *      pIter(p);
    3058 *    }
    3059 *  }
    3060 *  pComp0 = syzcomp2dpc;
    3061 *  resPairs = syInitRes(temp,length,Tl);
    3062 *  res = (resolvente)Alloc0((*length+1)*sizeof(ideal));
    3063 *  orderedRes = (resolvente)Alloc0((*length+1)*sizeof(ideal));
    3064 *  truecomponents = (int**)Alloc0((*length+1)*sizeof(int*));
    3065 *  backcomponents = (int**)Alloc0((*length+1)*sizeof(int*));
    3066 *  Howmuch = (int**)Alloc0((*length+1)*sizeof(int*));
    3067 *  Firstelem = (int**)Alloc0((*length+1)*sizeof(int*));
    3068 *  int len0=idRankFreeModule(arg)+1;
    3069 *  truecomponents[0] = (int*)Alloc(len0*sizeof(int));
    3070 *  backcomponents[0] = (int*)Alloc(len0*sizeof(int));
    3071 *  Howmuch[0] = (int*)Alloc(len0*sizeof(int));
    3072 *  Firstelem[0] = (int*)Alloc(len0*sizeof(int));
    3073 //Print("sort %d has now size %d\n",0,len0);
    3074 *  for (i=0;i<len0;i++)
    3075 *    truecomponents[0][i] = i;
    3076 *  startdeg = actdeg;
    3077 *  nextPairs = syChosePairs1(resPairs,Tl,&index,&howmuch,*length,&actdeg);
    3078 *  if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
    3079 //--- computes the resolution ----------------------
    3080 *  while (nextPairs!=NULL)
    3081 *  {
    3082 *    if (TEST_OPT_PROT) Print("%d",actdeg);
    3083 *    if (TEST_OPT_PROT) Print("(m%d)",index);
    3084 *    currcomponents = truecomponents[max(index-1,0)];
    3085 *    i = syInitSyzMod(res,orderedRes,index);
    3086 *    j = syInitSyzMod(res,orderedRes,index+1);
    3087 *    if (index>0)
    3088 *    {
    3089 *      syRedNextPairs(nextPairs,res,orderedRes,howmuch,index);
    3090 *      syCompactifyPairSet(resPairs[index],(*Tl)[index],0);
    3091 *    }
    3092 *    else
    3093 *      syRedGenerOfCurrDeg(resPairs,res,orderedRes,actdeg,index+1,Tl);
    3094 //--- creates new pairs -----------------------------     
    3095 *    syCreateNewPairs(resPairs,Tl,res,index,i);
    3096 *    if (index<(*length)-1)
    3097 *    {
    3098 *      syCreateNewPairs(resPairs,Tl,res,index+1,j);
    3099 *      currcomponents = truecomponents[index];
    3100 *      sySyzTail(resPairs,Tl,orderedRes,res,index+1,j);
    3101 *      currcomponents = truecomponents[index-1];
    3102 *    }
    3103 *    index--;
    3104 *    nextPairs = syChosePairs1(resPairs,Tl,&index,&howmuch,*length,&actdeg);
    3105 *    if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
    3106 *  }
    3107 //--- deletes temporary data structures-------------
    3108 *  idDelete(&temp);
    3109 *  for (i=0;i<*length;i++)
    3110 *  {
    3111 *    for (j=0;j<(*Tl)[i];j++)
    3112 *    {
    3113 *      if ((resPairs[i])[j].lcm!=NULL)
    3114 *        pDelete(&(resPairs[i])[j].lcm);
    3115 *    }
    3116 *    if (orderedRes[i]!=NULL)
    3117 *    {
    3118 *      for (j=0;j<IDELEMS(orderedRes[i]);j++)
    3119 *        orderedRes[i]->m[j] = NULL;
    3120 *    }
    3121 *    idDelete(&orderedRes[i]);
    3122 *    if (truecomponents[i]!=NULL)
    3123 *    {
    3124 *      Free((ADDRESS)truecomponents[i],(IDELEMS(res[i])+1)*sizeof(int));
    3125 *      truecomponents[i]=NULL;
    3126 *    }
    3127 *    if (backcomponents[i]!=NULL)
    3128 *    {
    3129 *      Free((ADDRESS)backcomponents[i],(IDELEMS(res[i])+1)*sizeof(int));
    3130 *      backcomponents[i]=NULL;
    3131 *    }
    3132 *    if (Howmuch[i]!=NULL)
    3133 *    {
    3134 *      Free((ADDRESS)Howmuch[i],(IDELEMS(res[i])+1)*sizeof(int));
    3135 *      Howmuch[i]=NULL;
    3136 *    }
    3137 *    if (Firstelem[i]!=NULL)
    3138 *    {
    3139 *      Free((ADDRESS)Firstelem[i],(IDELEMS(res[i])+1)*sizeof(int));
    3140 *      Firstelem[i]=NULL;
    3141 *    }
    3142 *    Free((ADDRESS)resPairs[i],(*Tl)[i]*sizeof(SObject));
    3143 *  }
    3144 *  Free((ADDRESS)resPairs,*length*sizeof(SObject*));
    3145 *  Free((ADDRESS)orderedRes,(*length+1)*sizeof(ideal));
    3146 *  Free((ADDRESS)truecomponents,(*length+1)*sizeof(int*));
    3147 *  Free((ADDRESS)backcomponents,(*length+1)*sizeof(int*));
    3148 *  Free((ADDRESS)Howmuch,(*length+1)*sizeof(int*));
    3149 *  Free((ADDRESS)Firstelem,(*length+1)*sizeof(int*));
    3150 *  truecomponents = NULL;
    3151 *  backcomponents = NULL;
    3152 *  Howmuch = NULL;
    3153 *  Firstelem = NULL;
    3154 *  if (BTEST1(6)) syStatistics(res,(*length+1));
    3155 *  (*length)++;
    3156 //--- changes to the original ring------------------
    3157 *  pChangeRing(pVariables,currRing->OrdSgn,currRing->order,
    3158 *    currRing->block0,currRing->block1,currRing->wvhdl);
    3159 *  syReOrderResolventFB(res,*length,2);
    3160 *  for (i=0;i<*length-1;i++)
    3161 *  {
    3162 *    res[i] = res[i+1];
    3163 *    if (res[i]!=NULL)
    3164 *    {
    3165 *      if (i>0)
    3166 *      {
    3167 *        for (j=0;j<IDELEMS(res[i]);j++)
    3168 *        {
    3169 *          res[i]->m[j] = syOrdPolySchreyer(res[i]->m[j]);
    3170 *        }
    3171 *        idSkipZeroes(res[i]);
    3172 *      }
    3173 *      else
    3174 *      {
    3175 *        for (j=0;j<IDELEMS(res[i]);j++)
    3176 *        {
    3177 *          p = res[i]->m[j];
    3178 *          while (p!=NULL)
    3179 *          {
    3180 *            pSetm(p);
    3181 *            pIter(p);
    3182 *          }
    3183 *        }
    3184 *      }
    3185 *    }
    3186 *  }
    3187 *  res[*length-1] = NULL;
    3188 *  Free((ADDRESS)ord,3*sizeof(int));
    3189 *  Free((ADDRESS)b0,3*sizeof(int));
    3190 *  Free((ADDRESS)b1,3*sizeof(int));
    3191 *  Free((ADDRESS)binomials,pVariables*(highdeg_1)*sizeof(int));
    3192 *  pDelete1(&redpol);
    3193 *  if (TEST_OPT_PROT)
    3194 *  {
    3195 *    //Print("simple: %d\n",simple);
    3196 *    //Print("dsim: %d\n",dsim);
    3197 *    //Print("crit %d-times used \n",crit);
    3198 *    //Print("%d reductions to zero \n",zeroRed);
    3199 *  }
    3200 *  //delete orderingdepth;
    3201 *  return res;
    3202 *}
    3203 */
Note: See TracChangeset for help on using the changeset viewer.