Changeset 30fb427 in git


Ignore:
Timestamp:
Aug 5, 1998, 1:40:58 PM (26 years ago)
Author:
Thomas Siebert <siebert@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
0e3e6f4a4d841a9a31f2a0c9f797ac572094c852
Parents:
d950c52d07929c4629546c9ad477819d8410ffb3
Message:
*** empty log message ***


git-svn-id: file:///usr/local/Singular/svn/trunk@2429 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/syz1.cc

    rd950c5 r30fb427  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz1.cc,v 1.30 1998-06-30 14:48:20 obachman Exp $ */
     4/* $Id: syz1.cc,v 1.31 1998-08-05 11:40:58 siebert Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    10361036}
    10371037
    1038 /*3
    1039 * reduces all pairs of degree deg in the module index
    1040 * put the reduced generators to the resolvente which contains
    1041 * the truncated kStd
    1042 */
    1043 static void syRedNextPairs(SSet nextPairs, syStrategy syzstr,
    1044                int howmuch, int index)
    1045 {
    1046   int i=howmuch-1,j,k=IDELEMS(syzstr->res[index]);
    1047   int ks=IDELEMS(syzstr->res[index+1]),kk,l,ll;
     1038//#define OLD_PAIR_ORDER
     1039#ifdef OLD_PAIR_ORDER
     1040static intvec* syLinStrat(SSet nextPairs, syStrategy syzstr,
     1041                          int howmuch, int index)
     1042{
     1043  int i=howmuch-1,i1=0,l,ll;
    10481044  int ** Fin=syzstr->Firstelem;
    10491045  int ** Hin=syzstr->Howmuch;
    10501046  int ** bin=syzstr->backcomponents;
    1051   number coefgcd,n;
    10521047  ideal o_r=syzstr->orderedRes[index+1];
    1053   polyset redset=syzstr->orderedRes[index]->m;
    1054   poly p=NULL,q;
     1048  intvec *result=new intvec(howmuch+1);
    10551049  BOOLEAN isDivisible;
    10561050  SObject tso;
    10571051
    1058   if ((nextPairs==NULL) || (howmuch==0)) return;
    1059   while ((k>0) && (syzstr->res[index]->m[k-1]==NULL)) k--;
    1060   while ((ks>0) && (syzstr->res[index+1]->m[ks-1]==NULL)) ks--;
    10611052  while (i>=0)
    10621053  {
     
    10801071      }
    10811072    }
    1082     if (!isDivisible)
    1083     {
    1084       tso.p =
     1073    if (isDivisible)
     1074    {
     1075      syDeletePair(&nextPairs[i]);
     1076      //crit++;
     1077    }
     1078    else
     1079    {
     1080      nextPairs[i].p =
    10851081        sySPoly(tso.p1, tso.p2,tso.lcm);
     1082      (*result)[i1] = i+1;
     1083      i1++;
     1084    }
     1085    i--;
     1086  }
     1087  return result;
     1088}
     1089#else
     1090static intvec* syLinStrat(SSet nextPairs, syStrategy syzstr,
     1091                          int howmuch, int index)
     1092{
     1093  int i=howmuch-1,i1=0,i2,i3,l,ll;
     1094  int ** Fin=syzstr->Firstelem;
     1095  int ** Hin=syzstr->Howmuch;
     1096  int ** bin=syzstr->backcomponents;
     1097  ideal o_r=syzstr->orderedRes[index+1];
     1098  intvec *result=new intvec(howmuch+1);
     1099  intvec *spl=new intvec(howmuch,1,-1);
     1100  BOOLEAN isDivisible;
     1101  SObject tso;
     1102
     1103  while (i>=0)
     1104  {
     1105    tso = nextPairs[i];
     1106    isDivisible = FALSE;
     1107    if (syzstr->res[index+1]!=NULL)
     1108    {
     1109      l = Fin[index][pGetComp(tso.lcm)]-1;
     1110      if (l>=0)
     1111      {
     1112        ll = l+Hin[index][pGetComp(tso.lcm)];
     1113        while ((l<ll) && (!isDivisible))
     1114        {
     1115          if (o_r->m[l]!=NULL)
     1116          {
     1117            isDivisible = isDivisible ||
     1118              pDivisibleBy2(o_r->m[l],tso.lcm);
     1119          }
     1120          l++;
     1121        }
     1122      }
     1123    }
     1124    if (isDivisible)
     1125    {
     1126      syDeletePair(&nextPairs[i]);
     1127      //crit++;
     1128    }
     1129    else
     1130    {
     1131      nextPairs[i].p =
     1132        sySPoly(tso.p1, tso.p2,tso.lcm);
     1133      (*spl)[i] = pLength(nextPairs[i].p);
     1134    }
     1135    i--;
     1136  }
     1137//Print("\n");Print("Laengenvektor: ");spl->show(1,1);Print("\n");
     1138  i3 = 0;
     1139  loop
     1140  {
     1141    i2 = -1;
     1142    for (i1=0;i1<howmuch;i1++)
     1143    {
     1144      if (i2==-1)
     1145      {
     1146        if ((*spl)[i1]!=-1)
     1147        {
     1148          i2 = i1;
     1149        }
     1150      }
     1151      else
     1152      {
     1153        if (((*spl)[i1]>=0) && ((*spl)[i1]<(*spl)[i2]))
     1154        {
     1155          i2 = i1;
     1156        }
     1157      }
     1158    }
     1159    if (i2>=0)
     1160    {
     1161      (*result)[i3] = i2+1;
     1162      (*spl)[i2] = -1;
     1163      i3++;
     1164    }
     1165    else
     1166    {
     1167      break;
     1168    }
     1169  }
     1170  return result;
     1171}
     1172#endif
     1173/*3
     1174* reduces all pairs of degree deg in the module index
     1175* put the reduced generators to the resolvente which contains
     1176* the truncated kStd
     1177*/
     1178static void syRedNextPairs(SSet nextPairs, syStrategy syzstr,
     1179               int howmuch, int index)
     1180{
     1181  int i,j,k=IDELEMS(syzstr->res[index]);
     1182  int ks=IDELEMS(syzstr->res[index+1]),kk,l,ll;
     1183  int ** Fin=syzstr->Firstelem;
     1184  int ** Hin=syzstr->Howmuch;
     1185  int ** bin=syzstr->backcomponents;
     1186  number coefgcd,n;
     1187  polyset redset=syzstr->orderedRes[index]->m;
     1188  poly p=NULL,q;
     1189  intvec *spl1=new intvec(howmuch+1);
     1190  SObject tso;
     1191
     1192  if ((nextPairs==NULL) || (howmuch==0)) return;
     1193  while ((k>0) && (syzstr->res[index]->m[k-1]==NULL)) k--;
     1194  while ((ks>0) && (syzstr->res[index+1]->m[ks-1]==NULL)) ks--;
     1195  spl1 = syLinStrat(nextPairs,syzstr,howmuch,index);
     1196//Print("\n");Print("Ordnungsvektor: ");spl1->show(1,1);Print("\n");
     1197  i=0;
     1198  while ((*spl1)[i]>0)
     1199  {
     1200    tso = nextPairs[(*spl1)[i]-1];
     1201    if ((tso.p1!=NULL) && (tso.p2!=NULL))
     1202    {
    10861203      coefgcd =
    1087         nGcd(pGetCoeff(tso.p1),pGetCoeff(tso.p1));
     1204        nGcd(pGetCoeff(tso.p1),pGetCoeff(tso.p2));
    10881205      tso.syz = pHead(tso.lcm);
    10891206      pSetm(tso.syz);
     
    12321349      ks++;
    12331350      p = NULL;
    1234       nextPairs[i] = tso;
    1235     }
    1236     else
    1237     {
    1238       syDeletePair(&nextPairs[i]);
    1239       //crit++;
    1240     }
    1241     i--;
    1242   }
     1351      nextPairs[(*spl1)[i]-1] = tso;
     1352    }
     1353    i++;
     1354  }
     1355  delete spl1;
    12431356}
    12441357
     
    14371550          {
    14381551            pDelete(&(nPm[j1]));
    1439             break;
     1552            //break;
    14401553          }
    14411554        }
     
    15021615}
    15031616
     1617/*2
     1618* tail reduction for the LaScala algorithm
     1619* takes care of the special ordering
     1620*/
    15041621static void sySyzTail(syStrategy syzstr, int index, int newEl)
    15051622{
     
    18191936}
    18201937
     1938/*3
     1939* deletes a resolution
     1940*/
    18211941void syKillComputation(syStrategy syzstr)
    18221942{
     
    19352055}
    19362056
     2057/*3
     2058* read out the Betti numbers from resolution
     2059* (if not LaScala calls the traditional Betti procedure)
     2060*/
    19372061intvec * syBettiOfComputation(syStrategy syzstr)
    19382062{
     
    19862110}
    19872111
     2112/*3
     2113* computes the allocated length of the resolution
     2114*/
    19882115int syLength(syStrategy syzstr)
    19892116{
     
    19912118}
    19922119
     2120/*3
     2121* computes the real length of the resolution
     2122*/
    19932123int sySize(syStrategy syzstr)
    19942124{
     
    20082138}
    20092139
     2140/*3
     2141* computes the cohomological dimension of res[1]
     2142*/
    20102143int syDim(syStrategy syzstr)
    20112144{
     
    20402173}
    20412174
     2175/*3
     2176* copies the resolution (by increment the reference counter)
     2177*/
    20422178syStrategy syCopy(syStrategy syzstr)
    20432179{
     
    20472183}
    20482184
     2185/*2
     2186* local print procedure used in syPrint
     2187*/
    20492188static void syPrintEmptySpaces(int i)
    20502189{
     
    20562195}
    20572196
     2197/*2
     2198* local print procedure used in syPrint
     2199*/
    20582200static void syPrintEmptySpaces1(int i)
    20592201{
     
    20652207}
    20662208
     2209/*2
     2210* local print procedure used in syPrint
     2211*/
    20672212static int syLengthInt(int i)
    20682213{
     
    20782223}
    20792224
     2225/*3
     2226* prints the resolution as sequence of free modules
     2227*/
    20802228void syPrint(syStrategy syzstr)
    20812229{
     
    21692317}
    21702318
     2319/*2
     2320* divides out the weight monomials (given by the Schreyer-ordering)
     2321* fronm the LaScala-resolution
     2322*/
    21712323static resolvente syReorder(resolvente res,int length,
    21722324        syStrategy syzstr,BOOLEAN toCopy=TRUE,resolvente totake=NULL)
     
    22312383}
    22322384
     2385/*3
     2386* converts a resolution into a list of modules
     2387*/
    22332388lists syConvRes(syStrategy syzstr)
    22342389{
     
    22692424}
    22702425
     2426/*3
     2427* converts a list of modules into a resolution
     2428*/
    22712429syStrategy syConvList(lists li)
    22722430{
     
    22862444}
    22872445
     2446/*3
     2447* converts a list of modules into a minimal resolution
     2448*/
    22882449syStrategy syForceMin(lists li)
    22892450{
     
    23022463}
    23032464
     2465/*2
     2466* deleting all monomials the component of which correspond
     2467* to non-minimal generators
     2468*/
    23042469static poly syStripOut(poly p,intvec * toStrip)
    23052470{
     
    23232488}
    23242489
    2325 static poly syMinimizeP(poly toMin,syStrategy syzstr,int pNum,int index,
     2490static poly syMinimizeP(int toMin,syStrategy syzstr,intvec * ordn,int index,
    23262491                        intvec * toStrip)
    23272492{
    2328   int i,j,tc,lastin,newin=pNum-1;
    2329   poly p,pp=pCopy(toMin),q=NULL,tq,pisN;
     2493  int ii=0,i,j,tc;
     2494  poly p,pp,q=NULL,tq,pisN;
    23302495  SSet sPairs=syzstr->resPairs[index];
    2331 
     2496  poly tempStripped=NULL;
     2497
     2498  pp=pCopy(syzstr->res[index+1]->m[toMin]);
    23322499  pp = syStripOut(pp,toStrip);
    2333   while (newin>=0)
    2334   {
    2335     lastin = newin;
    2336     while ((newin>=0) && (sPairs[lastin].order==sPairs[newin].order))
    2337       newin--;
    2338 //Print("Hier lastin:%d newin:%d\n",lastin,newin);
    2339     for (i=newin+1;i<=lastin;i++)
    2340     {
    2341       if (sPairs[i].isNotMinimal!=NULL)
    2342       {
    2343         pisN = sPairs[i].isNotMinimal;
    2344         tc = pGetComp(pisN);
    2345         p = pp;
    2346         while (p!=NULL)
    2347         {
    2348           if (pGetComp(p)==tc)
    2349           {
    2350             tq = pInit();
    2351             for(j=pVariables; j>0; j--)
    2352               pSetExp(tq,j, pGetExp(p,j)-pGetExp(pisN,j));
    2353             pSetComp(tq, 0);
    2354             pSetCoeff0(tq,nDiv(pGetCoeff(p),pGetCoeff(pisN)));
    2355             pGetCoeff(tq) = nNeg(pGetCoeff(tq));
    2356             q = syAdd(q,syStripOut(syMultT1(syzstr->res[index+1]->m[sPairs[i].syzind],tq),toStrip));
    2357           } 
    2358           pIter(p);
    2359         }
    2360         if (q!=NULL)
    2361         {
    2362           pp = syAdd(pp,q);
    2363           q = NULL;
    2364         }
    2365       }
    2366     }
     2500  while ((ii<ordn->length()) && ((*ordn)[ii]!=-1) && (sPairs[(*ordn)[ii]].syzind!=toMin))
     2501  {
     2502    ii++;
     2503  }
     2504  while (ii>=0)
     2505  {
     2506    i = (*ordn)[ii];
     2507    if (sPairs[i].isNotMinimal!=NULL)
     2508    {
     2509      tempStripped = syStripOut(pCopy(syzstr->res[index+1]->m[sPairs[i].syzind]),toStrip);
     2510      pisN = sPairs[i].isNotMinimal;
     2511      tc = pGetComp(pisN);
     2512      p = pp;
     2513      while (p!=NULL)
     2514      {
     2515        if (pGetComp(p)==tc)
     2516        {
     2517          tq = pInit();
     2518          for(j=pVariables; j>0; j--)
     2519            pSetExp(tq,j, pGetExp(p,j)-pGetExp(pisN,j));
     2520          pSetComp(tq, 0);
     2521          pSetCoeff0(tq,nDiv(pGetCoeff(p),pGetCoeff(pisN)));
     2522          pGetCoeff(tq) = nNeg(pGetCoeff(tq));
     2523          q = syAdd(q,syMultT1(tempStripped,tq));
     2524        } 
     2525        pIter(p);
     2526      }
     2527      if (q!=NULL)
     2528      {
     2529        pp = syAdd(pp,q);
     2530        q = NULL;
     2531      }
     2532      pDelete(&tempStripped);
     2533    }
     2534    ii--;
    23672535  }
    23682536  return pp;
     
    24352603}
    24362604
     2605static intvec * syOrdPairs(SSet sPairs, int length)
     2606{
     2607  intvec * result=new intvec(length,1,-1);
     2608  int i,j=0,k=-1,l,ii;
     2609
     2610  loop
     2611  {
     2612    l = -1;
     2613    for(i=0;i<length;i++)
     2614    {
     2615      if (sPairs[i].syzind>k)
     2616      {
     2617        if (l==-1)
     2618        {
     2619          l = sPairs[i].syzind;
     2620          ii = i;
     2621        }
     2622        else
     2623        {
     2624          if (sPairs[i].syzind<l)
     2625          {
     2626            l = sPairs[i].syzind;
     2627            ii = i;
     2628          }
     2629        }
     2630      }
     2631    }
     2632    if (l==-1) break;
     2633    (*result)[j] = ii;
     2634    j++;
     2635    k = l;
     2636  }
     2637  return result;
     2638}
     2639
    24372640static resolvente syReadOutMinimalRes(syStrategy syzstr,
    24382641           BOOLEAN computeStd=FALSE)
    24392642{
    2440   intvec * Strip;
     2643  intvec * Strip, * ordn;
    24412644  resolvente tres=(resolvente)Alloc0((syzstr->length+1)*sizeof(ideal));
    24422645  sip_sring tmpR;
     
    24492652    return tres;
    24502653  }
    2451   int i,j,l,index,o1,ii,i1;
     2654  int i,j,l,index,ii,i1;
    24522655  poly p;
    24532656  ideal rs;
     
    24962699      tres[index+1] = idInit(IDELEMS(syzstr->res[index+1]),syzstr->res[index+1]->rank);
    24972700      i1 = (*syzstr->Tl)[index];
     2701      ordn = syOrdPairs(sPairs,i1);
    24982702      for (i=0;i<i1;i++)
    24992703      {
    25002704        if ((sPairs[i].isNotMinimal==NULL) && (sPairs[i].lcm!=NULL))
    25012705        {
    2502           o1 = sPairs[i].order;
    2503           ii = i;
    2504           while ((ii<i1) && (sPairs[ii].lcm!=NULL) && (sPairs[ii].order==o1))
    2505             ii++;
    25062706          l = sPairs[i].syzind;
    25072707          tres[index+1]->m[l] =
    2508             syMinimizeP(syzstr->res[index+1]->m[l],syzstr,ii,index,Strip);
     2708            syMinimizeP(l,syzstr,ordn,index,Strip);
    25092709        }
    25102710      }
Note: See TracChangeset for help on using the changeset viewer.