Changeset 7a30b9 in git


Ignore:
Timestamp:
Sep 29, 1997, 10:51:48 AM (26 years ago)
Author:
Thomas Siebert <siebert@…>
Branches:
(u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
Children:
45251f2adf94ee083a91e1ceace284a181aa49e9
Parents:
735322ba51c2f4f8a528f3a56ff51422cb5918ab
Message:
*** empty log message ***


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

Legend:

Unmodified
Added
Removed
  • Singular/syz.h

    r735322b r7a30b9  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: syz.h,v 1.5 1997-07-09 15:54:06 Singular Exp $ */
     6/* $Id: syz.h,v 1.6 1997-09-29 08:51:44 siebert Exp $ */
    77/*
    88* ABSTRACT: Resolutions
     
    4343  int highdeg_1;
    4444  intvec * resolution;
     45  intvec * cw;
    4546};
    4647
  • Singular/syz1.cc

    r735322b r7a30b9  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz1.cc,v 1.12 1997-07-10 12:03:43 Singular Exp $ */
     4/* $Id: syz1.cc,v 1.13 1997-09-29 08:51:48 siebert Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    878878
    879879/*3
     880* local procedure for of syInitRes for the module case
     881*/
     882static int syChMin(intvec * iv)
     883{
     884  int i,j=-1,r=-1;
     885
     886  for (i=iv->length()-1;i>=0;i--)
     887  {
     888    if ((*iv)[i]>=0)
     889    {
     890      if ((j<0) || ((*iv)[i]<j))
     891      {
     892        j = (*iv)[i];
     893        r = i;
     894      }
     895    }
     896  }
     897  return r;
     898}
     899
     900/*3
    880901* initialize the resolution and puts in the argument as
    881902* zeroth entre, length must be > 0
    882903* assumes that the basering is degree-compatible
    883904*/
    884 static SRes syInitRes(ideal arg,int * length, intvec * Tl)
     905static SRes syInitRes(ideal arg,int * length, intvec * Tl, intvec * cw=NULL)
    885906{
    886907  if (idIs0(arg)) return NULL;
    887908  SRes resPairs = (SRes)Alloc0(*length*sizeof(SSet));
    888909  resPairs[0] = (SSet)Alloc0(IDELEMS(arg)*sizeof(SObject));
    889   intvec * iv = idSort(arg);
    890   int i;
    891 
    892   for (i=0;i<IDELEMS(arg);i++)
    893   {
    894     (resPairs[0])[i].syz = /*pCopy*/(arg->m[(*iv)[i]-1]);
    895     arg->m[(*iv)[i]-1] = NULL;
    896     (resPairs[0])[i].order = pTotaldegree((resPairs[0])[i].syz);
    897   }
    898   delete iv;
     910  intvec * iv=NULL;
     911  int i,j;
     912
     913  if (idRankFreeModule(arg)==0)
     914  {
     915    iv = idSort(arg);
     916    for (i=0;i<IDELEMS(arg);i++)
     917    {
     918      (resPairs[0])[i].syz = /*pCopy*/(arg->m[(*iv)[i]-1]);
     919      arg->m[(*iv)[i]-1] = NULL;
     920      (resPairs[0])[i].order = pTotaldegree((resPairs[0])[i].syz);
     921    }
     922  }
     923  else
     924  {
     925    iv = new intvec(IDELEMS(arg),1,-1);
     926    for (i=0;i<IDELEMS(arg);i++)
     927    {
     928      (*iv)[i] = pTotaldegree(arg->m[i])+(*cw)[pGetComp(arg->m[i])-1];
     929    }
     930    for (i=0;i<IDELEMS(arg);i++)
     931    {
     932      j = syChMin(iv);
     933      if (j<0) break;
     934      (resPairs[0])[i].syz = arg->m[j];
     935      arg->m[j] = NULL;
     936      (resPairs[0])[i].order = (*iv)[j];
     937      (*iv)[j] = -1;
     938    }
     939  }
     940  if (iv!=NULL)  delete iv;
    899941  (*Tl)[0] = IDELEMS(arg);
    900942  return resPairs;
     
    924966    tc = trind1[pGetComp(p)]-1;
    925967  else
    926     tc = pGetComp(p);
     968    tc = pGetComp(p)-1;
    927969  loop         //while ((j<ie) && (trind1[orc]<=tc+1))
    928970  {
     
    12771319static void syEnterPair(SSet sPairs, SObject * so, int * sPlength,int index)
    12781320{
    1279   int ll,k,no=pGetOrder((*so).lcm),sP=*sPlength,i;
     1321  int ll,k,no=(*so).order,sP=*sPlength,i;
    12801322  poly p=(*so).lcm;
    12811323
     
    14141456        nPm[ii] = NULL;
    14151457        tso.order = pGetOrder(p) = pTotaldegree(p);
     1458        if ((syzstr->cw!=NULL) && (index>0) && (pGetComp(q)>0))
     1459        {
     1460          int ii=index-1,jj=pGetComp(q);
     1461          while (ii>0)
     1462          {
     1463            jj = pGetComp(syzstr->res[ii]->m[jj-1]);
     1464            ii--;
     1465          }
     1466          tso.order += (*syzstr->cw)[jj-1];
     1467        }
    14161468        tso.p1 = rs[ii];
    14171469        tso.p2 = q;
     
    14441496}
    14451497
    1446 /*3
    1447 * looks through the pair set and the given module for
    1448 * remaining pairs or generators to consider
    1449 * returns a pointer to the first pair and the number of them in the given module
    1450 * works with slanted degree (i.e. deg=realdeg-index)
    1451 */
    1452 static SSet syChosePairs(syStrategy syzstr, int *index,
    1453                int *howmuch, int * actdeg)
     1498static SSet syChosePairsPutIn(syStrategy syzstr, int *index,
     1499               int *howmuch, int * actdeg, int an, int en)
    14541500{
    14551501  int newdeg=*actdeg,newindex=-1,i,t,sldeg;
     
    14581504  SRes resPairs=syzstr->resPairs;
    14591505 
    1460   while (*index<syzstr->length)
     1506  if (an>syzstr->length) return NULL;
     1507  if (en>syzstr->length) en=syzstr->length;
     1508  while (*index<en)
    14611509  {
    14621510    if (resPairs[*index]!=NULL)
     
    14681516        while ((i<(*syzstr->Tl)[*index]))
    14691517        {
    1470           p = (resPairs[*index])[i].lcm;
    1471           if (p!=NULL)
     1518          if ((resPairs[*index])[i].lcm!=NULL)
    14721519          {
    1473             if (pGetOrder(p) == sldeg)
     1520            if ((resPairs[*index])[i].order == sldeg)
    14741521            {
    14751522              result = &(resPairs[*index])[i];
     
    14771524              i++;
    14781525              while ((i<(*syzstr->Tl)[*index]) && ((resPairs[*index])[i].lcm!=NULL)
    1479                       && (pGetOrder((resPairs[*index])[i].lcm) == sldeg))
     1526                      && ((resPairs[*index])[i].order == sldeg))
    14801527              {
    14811528                i++;
     
    14941541          if ((resPairs[*index])[i].syz!=NULL)
    14951542          {
    1496             if (pTotaldegree((resPairs[*index])[i].syz) == sldeg)
     1543            if ((resPairs[*index])[i].order == sldeg)
    14971544            {
    14981545              result = &(resPairs[*index])[i];
     
    15001547              i++;
    15011548              while ((i<(*syzstr->Tl)[*index]) && ((resPairs[*index])[i].syz!=NULL)
    1502                       && (pTotaldegree((resPairs[*index])[i].syz) == *actdeg))
     1549                      && ((resPairs[*index])[i].order == *actdeg))
    15031550              {
    15041551                i++;
     
    15141561    (*index)++;
    15151562  }
    1516   *index = 0;
     1563  *index = an;
    15171564  //if (TEST_OPT_PROT) Print("(Euler:%d)",euler);
    1518   while (*index<syzstr->length)
     1565  while (*index<en)
    15191566  {
    15201567    if (resPairs[*index]!=NULL)
     
    15241571      {
    15251572        t = *actdeg+*index;
    1526         p = (resPairs[*index])[i].lcm;
    1527         if (p!=NULL)
    1528         {
    1529           if (pGetOrder(p) > t)
    1530             t = pGetOrder(p);
    1531         }
    1532         else if ((resPairs[*index])[i].syz!=NULL)
    1533         {
    1534           if (pTotaldegree((resPairs[*index])[i].syz) > t)
    1535             t = pTotaldegree((resPairs[*index])[i].syz);
     1573        if (((resPairs[*index])[i].lcm!=NULL) ||
     1574              ((resPairs[*index])[i].syz!=NULL))
     1575        {
     1576          if ((resPairs[*index])[i].order > t)
     1577            t = (resPairs[*index])[i].order;
    15361578        }
    15371579        if ((t>*actdeg+*index) && ((newdeg==*actdeg) || (t<newdeg+*index)))
     
    15501592    *actdeg = newdeg;
    15511593    *index = newindex;
    1552     return syChosePairs(syzstr,index,howmuch,actdeg);
     1594    return syChosePairsPutIn(syzstr,index,howmuch,actdeg,an,en);
    15531595  }
    15541596  else return NULL;
     1597}
     1598
     1599/*3
     1600* FOR THE HOMOGENEOUS CASE ONLY!
     1601* looks through the pair set and the given module for
     1602* remaining pairs or generators to consider
     1603* returns a pointer to the first pair and the number of them in the given module
     1604* works with slanted degree (i.e. deg=realdeg-index)
     1605*/
     1606static SSet syChosePairs(syStrategy syzstr, int *index,
     1607               int *howmuch, int * actdeg)
     1608{
     1609  return syChosePairsPutIn(syzsts,index,howmuch,actdeg,0,syzstr->length);
     1610}
     1611
     1612/*3
     1613* FOR THE INHOMOGENEOUS CASE ONLY!
     1614* looks through the pair set and the given module for
     1615* remaining pairs or generators to consider
     1616* returns a pointer to the first pair and the number of them in the given module
     1617* works with slanted degree (i.e. deg=realdeg-index)
     1618* looks first through the 0 and 1 module then through the other
     1619*/
     1620static SSet syChosePairsIH(syStrategy syzstr, int *index,
     1621               int *howmuch, int * actdeg, int mindeg)
     1622{
     1623  SSet result=NULL;
     1624
     1625  result = syChosePairsPutIn(syzstr,index,howmuch,actdeg,0,2);
     1626  if (result == NULL)
     1627  {
     1628    *actdeg = mindeg;
     1629    result = syChosePairsPutIn(syzstr,index,howmuch,actdeg,2,syzstr->length);
     1630  }
     1631  return result;
    15551632}
    15561633
     
    16021679*          if ((resPairs[*index])[i].syz!=NULL)
    16031680*          {
    1604 *            if (pTotaldegree((resPairs[*index])[i].syz) == *actdeg)
     1681*            if ((resPairs[*index])[i].order == *actdeg)
    16051682*            {
    16061683*              result = &(resPairs[*index])[i];
     
    16081685*              i++;
    16091686*              while ((i<(*Tl)[*index]) && ((resPairs[*index])[i].syz!=NULL)
    1610 *                      && (pTotaldegree((resPairs[*index])[i].syz) == *actdeg))
     1687*                      && ((resPairs[*index])[i].order == *actdeg))
    16111688*              {
    16121689*                i++;
     
    16381715*        else if ((resPairs[*index])[i].syz!=NULL)
    16391716*        {
    1640 *          if (pTotaldegree((resPairs[*index])[i].syz) > *actdeg)
    1641 *            t = pTotaldegree((resPairs[*index])[i].syz);
     1717*          if ((resPairs[*index])[i].order > *actdeg)
     1718*            t = (resPairs[*index])[i].order;
    16421719*        }
    16431720*        if ((t>*actdeg) && ((newdeg==*actdeg) || (t<newdeg)))
     
    18211898      Free((ADDRESS)syzstr->fullres,(syzstr->length+1)*sizeof(ideal));
    18221899    }
     1900    if (syzstr->cw!=NULL)
     1901      delete syzstr->cw;
    18231902    if (syzstr->resolution!=NULL)
    18241903      delete syzstr->resolution;
     
    18581937    jj=jj+2;
    18591938    intvec *result=new intvec(j,jj,0);
    1860     IMATELEM(*result,1,1) = idRankFreeModule(syzstr->res[1]);
     1939    IMATELEM(*result,1,1) = max(1,idRankFreeModule(syzstr->res[1]));
    18611940    for (i=0;i<jj;i++)
    18621941    {
     
    26972776  SSet nextPairs;
    26982777  syStrategy syzstr=(syStrategy)Alloc0(sizeof(ssyStrategy));
     2778  if ((idIs0(arg)) ||
     2779      ((idRankFreeModule(arg)>0) && (!idHomModule(arg,NULL,&(syzstr->cw)))))
     2780  {
     2781    syzstr->minres = (resolvente)Alloc0(sizeof(ideal));
     2782    syzstr->length = 1;
     2783    syzstr->minres[0] = idInit(1,arg->rank);
     2784    return syzstr;
     2785  }
    26992786  pSetmProc oldSetm=pSetm;
    27002787  pCompProc oldComp0=pComp0;
     
    27532840  }
    27542841  pComp0 = syzcomp2dpc;
    2755   syzstr->resPairs = syInitRes(temp,length,syzstr->Tl);
     2842  currcomponents = (int*)Alloc0((arg->rank+1)*sizeof(int));
     2843  for (i=0;i<=arg->rank;i++)
     2844    currcomponents[i] = i;
     2845  syzstr->resPairs = syInitRes(temp,length,syzstr->Tl,syzstr->cw);
     2846  Free((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
    27562847  syzstr->res = (resolvente)Alloc0((*length+1)*sizeof(ideal));
    27572848  syzstr->orderedRes = (resolvente)Alloc0((*length+1)*sizeof(ideal));
     
    27742865    if (TEST_OPT_PROT) Print("%d",actdeg);
    27752866    if (TEST_OPT_PROT) Print("(m%d)",index);
    2776     currcomponents = syzstr->truecomponents[max(index-1,0)];
    27772867    if (index==0)
    27782868      i = syInitSyzMod(syzstr,index,len0);
    27792869    else
    27802870      i = syInitSyzMod(syzstr,index);
     2871    currcomponents = syzstr->truecomponents[max(index-1,0)];
    27812872    j = syInitSyzMod(syzstr,index+1);
    27822873    if (index>0)
Note: See TracChangeset for help on using the changeset viewer.