Changeset 22579cf in git


Ignore:
Timestamp:
Mar 15, 2011, 7:17:44 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
273fed0aea0c3cb00dc08f02c5d5340a2a781f23
Parents:
91b031a4e88cb480f4ba993bf5904694c62d9b34
Message:
FIX: betti and convertion to list should not change a resolution (syzstr)!
FIX: La Scala must return min/full-res and should forget about syRing!
FIX: is syRing NOT needed after La Scala resolution is finished...
FIX: printing of resolution will not change the resolution anymore? (convetion to list?)

From: Oleksandr Motsak <motsak@mathematik.uni-kl.de>

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

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r91b031 r22579cf  
    29832983    }
    29842984  }
     2985
     2986  // test the La Scala case' output
     2987  assume( (iiOp == LRES_CMD) == (r->syRing != NULL) );
     2988  assume( (iiOp == LRES_CMD) == (r->resPairs != NULL) );
     2989  assume( (r->minres != NULL) || (r->fullres != NULL) );
     2990
    29852991  return FALSE;
    29862992}
     
    41904196{
    41914197  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
    4192   res->data=(char *)syMinimize((syStrategy)v->Data());
     4198
     4199  syStrategy tmp=(syStrategy)v->Data();
     4200  tmp = syMinimize(tmp); // enrich itself!
     4201
     4202  res->data=(char *)tmp;
     4203 
    41934204  if (weights!=NULL)
    41944205    atSet(res, omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
     4206
    41954207  return FALSE;
    41964208}
  • Singular/ipconv.cc

    r91b031 r22579cf  
    236236
    237237  syStrategy tmp=(syStrategy)in->CopyD();
     238
    238239  out->data=(void *)syConvRes(tmp,TRUE,add_row_shift);
    239240}
  • Singular/ipshell.cc

    r91b031 r22579cf  
    21102110      }
    21112111      R->order[j]=rOrderName(omStrDup((char*)vv->m[0].Data())); // assume STRING
     2112
    21122113      if (j==0) R->block0[0]=1;
    21132114      else
     
    25112512{
    25122513  syStrategy syzstr=(syStrategy)u->Data();
     2514
    25132515  BOOLEAN minim=(int)(long)w->Data();
    25142516  int row_shift=0;
     
    25222524     (*weights) -= add_row_shift;
    25232525  }
     2526 
    25242527  res->data=(void *)syBettiOfComputation(syzstr,minim,&row_shift,weights);
    25252528  //row_shift += add_row_shift;
    25262529  //Print("row_shift=%d, add_row_shift=%d\n",row_shift,add_row_shift);
    25272530  atSet(res,omStrDup("rowShift"),(void*)add_row_shift,INT_CMD);
     2531
    25282532  return FALSE;
    25292533}
     
    25422546lists syConvRes(syStrategy syzstr,BOOLEAN toDel,int add_row_shift)
    25432547{
    2544   if ((syzstr->fullres==NULL) && (syzstr->minres==NULL))
     2548  resolvente fullres = syzstr->fullres;
     2549  resolvente minres = syzstr->minres;
     2550
     2551  const int length = syzstr->length;
     2552
     2553  if ((fullres==NULL) && (minres==NULL))
    25452554  {
    25462555    if (syzstr->hilb_coeffs==NULL)
    25472556    {
    2548       syzstr->fullres = syReorder(syzstr->res,syzstr->length,syzstr);
     2557      fullres = syReorder(syzstr->res, length, syzstr);
    25492558    }
    25502559    else
    25512560    {
    2552       syzstr->minres = syReorder(syzstr->orderedRes,syzstr->length,syzstr);
    2553       syKillEmptyEntres(syzstr->minres,syzstr->length);
    2554     }
    2555   }
     2561      minres = syReorder(syzstr->orderedRes, length, syzstr);
     2562      syKillEmptyEntres(minres, length);
     2563    }
     2564  }
     2565
    25562566  resolvente tr;
    25572567  int typ0=IDEAL_CMD;
    2558   if (syzstr->minres!=NULL)
    2559     tr = syzstr->minres;
     2568
     2569  if (minres!=NULL)
     2570    tr = minres;
    25602571  else
    2561     tr = syzstr->fullres;
    2562   resolvente trueres=NULL;
    2563   intvec ** w=NULL;
    2564   if (syzstr->length>0)
    2565   {
    2566     trueres=(resolvente)omAlloc0((syzstr->length)*sizeof(ideal));
    2567     for (int i=(syzstr->length)-1;i>=0;i--)
     2572    tr = fullres;
     2573 
     2574  resolvente trueres=NULL; intvec ** w=NULL;
     2575
     2576  if (length>0)
     2577  {
     2578    trueres = (resolvente)omAlloc0((length)*sizeof(ideal));
     2579    for (int i=(length)-1;i>=0;i--)
    25682580    {
    25692581      if (tr[i]!=NULL)
     
    25762588    if (syzstr->weights!=NULL)
    25772589    {
    2578       w = (intvec**)omAlloc0((syzstr->length)*sizeof(intvec*));
    2579       for (int i=(syzstr->length)-1;i>=0;i--)
     2590      w = (intvec**)omAlloc0(length*sizeof(intvec*));
     2591      for (int i=length-1;i>=0;i--)
    25802592      {
    25812593        if (syzstr->weights[i]!=NULL) w[i] = ivCopy(syzstr->weights[i]);
     
    25832595    }
    25842596  }
    2585   lists li = liMakeResolv(trueres,syzstr->length,syzstr->list_length,typ0,
    2586                           w,add_row_shift);
    2587   if (w != NULL) omFreeSize(w, (syzstr->length)*sizeof(intvec*));
    2588   if (toDel) syKillComputation(syzstr);
     2597 
     2598  lists li = liMakeResolv(trueres, length, syzstr->list_length,typ0,
     2599                          w, add_row_shift);
     2600
     2601  if (w != NULL) omFreeSize(w, length*sizeof(intvec*));
     2602 
     2603  if (toDel)
     2604    syKillComputation(syzstr);
     2605  else
     2606  {
     2607    if( fullres != NULL && syzstr->fullres == NULL )
     2608      syzstr->fullres = fullres;
     2609
     2610    if( minres != NULL && syzstr->minres == NULL )
     2611      syzstr->minres = minres;
     2612  }
     2613 
    25892614  return li;
     2615
     2616 
    25902617}
    25912618
  • Singular/subexpr.cc

    r91b031 r22579cf  
    144144          break;
    145145        case RESOLUTION_CMD:
    146           syPrint((syStrategy)d);
     146        {
     147          syStrategy tmp=(syStrategy)d;
     148          syPrint(tmp);
    147149          break;
     150        }
    148151        case STRING_CMD:
    149152          PrintNSpaces(spaces);
  • kernel/kstd2.cc

    r91b031 r22579cf  
    816816  }
    817817}
     818
    818819/*2
    819820*  reduction procedure for the normal form
  • kernel/ring.cc

    r91b031 r22579cf  
    33403340    r->pFDeg = pWTotaldegree; // may be improved: p_Totaldegree for lp/dp/ls/.. blocks
    33413341  }
     3342 
    33423343  if (rOrd_is_Totaldegree_Ordering(r) || rOrd_is_WeightedDegree_Ordering(r))
    33433344    r->pFDeg = pDeg;
  • kernel/syz1.cc

    r91b031 r22579cf  
    17901790      return ivCopy(syzstr->betti);
    17911791  }
    1792   if ((syzstr->fullres==NULL) && (syzstr->minres==NULL))
     1792
     1793  resolvente fullres = syzstr->fullres;
     1794  resolvente minres = syzstr->minres;
     1795  const int length = syzstr->length;
     1796 
     1797  if ((fullres==NULL) && (minres==NULL))
    17931798  {
    17941799     if (syzstr->hilb_coeffs==NULL)
    17951800     {
    1796         syzstr->fullres = syReorder(syzstr->res,syzstr->length,syzstr);
     1801        fullres = syReorder(syzstr->res, length, syzstr);
    17971802     }
    17981803     else
    17991804     {
    1800         syzstr->minres = syReorder(syzstr->orderedRes,syzstr->length,syzstr);
    1801         syKillEmptyEntres(syzstr->minres,syzstr->length);
     1805        minres = syReorder(syzstr->orderedRes, length, syzstr);
     1806        syKillEmptyEntres(minres, length);
    18021807     }
    1803    }
     1808  }
     1809 
    18041810  intvec *result=NULL;
    1805   if (syzstr->fullres!=NULL)
    1806     result = syBetti(syzstr->fullres,syzstr->length,&dummy,weights,minim,row_shift);
     1811 
     1812  if (fullres!=NULL)
     1813    result = syBetti(fullres,length,&dummy,weights,minim,row_shift);
    18071814  else
    1808     result = syBetti(syzstr->minres,syzstr->length,&dummy,weights,minim,row_shift);
     1815    result = syBetti(minres,length,&dummy,weights,minim,row_shift);
     1816
     1817
     1818  return result; /// Don't change the syzstr???
     1819
     1820  // TODO: cleanup thses!
     1821  if( fullres != NULL && syzstr->fullres == NULL )
     1822    syzstr->fullres = fullres;
     1823  if( minres != NULL && syzstr->minres == NULL )
     1824    syzstr->minres = minres;
     1825
    18091826  if ((result!=NULL)
    18101827  && ((minim) || (syzstr->resPairs!=NULL))
    18111828  && std_weights)
    18121829  {
    1813     syzstr->betti = ivCopy(result);
    1814   }
     1830    syzstr->betti = ivCopy(result); // cache the result...
     1831  }
     1832 
    18151833  return result;
    18161834}
     
    19261944void syPrint(syStrategy syzstr)
    19271945{
    1928   if ((syzstr->resPairs==NULL) && (syzstr->fullres==NULL)
    1929      && (syzstr->minres==NULL))
     1946  if ( (syzstr->resPairs==NULL) &&
     1947       (syzstr->fullres==NULL)  &&
     1948       (syzstr->minres==NULL) &&
     1949       (syzstr->resolution == NULL) )
    19301950  {
    19311951    PrintS("No resolution defined\n");
    19321952    return;
    19331953  }
    1934   int l=0;
    1935   if (syzstr->resolution==NULL)
    1936   {
    1937     int j;
     1954
     1955  intvec* resolution = syzstr->resolution;
     1956 
     1957  if (resolution==NULL)
     1958  {
    19381959    if (syzstr->resPairs!=NULL)
    19391960    {
    1940       syzstr->resolution = new intvec(syzstr->length+1);
    1941       SRes rP=syzstr->resPairs;
    1942       assume(idRankFreeModule(syzstr->res[1],
    1943                                  (syzstr->syRing != NULL ? syzstr->syRing : currRing))==syzstr->res[1]->rank);
    1944       (*syzstr->resolution)[0] = syzstr->res[1]->rank;
    1945       while ((l<syzstr->length) && (rP[l]!=NULL))
    1946       {
    1947         j=0;
    1948         while ((j<(*syzstr->Tl)[l]) &&
    1949           ((rP[l][j].lcm!=NULL) || (rP[l][j].syz!=NULL)))
    1950         {
    1951           if (rP[l][j].isNotMinimal==NULL)
    1952             ((*syzstr->resolution)[l+1])++;
     1961      resolution = new intvec(syzstr->length+1);
     1962      SRes rP = syzstr->resPairs;
     1963//      assume(idRankFreeModule(syzstr->res[1], (syzstr->syRing != NULL ? syzstr->syRing : currRing))==syzstr->res[1]->rank);
     1964      (*resolution)[0] = syzstr->res[1]->rank;
     1965      int k=0;
     1966      while ((k<syzstr->length) && (rP[k]!=NULL))
     1967      {
     1968        int j = 0;
     1969        while ((j<(*syzstr->Tl)[k]) &&
     1970          ((rP[k][j].lcm!=NULL) || (rP[k][j].syz!=NULL)))
     1971        {
     1972          if (rP[k][j].isNotMinimal==NULL)
     1973            ((*resolution)[k+1])++;
    19531974          j++;
    19541975        }
    1955         l++;
     1976        k++;
    19561977      }
    19571978    }
    19581979    else
    19591980    {
     1981      resolution = new intvec(syzstr->length+2);
    19601982      resolvente rr;
    1961       syzstr->resolution = new intvec(syzstr->length+2);
    19621983      if (syzstr->minres!=NULL)
    19631984        rr = syzstr->minres;
    19641985      else
    19651986        rr = syzstr->fullres;
    1966       (*syzstr->resolution)[0]
     1987      (*resolution)[0]
    19671988        = si_max(1,(int)idRankFreeModule(rr[0],
    19681989                                 (syzstr->syRing != NULL ? syzstr->syRing : currRing)));
    1969       while ((l<syzstr->length) && (rr[l]!=NULL))
    1970       {
    1971         j = IDELEMS(rr[l]);
    1972         while ((j>0) && (rr[l]->m[j-1]==NULL)) j--;
    1973         ((*syzstr->resolution)[l+1]) = j;
    1974         l++;
     1990      int k=0;
     1991      while ((k<syzstr->length) && (rr[k]!=NULL))
     1992      {
     1993        (*resolution)[k+1] = idSize(rr[k]);
     1994        k++;
    19751995      }
    19761996    }
     
    19791999  int sl=strlen(sn);
    19802000  syPrintEmptySpaces1(sl);
    1981   l = 0;
     2001  int k = 0;
    19822002  loop
    19832003  {
    1984     if ((l>=syzstr->resolution->length()) || ((*syzstr->resolution)[l]==0))
     2004    if ((k>=resolution->length()) || ((*resolution)[k]==0))
    19852005      break;
    1986     Print("%d",(*syzstr->resolution)[l]);
     2006    Print("%d",(*resolution)[k]);
    19872007    syPrintEmptySpaces1(sl+5);
    1988     l++;
     2008    k++;
    19892009  }
    19902010  PrintLn();
    1991   l = 0;
     2011  k = 0;
    19922012  loop
    19932013  {
    1994     if ((l>=syzstr->resolution->length()) || ((*syzstr->resolution)[l]==0))
     2014    if ((k>=resolution->length()) || ((*resolution)[k]==0))
    19952015      break;
    19962016    PrintS(sn);
    1997     if (((l+1)>=syzstr->resolution->length()) || ((*syzstr->resolution)[(l+1)]==0))
     2017    if (((k+1)>=resolution->length()) || ((*resolution)[(k+1)]==0))
    19982018      break;
    19992019    PrintS(" <-- ");
    2000     syPrintEmptySpaces((*syzstr->resolution)[l]);
    2001     l++;
     2020    syPrintEmptySpaces((*resolution)[k]);
     2021    k++;
    20022022  }
    20032023  PrintLn();
    20042024  PrintLn();
    2005   l = 0;
     2025  k = 0;
    20062026  loop
    20072027  {
    2008     if ((l>=syzstr->resolution->length()) || ((*syzstr->resolution)[l]==0))
     2028    if ((k>=resolution->length()) || ((*resolution)[k]==0))
    20092029      break;
    2010     Print("%d",l);
    2011     syPrintEmptySpaces1(sl+5+syLengthInt((*syzstr->resolution)[l])-
    2012                          syLengthInt(l));
    2013     l++;
     2030    Print("%d",k);
     2031    syPrintEmptySpaces1(sl+5+syLengthInt((*resolution)[k])-
     2032                         syLengthInt(k));
     2033    k++;
    20142034  }
    20152035  PrintLn();
     
    20192039    PrintLn();
    20202040  }
     2041
     2042  if (syzstr->resolution == NULL) syzstr->resolution = resolution;
    20212043}
    20222044
     
    25162538    rChangeCurrRing(origR);
    25172539  pLmDelete(&redpol);
     2540
    25182541  if (TEST_OPT_PROT) PrintLn();
     2542
     2543  if (syzstr->minres==NULL)
     2544      if (syzstr->resPairs!=NULL)
     2545        if (syzstr->hilb_coeffs==NULL)
     2546          syzstr->minres = syReadOutMinimalRes(syzstr);
     2547 
    25192548  return syzstr;
    25202549}
Note: See TracChangeset for help on using the changeset viewer.