Changeset 84db93f in git


Ignore:
Timestamp:
Nov 25, 1999, 2:12:27 PM (24 years ago)
Author:
Thomas Siebert <siebert@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
24e55d9c9c4da931e0ed35d289b334426b6ab185
Parents:
b9ce2a5eabe5f00663bb9ef2e4e9ca761079d6dd
Message:
Bugfixes for res-commands


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

Legend:

Unmodified
Added
Removed
  • Singular/ideals.cc

    rb9ce2a r84db93f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ideals.cc,v 1.78 1999-11-24 14:07:21 obachman Exp $ */
     4/* $Id: ideals.cc,v 1.79 1999-11-25 13:12:24 siebert Exp $ */
    55/*
    66* ABSTRACT - all basic methods to manipulate ideals
     
    13531353  int   i, j, k, length=0,reg;
    13541354  BOOLEAN isMonomial=TRUE;
     1355  int ii;
    13551356
    13561357#ifdef PDEBUG
    1357   int ii;
    13581358  for(ii=0;ii<IDELEMS(h1);ii++) pTest(h1->m[ii]);
    13591359#endif
    13601360  if (idIs0(h1))
    1361     return idFreeModule(IDELEMS(h1));
     1361  {
     1362    ideal result=idFreeModule(IDELEMS(h1));
     1363    int curr_syz_limit=rGetCurrSyzLimit();
     1364    if (curr_syz_limit>0)
     1365    for (ii=0;ii<IDELEMS(h1);ii++)
     1366    {
     1367      if (h1->m[ii]!=NULL)
     1368        pShift(&h1->m[ii],curr_syz_limit);
     1369    }
     1370    return result;
     1371  }
    13621372  k=max(1,idRankFreeModule(h1));
    13631373
     
    14561466  }
    14571467  idTest(s_h3);
     1468  if (currQuotient != NULL)
     1469  {
     1470    ideal ts_h3=kStd(s_h3,currQuotient,h,w);
     1471    idDelete(&s_h3);
     1472    s_h3 = ts_h3;
     1473  }
    14581474  return s_h3;
    14591475}
     
    32433259/*2
    32443260* returns the presentation of an isomorphic, minimally
    3245 * embedded  module
     3261* embedded  module (arg represents the quotient!)
    32463262*/
    32473263ideal idMinEmbedding(ideal arg,BOOLEAN inPlace)
  • Singular/syz.cc

    rb9ce2a r84db93f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz.cc,v 1.32 1999-11-24 14:07:23 obachman Exp $ */
     4/* $Id: syz.cc,v 1.33 1999-11-25 13:12:26 siebert Exp $ */
    55
    66/*
     
    382382    syMinStep(res[syzIndex-1],res[syzIndex]);
    383383  if (!idIs0(res[0]))
    384     idMinEmbedding(res[0], TRUE);
     384    idMinEmbedding(res[0],TRUE);
    385385}
    386386
  • Singular/syz0.cc

    rb9ce2a r84db93f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz0.cc,v 1.26 1999-11-18 18:43:57 siebert Exp $ */
     4/* $Id: syz0.cc,v 1.27 1999-11-25 13:12:26 siebert Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    3131static kBucket_pt sy0buck;
    3232
    33 static polyset syInitSort(polyset oldF,int rkF,int Fmax,
    34          int syComponentOrder,intvec **modcomp)
     33static void syInitSort(ideal arg,intvec **modcomp)
    3534{
    3635  int i,j,k,kk,kkk,jj;
    37   polyset F;
    38   int Fl=Fmax;
     36  polyset F,oldF=arg->m;
     37  int Fl=IDELEMS(arg);
     38  int rkF=idRankFreeModule(arg);
     39  int syComponentOrder=pModuleOrder();
    3940
    4041  while ((Fl!=0) && (oldF[Fl-1]==NULL)) Fl--;
    4142  if (*modcomp!=NULL) delete modcomp;
    4243  *modcomp = NewIntvec1(rkF+2);
    43   F=(polyset)Alloc0(Fmax*sizeof(poly));
     44  F=(polyset)Alloc0(IDELEMS(arg)*sizeof(poly));
    4445  j=0;
    4546  for(i=0;i<=rkF;i++)
     
    7071  }
    7172  (**modcomp)[rkF+1] = Fl;
    72   return F;
     73  arg->m = F;
     74  Free((ADDRESS)oldF,IDELEMS(arg)*sizeof(poly));
     75#ifndef __OPTIMIZE__
     76//Print("Neue Anordnung: ");
     77//idPrint(arg);
     78#endif
    7379}
    7480
     
    164170/*2
    165171* computes the Schreyer syzygies in the local case
    166 * input: F, Fmax,  noSort: F is already ordered by: Schreyer-order
    167 *              (only allocated: Shdl, Smax)
     172* input: arg   (only allocated: Shdl, Smax)
    168173* output: Shdl, Smax
    169174*/
    170 void sySchreyersSyzygiesFM(polyset F,int Fmax,polyset* Shdl,int* Smax,
    171   BOOLEAN noSort)
    172 {
    173   int Fl=Fmax;
    174   while ((Fl!=0) && (F[Fl-1]==NULL)) Fl--;
    175   if (Fl==0) return;
    176 
    177   int i,j,l,k,totalToRed,ecartToRed,kk,bestEcart,totalmax,rkF,
    178     Sl=0,smax,tmax,tl;
     175static ideal sySchreyersSyzygiesFM(ideal arg,intvec ** modcomp)
     176{
     177  int Fl=IDELEMS(arg);
     178  while ((Fl!=0) && (arg->m[Fl-1]==NULL)) Fl--;
     179  ideal result=idInit(16,arg->rank+Fl);
     180  polyset F=arg->m,*Shdl=&(result->m);
     181  if (Fl==0) return result;
     182
     183  int i,j,l,k,totalToRed,ecartToRed,kk,kkk;
     184  int bestEcart,totalmax,rkF,Sl=0,smax,tmax,tl;
    179185  int *ecartS, *ecartT, *totalS,
    180186    *totalT=NULL, *temp=NULL;
    181   intvec * modcomp=NULL;
    182187  polyset pairs,S,T,ST,oldF;
    183188  poly p,q,toRed;
    184189  BOOLEAN notFound = FALSE;
    185 
     190  intvec * newmodcomp = NewIntvec1(Fl+2);
     191  intvec * tempcomp;
     192
     193//Print("Naechster Modul\n");
     194//idPrint(arg);
    186195/*-------------initializing the sets--------------------*/
    187   ideal idF=(ideal)Alloc0SizeOf(ip_sideal);
    188196  ST=(polyset)Alloc0(Fl*sizeof(poly));
    189197  S=(polyset)Alloc0(Fl*sizeof(poly));
     
    197205  smax = Fl;
    198206  tmax = 2*Fl;
    199   idF->m=F;IDELEMS(idF)=Fmax;
    200   idF->nrows=1;
    201   rkF=idRankFreeModule(idF);
    202 /*-------------sorting of F for index handling------------*/
    203   if (noSort)
    204   {
    205     oldF = F;
    206     F=syInitSort(F,rkF,Fmax,1,&modcomp);
    207   }
    208 #ifndef __OPTIMIZE__
    209 Print("Neue Anordnung: ");
    210 idF->m=F;IDELEMS(idF)=Fmax;
    211 idF->nrows=1;
    212 idPrint(idF);
    213 FreeSizeOf((ADDRESS)idF,ip_sideal);
    214 #endif
     207  for (j=1;j<IDELEMS(arg);j++)
     208  {
     209    if (arg->m[j] != NULL)
     210    {
     211      assume (arg->m[j-1] != NULL);
     212      assume (pGetComp(arg->m[j-1])-pGetComp(arg->m[j])<=0);
     213    }
     214  }
     215  rkF=idRankFreeModule(arg);
    215216/*----------------construction of the new ordering----------*/
    216   pSetSchreyerOrdM(F,Fl,rkF);
     217  //pSetSchreyerOrdM(F,Fl,rkF);
     218  if (rkF>0)
     219    rSetSyzComp(rkF);
     220  else
     221    rSetSyzComp(1);
    217222/*----------------creating S--------------------------------*/
    218223  for(j=0;j<Fl;j++)
     
    231236    else
    232237      pSetComp(p,rkF+j+1);
     238    pSetmComp(p);
    233239  }
    234240//PrintLn();
     
    267273  for(j=0;j<smax;j++)
    268274  {
     275    (*newmodcomp)[j+1] = Sl;
    269276    i = pGetComp(S[j]);
     277//#define OLD_PAIR_CONSTRUCTION
     278#ifdef OLD_PAIR_CONSTRUCTION
    270279    k=j+1;
    271 /*----------------constructing all pairs with S[j]---------*/
    272280    if (TEST_OPT_PROT)
    273281    {
     
    278286/*--------------computing the syzygies----------------------*/
    279287    for (k=j+1;k<Fl;k++)
     288#else
     289    int syComponentOrder=pModuleOrder();
     290    int lini,wend;
     291    if (syComponentOrder==1)
     292    {
     293      lini=k=j+1;
     294      wend=Fl;
     295    }
     296    else
     297    {
     298      lini=k=0;
     299      while ((k<j) && (pGetComp(S[k]) != i)) k++;
     300      wend=j;
     301    }
     302    if (TEST_OPT_PROT)
     303    {
     304      Print("(%d)",Fl-j);
     305      mflush();
     306    }
     307    syCreatePairs(S,lini,wend,k,j,i,pairs);
     308    for (k=lini;k<wend;k++)
     309#endif
    280310    {
    281311      if (pairs[k]!=NULL)
     
    289319        }
    290320        tl = smax;
     321        tempcomp = ivCopy(*modcomp);
    291322/*--------------begin to reduce-----------------------------*/
    292323        toRed = ksOldCreateSpoly(S[j],S[k]);
     
    302333           mflush();
    303334        }
     335//Print("Reduziere Paar %d,%d (ecart %d): \n",j,k,ecartToRed);
     336//Print("Poly %d: ",j);pWrite(S[j]);
     337//Print("Poly %d: ",k);pWrite(S[k]);
     338//Print("Spoly: ");pWrite(toRed);
    304339        while (pGetComp(toRed)<=rkF)
    305340        {
     
    317352*         }
    318353*/
     354//Print("toRed now (neuer ecart %d): ",ecartToRed);pWrite(toRed);
    319355          notFound = TRUE;
    320           l=0;
    321356          bestEcart = 32000;  //a very large integer
    322357          p = NULL;
     358          int l=0;
     359#define OLD_SEARCH
     360#ifdef OLD_SEARCH
    323361          while ((l<tl) && (pGetComp(T[l])<pGetComp(toRed))) l++;
     362          //assume (l==(**modcomp)[pGetComp(toRed)]);
    324363          while ((l<tl) && (notFound))
     364#else
     365          l = (**modcomp)[pGetComp(toRed)];
     366          kkk = (**modcomp)[pGetComp(toRed)+1];
     367          while ((l<kkk) && (notFound))
     368#endif
    325369          {
    326370            if ((ecartT[l]<bestEcart) && (pDivisibleBy(T[l],toRed)))
     
    345389            Free((ADDRESS)ecartS,Fl*sizeof(int));
    346390            Free((ADDRESS)totalS,Fl*sizeof(int));
    347             if (noSort)
    348             {
    349               Free((ADDRESS)F,Fl*sizeof(poly));
    350               F = oldF;
    351             }
    352             for(k=0;k<*Smax;k++) pDelete(&((*Shdl)[k]));
    353             return;
     391            for(k=0;k<IDELEMS(result);k++) pDelete(&((*Shdl)[k]));
     392            return result;
    354393          }
    355394          else
    356395          {
    357 //PrintS("reduced with: ");pWrite(p);PrintLn();
     396//Print("reduced with (ecart %d): ",bestEcart);wrp(p);PrintLn();
    358397            if (notFound)
    359398            {
     
    370409              }
    371410//PrintS("t");
     411              int comptR=pGetComp(toRed);
     412              for (l=tempcomp->length()-1;l>comptR;l--)
     413              {
     414                if ((*tempcomp)[l]>0)
     415                  (*tempcomp)[l]++;
     416              }
    372417              l=0;
    373               while ((l<tl) && (pGetComp(toRed)>pGetComp(T[l]))) l++;
     418              while ((l<tl) && (comptR>pGetComp(T[l]))) l++;
    374419              while ((l<tl) && (totalT[l]<=totalToRed)) l++;
    375420              for (kk=tl;kk>l;kk--)
     
    386431              tl++;
    387432            }
    388 
    389433            toRed = ksOldSpolyRed(p,toRed);
    390434          }
    391435        }
     436//Print("toRed finally (neuer ecart %d): ",ecartToRed);pWrite(toRed);
    392437//PrintS("s");
    393438        if (pGetComp(toRed)>rkF)
    394439        {
    395           if (Sl>=*Smax)
    396           {
    397             pEnlargeSet(Shdl,*Smax,16);
    398             *Smax += 16;
    399           }
    400           pShift(&toRed,-rkF);
     440          if (Sl>=IDELEMS(result))
     441          {
     442            pEnlargeSet(Shdl,IDELEMS(result),16);
     443            IDELEMS(result) += 16;
     444          }
     445          //pShift(&toRed,-rkF);
    401446          pNorm(toRed);
    402447          (*Shdl)[Sl] = toRed;
     
    414459          }
    415460        }
    416       }
    417     }
    418     for(k=j;k<Fl;k++) pDelete(&(pairs[k]));
    419   }
     461        delete tempcomp;
     462      }
     463    }
     464    for(k=lini;k<wend;k++) pDelete(&(pairs[k]));
     465  }
     466  (*newmodcomp)[Fl+1] = Sl;
    420467  Free((ADDRESS)pairs,Fl*sizeof(poly));
    421468  Free((ADDRESS)ST,Fl*sizeof(poly));
     
    426473  Free((ADDRESS)ecartS,Fl*sizeof(int));
    427474  Free((ADDRESS)totalS,Fl*sizeof(int));
    428   if (noSort)
    429   {
    430     if (modcomp!=NULL) delete modcomp;
    431     Free((ADDRESS)F,Fl*sizeof(poly));
    432     F = oldF;
    433   }
     475  delete *modcomp;
     476  *modcomp = newmodcomp;
     477  return result;
    434478}
    435479
     
    476520/*2
    477521* computes the Schreyer syzygies in the global case
    478 * input: F, Fmax,  noSort: F is already ordered by: Schreyer-order
    479 *              (only allocated: Shdl, Smax)
     522* input: F
    480523* output: Shdl, Smax
    481 * modcomp, length stores the start position of the module comp. in FF
     524* modcomp, length stores the start position of the module comp. in arg
    482525*/
    483 void sySchreyersSyzygiesFB(polyset *FF,int Fmax,polyset* Shdl,int* Smax,
    484    BOOLEAN noSort,intvec ** modcomp, int * length,ideal mW)
    485 {
    486   int i,j,l,k,kkk,rkF,Sl=0,Fl=Fmax,syComponentOrder=pModuleOrder();
    487   int fstart,wend,lini,ltR;
     526static ideal sySchreyersSyzygiesFB(ideal arg,intvec ** modcomp,ideal mW,BOOLEAN redTail=TRUE)
     527{
     528  int Fl=IDELEMS(arg);
     529  while ((Fl!=0) && (arg->m[Fl-1]==NULL)) Fl--;
     530  ideal result=idInit(16,Fl);
     531  int i,j,l,k,kkk,rkF,Sl=0,syComponentOrder=pModuleOrder();
     532  int fstart,wend,lini,ltR,gencQ=0;
    488533  intvec *newmodcomp;
    489534  int *Flength;
    490   polyset pairs,oldF,F=*FF;
     535  polyset pairs,F=arg->m,*Shdl=&(result->m);
    491536  poly p,q,toRed,syz,lastmonom,multWith;
    492   ideal idF=(ideal)AllocSizeOf(sip_sideal),null;
     537  ideal null;
    493538  BOOLEAN isNotReduced=TRUE;
    494539
    495   while ((Fl!=0) && (F[Fl-1]==NULL)) Fl--;
     540//#define WRITE_BUCKETS
     541#ifdef WRITE_BUCKETS
     542Print("Input: \n");
     543ideal twr=idHead(arg);
     544idPrint(arg);
     545idDelete(&twr);
     546if (modcomp!=NULL) (*modcomp)->show(0,0);
     547#endif
    496548  newmodcomp = NewIntvec1(Fl+2);
    497549//for (j=0;j<Fl;j++) pWrite(F[j]);
     
    500552    pairs=(polyset)Alloc0(Fl*sizeof(poly));
    501553  else
    502     pairs=(polyset)Alloc0((Fl+IDELEMS(currQuotient))*sizeof(poly));
    503   idF->m=F;IDELEMS(idF)=Fmax;
    504   rkF=idRankFreeModule(idF);
     554  {
     555    gencQ = IDELEMS(currQuotient);
     556    pairs=(polyset)Alloc0((Fl+gencQ)*sizeof(poly));
     557  }
     558  rkF=idRankFreeModule(arg);
    505559  null = idInit(1,rkF);
    506   FreeSizeOf((ADDRESS)idF,sip_sideal);
    507   if (noSort)
    508   {
    509     oldF = *FF;
    510     F=syInitSort(*FF,rkF,Fmax,syComponentOrder,modcomp);
    511   }
    512   else
    513   {
    514     F = *FF;
    515   }
    516560  Flength = (int*)Alloc0(Fl*sizeof(int));
    517561  for(j=0;j<Fl;j++)
     
    540584    }
    541585    syCreatePairs(F,lini,wend,k,j,i,pairs,Fl,mW);
    542     if (currQuotient!=NULL) wend = Fl+IDELEMS(currQuotient);
     586    if (currQuotient!=NULL) wend = Fl+gencQ;
    543587    for (k=lini;k<wend;k++)
    544588    {
     
    613657          kkk = (**modcomp)[pGetComp(toRed)];
    614658          while ((l>=kkk) && (!pDivisibleBy(F[l],toRed))) l--;
    615 //#define WRITE_BUCKETS
    616659#ifdef WRITE_BUCKETS
    617660          kBucketClear(sy0buck,&toRed,&ltR);
     
    642685              pDelete(&syz);
    643686              for(k=j;k<Fl;k++) pDelete(&(pairs[k]));
    644               Free((ADDRESS)pairs,(Fl + IDELEMS(currQuotient))*sizeof(poly));
    645               if (noSort)
    646               {
    647                 Free((ADDRESS)F,Fl*sizeof(poly));
    648                 F = oldF;
    649               }
    650               for(k=0;k<*Smax;k++) pDelete(&((*Shdl)[k]));
    651               return;
     687              Free((ADDRESS)pairs,(Fl + gencQ)*sizeof(poly));
     688              for(k=0;k<IDELEMS(result);k++) pDelete(&((*Shdl)[k]));
     689              return result;
    652690            }
    653691          }
     
    686724        if (syz!=NULL)
    687725        {
    688           if (Sl>=*Smax)
    689           {
    690             pEnlargeSet(Shdl,*Smax,16);
    691             *Smax += 16;
     726          if (Sl>=IDELEMS(result))
     727          {
     728            pEnlargeSet(Shdl,IDELEMS(result),16);
     729            IDELEMS(result) += 16;
    692730          }
    693731          pNorm(syz);
    694           if (BTEST1(OPT_REDTAIL))
     732          if (BTEST1(OPT_REDTAIL) && redTail)
    695733          {
    696734            (*newmodcomp)[j+2] = Sl;
     
    711749  else
    712750    Free((ADDRESS)pairs,(Fl+IDELEMS(currQuotient))*sizeof(poly));
    713   if (noSort)
    714   {
    715     Free((ADDRESS)oldF,Fmax*sizeof(poly));
    716     *FF = F;
    717   }
    718751  Free((ADDRESS)Flength,Fl*sizeof(int));
    719752  delete *modcomp;
    720   *length = Fl+2;
    721753  *modcomp = newmodcomp;
     754  return result;
    722755}
    723756
     
    822855}
    823856
     857static void idShift(ideal arg,int index)
     858{
     859  int i,j=rGetMaxSyzComp(index);
     860  for (i=0;i<IDELEMS(arg);i++)
     861  {
     862    if (arg->m[i]!=NULL)
     863      pShift(&arg->m[i],-j);
     864  }
     865}
     866
     867static void syPrintResolution(resolvente res,int start,int length)
     868{
     869  while ((start < length) && (res[start]))
     870  {
     871    Print("Syz(%d): \n",start);
     872    idTest(res[start]);
     873    //idPrint(res[start]);
     874    start++;
     875  } 
     876}
     877
    824878resolvente sySchreyerResolvente(ideal arg, int maxlength, int * length,
    825879                                BOOLEAN isMonomial, BOOLEAN notReplace)
    826880{
    827881  ideal mW=NULL;
    828   int i,syzIndex = 0,j=0,lgth,*ord=NULL,*bl0=NULL,*bl1=NULL;
     882  int i,syzIndex = 0,j=0;
    829883  intvec * modcomp=NULL,*w=NULL;
    830884  int ** wv=NULL;
    831   BOOLEAN sort = TRUE;
    832885  tHomog hom=(tHomog)idHomModule(arg,NULL,&w);
    833886  ring origR = currRing;
    834   sip_sring tmpR;
     887  ring syRing=NULL;
    835888
    836889  if ((!isMonomial) && syTestOrder(arg))
     
    856909      res=newres;
    857910    }
    858     res[syzIndex+1] = idInit(16,1);
    859     if ((currRing->OrdSgn == 1) || (hom==isHomog))
    860     {
    861       sySchreyersSyzygiesFB(&(res[syzIndex]->m),i,&(res[syzIndex+1]->m),
    862         &(IDELEMS(res[syzIndex+1])),sort,&modcomp,&lgth,mW);
     911    if ((origR->OrdSgn == 1) || (hom==isHomog))
     912    {
     913      if (syzIndex==0) syInitSort(res[0],&modcomp);
     914      if ((syzIndex==0) && !rRing_has_CompLastBlock(currRing))
     915        res[syzIndex+1] = sySchreyersSyzygiesFB(res[syzIndex],&modcomp,mW,FALSE);
     916      else
     917        res[syzIndex+1] = sySchreyersSyzygiesFB(res[syzIndex],&modcomp,mW);
    863918      mW = res[syzIndex];
    864919    }
    865920//idPrint(res[syzIndex+1]);
    866921
    867 // #define THOMAS_THOUGHT_ABOUT_IT
    868 #ifdef THOMAS_THOUGHT_ABOUT_IT
    869     if ((syzIndex==0) && (currRing->OrdSgn==1))
    870 #else
    871922    if ((syzIndex==0))
    872 #endif
    873     {
    874       j = 0;
    875       // Thomas: I do not understand why you change the ring here
    876       // (after the first Syzygies computation)
    877       while ((currRing->order[j]!=ringorder_c)
    878               && (currRing->order[j]!=ringorder_C))
    879         j++;
    880       if ((!notReplace) && (currRing->order[j]!=0))
    881       {
    882         while (currRing->order[j]!=0) j++;
    883         ord = (int*)Alloc0((j+1)*sizeof(int));
    884         wv = (int**)Alloc0((j+1)*sizeof(int*));
    885         bl0 = (int*)Alloc0((j+1)*sizeof(int));
    886         bl1 = (int*)Alloc0((j+1)*sizeof(int));
    887         j = 0;
    888         while ((currRing->order[j]!=ringorder_c)
    889                 && (currRing->order[j]!=ringorder_C))
    890         {
    891           ord[j] = currRing->order[j];
    892           bl0[j] = currRing->block0[j];
    893           bl1[j] = currRing->block1[j];
    894           wv[j] = currRing->wvhdl[j];
    895           j++;
    896         }
    897         int m_order=j;
    898         while (currRing->order[j+1]!=0)
    899         {
    900           ord[j] = currRing->order[j+1];
    901           bl0[j] = currRing->block0[j+1];
    902           bl1[j] = currRing->block1[j+1];
    903           wv[j] = currRing->wvhdl[j+1];
    904           j++;
    905         }
    906         ord[j] = currRing->order[m_order];
    907         bl0[j] = currRing->block0[m_order];
    908         bl1[j] = currRing->block1[m_order];
    909         wv[j] = currRing->wvhdl[m_order];
    910         tmpR = *currRing;
    911         tmpR.order = ord;
    912         tmpR.block0 = bl0;
    913         tmpR.block1 = bl1;
    914         tmpR.wvhdl = wv;
    915         rComplete(&tmpR, 1);
    916         rChangeCurrRing(&tmpR, TRUE);
    917         if ((currRing->OrdSgn != 1) && (hom!=isHomog))
     923    {
     924      if ((origR->OrdSgn == 1) || (hom==isHomog))
     925      {
     926        syRing = rCurrRingAssure_CompLastBlock();
     927        if (syRing != origR)
     928        {
     929          for (i=0; i<IDELEMS(res[1]); i++)
     930          {
     931            res[1]->m[i] = prMoveR( res[1]->m[i], origR);
     932          }
     933        }
     934        idTest(res[1]);
     935      }
     936      else
     937      {
     938        syRing = rCurrRingAssure_SyzComp_CompLastBlock();
     939        if (syRing != origR)
    918940        {
    919941          for (i=0; i<IDELEMS(res[0]); i++)
     
    922944          }
    923945        }
    924         else
    925         {
    926           for (i=0; i<IDELEMS(res[0]); i++)
    927           {
    928             res[0]->m[i] = prMoveR( res[0]->m[i], origR);
    929           }
    930         }
    931946        idTest(res[0]);
    932947      }
    933948    }
    934     if ((currRing->OrdSgn != 1) && (hom!=isHomog))
    935       sySchreyersSyzygiesFM(res[syzIndex]->m,i,&(res[syzIndex+1]->m),
    936       &(IDELEMS(res[syzIndex+1])),sort);
    937     if (sort) sort=FALSE;
     949    if ((origR->OrdSgn != 1) && (hom!=isHomog))
     950    {
     951      if (syzIndex==0) syInitSort(res[0],&modcomp);
     952      res[syzIndex+1] = sySchreyersSyzygiesFM(res[syzIndex],&modcomp);
     953    }
    938954    syzIndex++;
    939955    if (TEST_OPT_PROT) Print("[%d]\n",syzIndex);
    940956    kBucketDestroy(&(sy0buck));
    941957  }
    942   syReOrderResolventFB(res,*length);
    943   if (currRing->OrdSgn == -1)
    944     pSetSchreyerOrdM(NULL,0,0);
    945   syzIndex = 1;
    946   if (/*ringOrderChanged:*/ ord!=NULL)
     958  //syPrintResolution(res,1,*length);
     959  if ((origR->OrdSgn != 1) && (hom!=isHomog))
     960  {
     961    syzIndex = 1;
     962    while ((syzIndex < *length) && (!idIs0(res[syzIndex])))
     963    {
     964      idShift(res[syzIndex],syzIndex);
     965      syzIndex++;
     966    }
     967  }
     968  if ((origR->OrdSgn == 1) || (hom==isHomog))
     969    syzIndex = 1;
     970  else
     971    syzIndex = 0;
     972  syReOrderResolventFB(res,*length,syzIndex+1);
     973  if (/*ringOrderChanged:*/ origR!=syRing)
    947974  {
    948975    rChangeCurrRing(origR, TRUE);
     
    954981        if (res[syzIndex]->m[i])
    955982        {
    956           res[syzIndex]->m[i] = prMoveR( res[syzIndex]->m[i], &tmpR);
     983          res[syzIndex]->m[i] = prMoveR( res[syzIndex]->m[i], syRing);
    957984        }
    958985      }
     
    961988    j = 0;
    962989    while (currRing->order[j]!=0) j++;
    963     Free((ADDRESS)ord,(j+1)*sizeof(int));
    964     Free((ADDRESS)bl0,(j+1)*sizeof(int));
    965     Free((ADDRESS)bl1,(j+1)*sizeof(int));
    966     Free((ADDRESS)wv,(j+1)*sizeof(int*));
    967990  }
    968991  else
     
    9791002    }
    9801003  }
     1004  if ((origR->OrdSgn == 1) || (hom==isHomog))
     1005  {
     1006    if (res[1]!=NULL)
     1007    {
     1008      syReOrderResolventFB(res,2,1);
     1009      for (i=0;i<IDELEMS(res[1]);i++)
     1010      {
     1011        if (res[1]->m[i])
     1012          res[1]->m[i] = pOrdPolyMerge(res[1]->m[i]);
     1013      }
     1014    }
     1015  }
     1016  //syPrintResolution(res,0,*length);
    9811017
    9821018  //syMergeSortResolventFB(res,*length);
  • Singular/syz1.cc

    rb9ce2a r84db93f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz1.cc,v 1.50 1999-11-20 10:17:23 siebert Exp $ */
     4/* $Id: syz1.cc,v 1.51 1999-11-25 13:12:27 siebert Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    17761776    jj = jj+2;
    17771777    result=NewIntvec3(j,jj-sh,0);
    1778     IMATELEM(*result,1,1) = max(1,idRankFreeModule(syzstr->res[1]));
     1778    if ((syzstr->syRing!=NULL) && (syzstr->syRing!=currRing))
     1779    {
     1780      ring origR=currRing;
     1781      rChangeCurrRing(syzstr->syRing, TRUE);
     1782      IMATELEM(*result,1,1) = max(1,idRankFreeModule(syzstr->res[1]));
     1783      rChangeCurrRing(origR,TRUE);
     1784    }
     1785    else
     1786    {
     1787      IMATELEM(*result,1,1) = max(1,idRankFreeModule(syzstr->res[1]));
     1788    }
    17791789    for (i=sh;i<jj;i++)
    17801790    {
Note: See TracChangeset for help on using the changeset viewer.