Changeset 273fed in git


Ignore:
Timestamp:
Mar 15, 2011, 7:17:45 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd25190065115c859833252500a64cfb7b11e3a50')
Children:
1ed3466deda30d9e243b441fb4bc4e0c4729cf69
Parents:
22579cf2576a536b5b44f1a1f2a2d773444baeda
Message:
FIX: My changes related to Syzygy/Schreyer-Induces orderings (+degree) for interpreter

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

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

Legend:

Unmodified
Added
Removed
  • Singular/ipshell.cc

    r22579cf r273fed  
    18141814    LLL->m[0].rtyp=STRING_CMD;
    18151815    LLL->m[0].data=(void *)omStrDup(rSimpleOrdStr(r->order[i]));
     1816
     1817    if(r->order[i] == ringorder_IS) //  || r->order[i] == ringorder_s || r->order[i] == ringorder_S)
     1818    {
     1819      assume( r->block0[i] == r->block1[i] );
     1820      const int s = r->block0[i];
     1821      assume( -2 < s && s < 2);
     1822
     1823      iv=new intvec(1);
     1824      (*iv)[0] = s;
     1825    } else
    18161826    if (r->block1[i]-r->block0[i] >=0 )
    18171827    {
     
    21202130            || (R->order[jj]== ringorder_c)
    21212131            || (R->order[jj]== ringorder_C)
     2132            || (R->order[jj]== ringorder_s)
     2133            || (R->order[jj]== ringorder_S)
    21222134         ))
    21232135         {
     
    21722184           R->block1[j]=R->block0[j]=0;
    21732185           break;
     2186
     2187         case ringorder_s:
     2188         {
     2189           break;
     2190         }
     2191
     2192         case ringorder_IS:
     2193         {
     2194           R->block1[j] = R->block0[j] = 0;
     2195           if( iv->length() > 0 )
     2196           {
     2197             const int s = (*iv)[0];
     2198             assume( -2 < s && s < 2 );
     2199             R->block1[j] = R->block0[j] = s;
     2200           }
     2201           break;
     2202         }
    21742203         case 0:
    21752204         case ringorder_unspec:
     
    45684597            }
    45694598            break;
     4599
     4600          case ringorder_s: // no 'rank' params!
     4601          {
     4602           
     4603            if(iv->length() > 3)
     4604              return TRUE;
     4605
     4606            if(iv->length() == 3)
     4607            {
     4608              const int s = (*iv)[2];
     4609              R->block0[n] = s;           
     4610              R->block1[n] = s;
     4611            }
     4612            break;           
     4613          }
     4614          case ringorder_IS:
     4615          {
     4616            if(iv->length() != 3) return TRUE;
     4617           
     4618            const int s = (*iv)[2];
     4619
     4620            if( 1 < s || s < -1 ) return TRUE;
     4621             
     4622            R->block0[n] = s;           
     4623            R->block1[n] = s;
     4624            break;
     4625          }           
    45704626          case ringorder_S:
    45714627          case ringorder_c:
    45724628          case ringorder_C:
     4629          {
    45734630            if (rCheckIV(iv)) return TRUE;
    45744631            break;
     4632          }
    45754633          case ringorder_aa:
    45764634          case ringorder_a:
     4635          {
    45774636            R->block0[n] = last+1;
    45784637            R->block1[n] = si_min(last+iv->length()-2 , rVar(R));
     
    45864645            last=R->block0[n]-1;
    45874646            break;
     4647          }
    45884648          case ringorder_a64:
    45894649          {
     
    46354695
    46364696  // check for complete coverage
    4637   if ((R->order[n]==ringorder_c) ||  (R->order[n]==ringorder_C)) n--;
     4697  while ( n >= 0 && (
     4698          (R->order[n]==ringorder_c)
     4699      ||  (R->order[n]==ringorder_C)
     4700      ||  (R->order[n]==ringorder_s)
     4701      ||  (R->order[n]==ringorder_S)
     4702      ||  (R->order[n]==ringorder_IS)
     4703                    )) n--;
     4704
     4705  assume( n >= 0 );
     4706 
    46384707  if (R->block1[n] != R->N)
    46394708  {
  • kernel/pInline2.h

    r22579cf r273fed  
    5050        return (((long)((p)->exp[r->pOrdIndex]))-POLY_NEGWEIGHT_OFFSET);
    5151      case ro_syzcomp:
    52       case ro_syz: case ro_isTemp:  case ro_is:
     52      case ro_syz:
    5353      case ro_cp:
    5454        i++;
  • kernel/p_polys.cc

    r22579cf r273fed  
    169169        case ro_syz:
    170170        {
    171           int c=p_GetComp(p, r);
    172           if (c > o->data.syz.limit)
    173             p->exp[o->data.syz.place] = o->data.syz.curr_index;
     171          const unsigned long c = p_GetComp(p, r);
     172          const short place = o->data.syz.place;
     173          const int limit = o->data.syz.limit;
     174         
     175          if (c > limit)
     176            p->exp[place] = o->data.syz.curr_index;
    174177          else if (c > 0)
    175             p->exp[o->data.syz.place]= o->data.syz.syz_index[c];
     178          {
     179            assume( (1 <= c) && (c <= limit) );
     180            p->exp[place]= o->data.syz.syz_index[c];
     181          }
    176182          else
    177183          {
    178184            assume(c == 0);
    179             p->exp[o->data.syz.place]= 0;
     185            p->exp[place]= 0;
    180186          }
    181187          break;
     
    188194#ifndef NDEBUG
    189195#if MYTEST
    190           Print("isTemp ord in rSetm: pos: %d, p: ", pos);  p_DebugPrint(p, r, r, 0);
     196          Print("p_Setm_General: isTemp ord: pos: %d, p: ", pos);  p_DebugPrint(p, r, r, 1);
    191197#endif
    192198#endif
     
    251257        case ro_is:
    252258        {
     259#ifndef NDEBUG
     260#if MYTEST
     261          Print("p_Setm_General: ro_is ord: pos: %d, p: ", pos);  p_DebugPrint(p, r, r, 1);
     262#endif
     263#endif
     264
    253265          assume(p != NULL);
    254266
  • kernel/ring.cc

    r22579cf r273fed  
    352352    else if (r->order[l] == ringorder_IS)
    353353    {
    354 #ifndef NDEBUG
    355       if(r->block0[l] == 0 )
    356         PrintS("::prefix");
    357       else
    358         Print("::suffix (sign: %d)", r->block0[l]);
    359 #endif
     354      assume( r->block0[l] == r->block1[l] );
     355      const int s = r->block0[l];
     356      assume( (-2 < s) && (s < 2) );
     357      Print("(%d)", s); // 0 => prefix! +/-1 => suffix!
    360358      continue;
    361359    }
     
    559557  {
    560558    StringAppendS((char *)rSimpleOrdStr(r->order[l]));
    561     if ((r->order[l] != ringorder_c) && (r->order[l] != ringorder_C))
     559    if (
     560           (r->order[l] != ringorder_c)
     561        && (r->order[l] != ringorder_C)
     562        && (r->order[l] != ringorder_s)
     563        && (r->order[l] != ringorder_S)
     564        && (r->order[l] != ringorder_IS)
     565       )
    562566    {
    563567      if (r->wvhdl[l]!=NULL)
     
    599603        StringAppend("(%d)",r->block1[l]-r->block0[l]+1);
    600604    }
     605    else if (r->order[l] == ringorder_IS)
     606    {
     607      assume( r->block0[l] == r->block1[l] );
     608      const int s = r->block0[l];
     609      assume( (-2 < s) && (s < 2) );
     610
     611      StringAppend("(%d)", s);
     612    }
     613
    601614    if (l==nblocks) return omStrDup(StringAppendS(""));
    602615    StringAppendS(",");
     
    18911904  assume(blocks >= 1);
    18921905  if (blocks == 1) return TRUE;
    1893   if (blocks > 2)  return FALSE;
    1894   if ((r->order[0] != ringorder_c)
    1895   && (r->order[0] != ringorder_C)
    1896   && (r->order[1] != ringorder_c)
    1897   && (r->order[1] != ringorder_C))
     1906
     1907  int s = 0;
     1908  while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) )
     1909  {
     1910    s++;
     1911    blocks--;
     1912  }
     1913
     1914  if ((blocks - s) > 2)  return FALSE;
     1915
     1916  assume( blocks == s + 2 );
     1917 
     1918  if (
     1919     (r->order[s] != ringorder_c)
     1920  && (r->order[s] != ringorder_C)
     1921  && (r->order[s+1] != ringorder_c)
     1922  && (r->order[s+1] != ringorder_C)
     1923     )
    18981924    return FALSE;
    1899   if ((r->order[1] == ringorder_M)
    1900   || (r->order[0] == ringorder_M))
     1925  if ((r->order[s+1] == ringorder_M)
     1926  || (r->order[s] == ringorder_M))
    19011927    return FALSE;
    19021928  return TRUE;
     
    19491975BOOLEAN rHasSimpleOrderAA(ring r)
    19501976{
     1977  if (r->order[0] == ringorder_unspec) return TRUE;
    19511978  int blocks = rBlocks(r) - 1;
    1952   if ((blocks > 3) || (blocks < 2)) return FALSE;
    1953   if (blocks == 3)
    1954   {
    1955     return (((r->order[0] == ringorder_aa) && (r->order[1] != ringorder_M) &&
    1956              ((r->order[2] == ringorder_c) || (r->order[2] == ringorder_C))) ||
    1957             (((r->order[0] == ringorder_c) || (r->order[0] == ringorder_C)) &&
    1958              (r->order[1] == ringorder_aa) && (r->order[2] != ringorder_M)));
     1979  assume(blocks >= 1);
     1980  if (blocks == 1) return TRUE;
     1981
     1982  int s = 0;
     1983  while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) )
     1984  {
     1985    s++;
     1986    blocks--;
     1987  }
     1988
     1989  if ((blocks - s) > 3)  return FALSE;
     1990 
     1991//  if ((blocks > 3) || (blocks < 2)) return FALSE;
     1992  if ((blocks - s) == 3)
     1993  {
     1994    return (((r->order[s] == ringorder_aa) && (r->order[s+1] != ringorder_M) &&
     1995             ((r->order[s+2] == ringorder_c) || (r->order[s+2] == ringorder_C))) ||
     1996            (((r->order[s] == ringorder_c) || (r->order[s] == ringorder_C)) &&
     1997             (r->order[s+1] == ringorder_aa) && (r->order[s+2] != ringorder_M)));
    19591998  }
    19601999  else
    19612000  {
    1962     return ((r->order[0] == ringorder_aa) && (r->order[1] != ringorder_M));
     2001    return ((r->order[s] == ringorder_aa) && (r->order[s+1] != ringorder_M));
    19632002  }
    19642003}
     
    32493288      ||(
    32503289    ((order[1]==ringorder_c)||(order[1]==ringorder_C)
    3251      ||(order[1]==ringorder_S) ||(order[1]==ringorder_IS)
     3290     ||(order[1]==ringorder_S)
    32523291     ||(order[1]==ringorder_s))
    32533292    && (order[0]!=ringorder_M)
     
    32563295  {
    32573296    if ((order[0]!=ringorder_unspec)
    3258     && ((order[1]==ringorder_C)||(order[1]==ringorder_S)||(order[1]==ringorder_IS)||
     3297    && ((order[1]==ringorder_C)||(order[1]==ringorder_S)||
    32593298        (order[1]==ringorder_s)))
    32603299      r->ComponentOrder=-1;
     
    32813320  else if (((order[0]==ringorder_c)
    32823321            ||(order[0]==ringorder_C)
    3283             ||(order[0]==ringorder_S) ||(order[0]==ringorder_IS)
     3322            ||(order[0]==ringorder_S)
    32843323            ||(order[0]==ringorder_s))
    32853324  && (order[1]!=ringorder_M)
    32863325  &&  (order[2]==0))
    32873326  {
    3288     if ((order[0]==ringorder_C)||(order[0]==ringorder_S)|| (order[0]==ringorder_IS) ||
     3327    if ((order[0]==ringorder_C)||(order[0]==ringorder_S)||
    32893328        order[0]==ringorder_s)
    32903329      r->ComponentOrder=-1;
     
    33103349  else
    33113350  {
    3312     if ((r->VectorOut)||(order[0]==ringorder_C)||(order[0]==ringorder_S)||(order[0]==ringorder_s) ||(order[0]==ringorder_IS))
     3351    if ((r->VectorOut)||(order[0]==ringorder_C)||(order[0]==ringorder_S)||(order[0]==ringorder_s))
    33133352    {
    33143353      rSetFirstWv(r, 1, order, block1, wvhdl);
     
    33293368    if ((order[0]!=ringorder_c)
    33303369        && (order[0]!=ringorder_C)
    3331         && (order[0]!=ringorder_S) && (order[0]!=ringorder_IS)
     3370        && (order[0]!=ringorder_S)
    33323371        && (order[0]!=ringorder_s))
    33333372    {
     
    36523691      case ringorder_IS:
    36533692      {
     3693
     3694        assume( r->block0[i] == r->block1[i] );
    36543695        const int s = r->block0[i];
    3655         assume( s >= -1 && s <= 1);
    3656 
    3657         assume( r->block0[i] == r->block1[i] );
     3696        assume( -2 < s && s < 2);
    36583697
    36593698        if(s == 0) // Prefix IS
     
    39894028    Print("  typ %s", TYP[r->typ[j].ord_typ]);
    39904029
    3991     if (r->typ[j].ord_typ==ro_isTemp)
     4030
     4031    if (r->typ[j].ord_typ==ro_syz)
     4032    {
     4033      const short place = r->typ[j].data.syz.place;
     4034      const int limit = r->typ[j].data.syz.limit;
     4035      const int curr_index = r->typ[j].data.syz.curr_index;
     4036      const int* syz_index = r->typ[j].data.syz.syz_index;
     4037
     4038      Print("  limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
     4039
     4040      if( syz_index == NULL )
     4041        PrintS("(NULL)");
     4042      else
     4043      {
     4044        Print("{");
     4045        for( i=0; i <= limit; i++ )
     4046          Print("%d ", syz_index[i]);
     4047        Print("}");
     4048      }
     4049
     4050    }
     4051    else if (r->typ[j].ord_typ==ro_isTemp)
    39924052    {
    39934053      Print("  start (level) %d, suffixpos: %d, VO: ",r->typ[j].data.isTemp.start, r->typ[j].data.isTemp.suffixpos);
     
    39994059#endif
    40004060    }
    4001     else
    4002     if (r->typ[j].ord_typ==ro_is)
     4061    else if (r->typ[j].ord_typ==ro_is)
    40034062    {
    40044063      Print("  start %d, end: %d: ",r->typ[j].data.is.start, r->typ[j].data.is.end);
     
    40934152    Print(" %s,\n", ((char**) &proc_names)[i]);
    40944153  }
     4154
     4155  {
     4156#define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
     4157    Print("\npFDeg   : ");
     4158   
     4159    pFDeg_CASE(p_Totaldegree); else
     4160      pFDeg_CASE(pWFirstTotalDegree); else
     4161      pFDeg_CASE(pWTotaldegree); else
     4162      pFDeg_CASE(pDeg); else
     4163      Print("(%p)", r->pFDeg); // default case
     4164   
     4165    PrintS("\n");
     4166#undef pFDeg_CASE
     4167  }
     4168   
    40954169}
    40964170
     
    42994373{
    43004374  if ( (r->order[0] == ringorder_s) ) return r;
     4375
    43014376  if ( (r->order[0] == ringorder_IS) )
    43024377  {
    43034378#ifndef NDEBUG
    4304     WarnS("rAssure_SyzComp in an IS ring!");
     4379    WarnS("rAssure_SyzComp: input ring has an IS-ordering!");
    43054380#endif
    43064381//    return r;
     
    47474822    PrintLn();
    47484823#endif
    4749 
     4824  assume((sgn == 1) || (sgn == -1));
    47504825
    47514826  ring res=rCopy0(r, FALSE, FALSE); // No qideal & ordering copy.
     
    47654840  int j = 0;
    47664841  res->order[j] = ringorder_IS; // Prefix
    4767   // res->block0[j] = res->block1[j] = 0;
     4842  res->block0[j] = res->block1[j] = 0;
    47684843  // wvhdl[j] = NULL;
    47694844  j++;
     
    48794954  return rCurrRingAssure_Global(ringorder_C, ringorder_dp);
    48804955}
     4956
     4957
     4958
     4959/// Finds p^th IS ordering, and returns its position in r->typ[]
     4960/// returns -1 if something went wrong!
     4961int rGetISPos(const int p = 0, const ring r = currRing)
     4962{
     4963  // Put the reference set F into the ring -ordering -recor
     4964#if MYTEST
     4965  Print("rIsIS(p: %d)\nF:", p);
     4966  PrintLn();
     4967#endif
     4968
     4969  if (r->typ==NULL)
     4970  {
     4971    dReportError("'rIsIS:' Error: wrong ring! (typ == NULL)");
     4972    return -1;
     4973  }
     4974
     4975  int j = p; // Which IS record to use...
     4976  for( int pos = 0; pos < r->OrdSize; pos++ )
     4977    if( r->typ[pos].ord_typ == ro_is)
     4978      if( j-- == 0 )
     4979      {
     4980        return pos;
     4981      }
     4982
     4983  return -1;
     4984}
     4985
     4986
     4987
     4988
     4989
    48814990
    48824991/// Changes r by setting induced ordering parameters: limit and reference leading terms
     
    49125021  }
    49135022
    4914   int j = p; // Which IS record to use...
    4915   for( int pos = 0; pos < r->OrdSize; pos++ )
    4916     if( r->typ[pos].ord_typ == ro_is)
    4917       if( j-- == 0 )
    4918       {
     5023
     5024  int pos = rGetISPos(p, r);
     5025
     5026  if( pos == -1 )
     5027  {
     5028    dReportError("Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
     5029    return false;
     5030  }
     5031
    49195032#if MYTEST
    4920         Print("Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit, i);
    4921 #endif
    4922 
    4923         const ideal FF = idrHeadR(F, r, r);
    4924 
    4925 
    4926         if( r->typ[pos].data.is.F != NULL)
    4927         {
     5033  if( i != r->typ[pos].data.is.limit )
     5034    Print("Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit, i);
     5035#endif
     5036
     5037  const ideal FF = id_Copy(F, r); // idrHeadR(F, r, r);
     5038
     5039
     5040  if( r->typ[pos].data.is.F != NULL)
     5041  {
    49285042#if MYTEST
    4929           PrintS("Deleting old reference set F... \n");        // idShow(r->typ[pos].data.is.F, r);         PrintLn();
    4930 #endif
    4931           id_Delete(&r->typ[pos].data.is.F, r);
    4932           r->typ[pos].data.is.F = NULL;
    4933         }
    4934 
    4935         assume(r->typ[pos].data.is.F == NULL);
    4936 
    4937         r->typ[pos].data.is.F = FF; // F is owened by ring now! TODO: delete at the end!
    4938 
    4939         if(r->typ[pos].data.is.componentWeights != NULL)
    4940         {
     5043    PrintS("Deleting old reference set F... \n");        // idShow(r->typ[pos].data.is.F, r);         PrintLn();
     5044#endif
     5045    id_Delete(&r->typ[pos].data.is.F, r);
     5046    r->typ[pos].data.is.F = NULL;
     5047  }
     5048
     5049  assume(r->typ[pos].data.is.F == NULL);
     5050
     5051  r->typ[pos].data.is.F = FF; // F is owened by ring now! TODO: delete at the end!
     5052
     5053  if(r->typ[pos].data.is.componentWeights != NULL)
     5054  {
    49415055#if MYTEST
    4942           PrintS("Deleting old componentWeights: "); r->typ[pos].data.is.componentWeights->show(); PrintLn();
    4943 #endif
    4944           delete r->typ[pos].data.is.componentWeights;
    4945           r->typ[pos].data.is.componentWeights = NULL;
    4946         }
    4947 
    4948 
    4949         assume(r->typ[pos].data.is.componentWeights == NULL);
    4950 
    4951         if( componentWeights != NULL )
    4952           componentWeights = ivCopy(componentWeights); // componentWeights is owened by ring now! TODO: delete at the end!
    4953 
    4954         r->typ[pos].data.is.componentWeights = componentWeights;
    4955 
    4956         r->typ[pos].data.is.limit = i; // First induced component
     5056    PrintS("Deleting old componentWeights: "); r->typ[pos].data.is.componentWeights->show(); PrintLn();
     5057#endif
     5058    delete r->typ[pos].data.is.componentWeights;
     5059    r->typ[pos].data.is.componentWeights = NULL;
     5060  }
     5061
     5062
     5063  assume(r->typ[pos].data.is.componentWeights == NULL);
     5064
     5065  if( componentWeights != NULL )
     5066    componentWeights = ivCopy(componentWeights); // componentWeights is owened by ring now! TODO: delete at the end!
     5067
     5068  r->typ[pos].data.is.componentWeights = componentWeights;
     5069
     5070  r->typ[pos].data.is.limit = i; // First induced component
    49575071
    49585072#if MYTEST
    4959         PrintS("New reference set FF : \n");        idShow(FF, r, r, 1);         PrintLn();
    4960 #endif
    4961 
    4962         return true;
    4963       }
    4964 
    4965   dReportError("Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
    4966   return false;
     5073  PrintS("New reference set FF : \n");        idShow(FF, r, r, 1);         PrintLn();
     5074#endif
     5075
     5076  return true;
    49675077}
    49685078
     
    49705080void rSetSyzComp(int k)
    49715081{
     5082  if(k < 0)
     5083  {
     5084    dReportError("rSetSyzComp with negative limit!");
     5085    return;
     5086  }
     5087
     5088  assume( k >= 0 );
    49725089  if (TEST_OPT_PROT) Print("{%d}", k);
    49735090  if ((currRing->typ!=NULL) && (currRing->typ[0].ord_typ==ro_syz))
    49745091  {
    4975     assume(k > currRing->typ[0].data.syz.limit);
     5092    if( k == currRing->typ[0].data.syz.limit )
     5093      return; // nothing to do
     5094
    49765095    int i;
    49775096    if (currRing->typ[0].data.syz.limit == 0)
     
    49935112        currRing->typ[0].data.syz.curr_index;
    49945113    }
     5114    if(k < currRing->typ[0].data.syz.limit) // ?
     5115    {
     5116#ifndef NDEBUG
     5117      Warn("rSetSyzComp called with smaller limit (%d) as before (%d)", k, currRing->typ[0].data.syz.limit);
     5118#endif
     5119      currRing->typ[0].data.syz.curr_index = 1 + currRing->typ[0].data.syz.syz_index[k];
     5120    }
     5121
     5122
    49955123    currRing->typ[0].data.syz.limit = k;
    49965124    currRing->typ[0].data.syz.curr_index++;
Note: See TracChangeset for help on using the changeset viewer.