Changeset 724361 in git


Ignore:
Timestamp:
Aug 30, 2018, 1:29:14 PM (5 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', 'a719bcf0b8dbc648b128303a49777a094b57592c')
Children:
cfce45f606f08b61ca799377f748c37069f669bf
Parents:
a0f2b6b7a8139ad5ce4fb16d58135c9558ba191a46db0814d770d7de29357aac459e015a60f8df24
Message:
Merge branch 'spielwiese' into letterplace_kernel_multiplication
Files:
2 added
18 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/freegb.lib

    r46db08 r724361  
    1 /////////////////////////////////////////////////////////////////////////////
    21/////////////////////////////////////////////////////////////////////////////
    32version="version freegb.lib 4.1.1.0 Dec_2017 "; // $Id$
     
    9291    ERROR("uptodeg and lV do not agree on the basering!");
    9392  }
    94   // a kind of dirty hack
    95   list L = ringlist(R);
    96   attrib(L,"maxExp",1);
    97   def @R = ring(L);
    98     // Set letterplace-specific attributes for the output ring!
     93
     94  // Set letterplace-specific attributes for the output ring!
     95  // a kind of dirty hack, getting the ringlist again
     96  list RL = ringlist(R);
     97  attrib(RL, "isLetterplaceRing", lV);
     98  attrib(RL, "maxExp", 1);
     99  def @R = ring(RL);
     100
    99101  attrib(@R, "uptodeg", uptodeg);
    100102  attrib(@R, "isLetterplaceRing", lV);
     
    500502  // assumes of the ring have been checked
    501503  // run the computation - it will test assumes on the ideal
    502   int uptodeg = attrib(save,"uptodeg");
    503   int lV = attrib(save,"isLetterplaceRing");
    504504  dbprint(ppl,"start computing GB");
    505   def J = system("freegb",I,uptodeg,lV);
     505  def J = system("freegb",I);
    506506  dbprint(ppl,"finished computing GB");
    507507  dbprint(ppl-1,"the result is:");
     
    25252525    ERROR("Incomplete Letterplace structure on the basering!");
    25262526  }
    2527   int uptodeg = attrib(basering,"uptodeg");
    2528   int lV = attrib(basering,"isLetterplaceRing");
    2529   return(system("stest",a,i,uptodeg,lV));
     2527  return(system("stest",a,i));
    25302528}
    25312529example
  • Singular/LIB/primdec.lib

    ra0f2b6 r724361  
    18981898    if (typeof(rl[1])=="list")
    18991899    {
     1900      if(size(rl[1])==4)
     1901      {
    19001902        list rl1=rl[1];
    19011903        list rl2=rl[2];
     
    19071909        rl[2]=list(rl2[1..nnp]);
    19081910        rl[3]=list(list(order,1:nnp),list("C",0));
     1911      }
     1912      else /*Float(..), Complex(..) */
     1913      {
     1914        list p=rl[1];
     1915        list rl2=rl[2];
     1916        rl[1]=list(p,
     1917            list(rl2[nnp+1..nvars(basering)]),
     1918            list(list("lp",1:(nvars(basering)-nnp))),
     1919            ideal(0));
     1920        rl[2]=list(rl2[1..nnp]);
     1921        rl[3]=list(list(order,1:nnp),list("C",0));
     1922      }
    19091923    }
    19101924    else
  • Singular/extra.cc

    r46db08 r724361  
    11641164    if (strcmp(sys_cmd, "stest") == 0)
    11651165    {
    1166       const short t[]={4,POLY_CMD,INT_CMD,INT_CMD,INT_CMD};
     1166      const short t[]={2,POLY_CMD,INT_CMD};
    11671167      if (iiCheckTypes(h,t,1))
    11681168      {
     
    11701170        h=h->next;
    11711171        int sh=(int)((long)(h->Data()));
    1172         h=h->next;
    1173         int uptodeg=(int)((long)(h->Data()));
    1174         h=h->next;
    1175         int lVblock=(int)((long)(h->Data()));
    11761172        if (sh<0)
    11771173        {
     
    11791175          return TRUE;
    11801176        }
    1181         int L = pLastVblock(p,lVblock);
    1182         if (L+sh > uptodeg)
     1177        int L = pLastVblock(p);
     1178        if (L+sh > currRing->N/currRing->isLPring)
    11831179        {
    11841180          WerrorS("pLPshift: too big shift requested\n");
    11851181          return TRUE;
    11861182        }
    1187         res->data = p_LPshift(p,sh,uptodeg,lVblock,currRing);
     1183        res->data = p_LPshift(p,sh,currRing);
    11881184        res->rtyp = POLY_CMD;
    11891185        return FALSE;
     
    11971193    if (strcmp(sys_cmd, "btest") == 0)
    11981194    {
    1199       const short t[]={2,POLY_CMD,INT_CMD};
     1195      const short t[]={1,POLY_CMD};
    12001196      if (iiCheckTypes(h,t,1))
    12011197      {
    12021198        poly p=(poly)h->CopyD();
    1203         h=h->next;
    1204         int lV=(int)((long)(h->Data()));
    12051199        res->rtyp = INT_CMD;
    1206         res->data = (void*)(long)pLastVblock(p, lV);
    1207         return FALSE;
    1208       }
    1209       else return TRUE;
    1210     }
    1211     else
    1212   #endif
    1213   /*==================== shrink-test for freeGB  =================*/
    1214   #ifdef HAVE_SHIFTBBA
    1215     if (strcmp(sys_cmd, "shrinktest") == 0)
    1216     {
    1217       const short t[]={2,POLY_CMD,INT_CMD};
    1218       if (iiCheckTypes(h,t,1))
    1219       {
    1220         poly p=(poly)h->Data();
    1221         h=h->next;
    1222         int lV=(int)((long)(h->Data()));
    1223         res->rtyp = POLY_CMD;
    1224         //        res->data = p_mShrink(p, lV, currRing);
    1225         //        kStrategy strat=new skStrategy;
    1226         //        strat->tailRing = currRing;
    1227         res->data = p_Shrink(p, lV, currRing);
     1200        res->data = (void*)(long)pLastVblock(p);
    12281201        return FALSE;
    12291202      }
     
    15041477    if (strcmp(sys_cmd, "freegb") == 0)
    15051478    {
    1506       const short t[]={3,IDEAL_CMD,INT_CMD,INT_CMD};
    1507       const short tM[]={3,MODUL_CMD,INT_CMD,INT_CMD};
     1479      const short t[]={1,IDEAL_CMD};
     1480      const short tM[]={1,MODUL_CMD};
    15081481      if (iiCheckTypes(h,tM,0)
    15091482      || (iiCheckTypes(h,t,0)))
     
    15111484        res->rtyp=h->Typ();
    15121485        ideal I=(ideal)h->CopyD();
    1513         h=h->next;
    1514         int uptodeg=(int)((long)(h->Data()));
    1515         h=h->next;
    1516         int lVblock=(int)((long)(h->Data()));
    1517         res->data = freegb(I,uptodeg,lVblock);
     1486        res->data = freegb(I);
    15181487        if (res->data == NULL)
    15191488        {
     
    15251494      else
    15261495      {
    1527         WerrorS("system(\"freegb\",`ideal/module`,`int`,`int`) expected");
     1496        WerrorS("system(\"freegb\",`ideal/module`) expected");
    15281497        return TRUE;
    15291498      }
  • Singular/ipshell.cc

    ra0f2b6 r724361  
    22732273    R->cf = nInitChar(n_long_C, NULL);
    22742274  else if ((r1<=SHORT_REAL_LENGTH)
    2275   && (r2=SHORT_REAL_LENGTH))
     2275  && (r2<=SHORT_REAL_LENGTH))
    22762276    R->cf = nInitChar(n_R, NULL);
    22772277  else
     
    22802280    p->float_len=r1;
    22812281    p->float_len2=r2;
    2282     R->cf = nInitChar(n_long_R, NULL);
     2282    R->cf = nInitChar(n_long_R, p);
    22832283  }
    22842284
    22852285  if ((r1<=SHORT_REAL_LENGTH)   // should go into nInitChar
    2286   && (r2=SHORT_REAL_LENGTH))
     2286  && (r2<=SHORT_REAL_LENGTH))
    22872287  {
    22882288    R->cf->float_len=SHORT_REAL_LENGTH/2;
     
    24772477      else
    24782478      {
    2479         Werror("var name %d must be `string`",i+1);
     2479        Werror("var name %d must be `string` (not %d)",i+1, v->m[i].Typ());
    24802480        return TRUE;
    24812481      }
  • kernel/GBEngine/kInline.h

    r46db08 r724361  
    3131#include "kernel/polys.h"
    3232
     33#include "kernel/GBEngine/shiftgb.h"
    3334
    3435#define HAVE_TAIL_BIN
  • kernel/GBEngine/kspoly.cc

    ra0f2b6 r724361  
    6060  int ret = 0;
    6161  ring tailRing = PR->tailRing;
    62   kTest_L(PR);
     62  kTest_L(PR,tailRing);
    6363  kTest_T(PW);
    6464
     
    189189  int ret = 0;
    190190  ring tailRing = PR->tailRing;
    191   kTest_L(PR);
     191  kTest_L(PR,tailRing);
    192192  kTest_T(PW);
    193193
     
    333333  int ret = 0;
    334334  ring tailRing = PR->tailRing;
    335   kTest_L(PR);
     335  kTest_L(PR,tailRing);
    336336  kTest_T(PW);
    337337
     
    466466  int ret = 0;
    467467  ring tailRing = PR->tailRing;
    468   kTest_L(PR);
     468  kTest_L(PR,tailRing);
    469469  kTest_T(PW);
    470470
     
    660660  int ret = 0;
    661661  ring tailRing = PR->tailRing;
    662   kTest_L(PR);
     662  kTest_L(PR,tailRing);
    663663  kTest_T(PW);
    664664
     
    897897  create_count++;
    898898#endif
    899   kTest_L(Pair);
     899  kTest_L(Pair,tailRing);
    900900  poly p1 = Pair->p1;
    901901  poly p2 = Pair->p2;
     
    10311031  poly Save =   PW->GetLmCurrRing();
    10321032
    1033   kTest_L(PR);
     1033  kTest_L(PR,PR->tailRing);
    10341034  kTest_T(PW);
    10351035  pAssume(pIsMonomOf(Lp, Current));
     
    10731073  poly Save =   PW->GetLmCurrRing();
    10741074
    1075   kTest_L(PR);
     1075  kTest_L(PR,PR->tailRing);
    10761076  kTest_T(PW);
    10771077  pAssume(pIsMonomOf(Lp, Current));
  • kernel/GBEngine/kstd1.cc

    r46db08 r724361  
    25652565#ifdef HAVE_SHIFTBBA
    25662566ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
    2567                 int newIdeal, intvec *vw, int uptodeg, int lV)
     2567                int newIdeal, intvec *vw)
    25682568{
    25692569  ideal r;
     
    25972597  if (h==testHomog)
    25982598  {
    2599     if (delete_w)
    2600     {
    2601       temp_w=new intvec((strat->ak)+1);
    2602       w = &temp_w;
    2603     }
    26042599    if (strat->ak == 0)
    26052600    {
     
    26462641    /* global ordering */
    26472642    if (w!=NULL)
    2648       r=bbaShift(F,Q,*w,hilb,strat,uptodeg,lV);
     2643      r=bbaShift(F,Q,*w,hilb,strat);
    26492644    else
    2650       r=bbaShift(F,Q,NULL,hilb,strat,uptodeg,lV);
     2645      r=bbaShift(F,Q,NULL,hilb,strat);
    26512646  }
    26522647#ifdef KDEBUG
  • kernel/GBEngine/kstd1.h

    r46db08 r724361  
    4040
    4141ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
    42                 int newIdeal, intvec *vw, int uptodeg, int lVblock);
     42                int newIdeal, intvec *vw);
    4343
    4444/* the following global data are defined in kutil.cc */
  • kernel/GBEngine/kstd2.cc

    ra0f2b6 r724361  
    14391439  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
    14401440  //L->Normalize(); // HANNES: should have a test
    1441   kTest_L(L);
     1441  kTest_L(L,strat->tailRing);
    14421442  return L->GetLmCurrRing();
    14431443}
  • kernel/GBEngine/kstdfac.cc

    r46db08 r724361  
    229229  s->noetherSet=o->noetherSet;
    230230#ifdef HAVE_SHIFTBBA
    231   s->lV=o->lV;
     231  s->cv=o->cv;
    232232#endif
    233233#ifdef HAVE_PLURAL
  • kernel/GBEngine/kutil.cc

    ra0f2b6 r724361  
    244244  if (strat->kHEdgeFound)
    245245  {
    246     kTest_L(L);
     246    kTest_L(L,strat->tailRing);
    247247    poly p1;
    248248    poly p = L->GetLmTailRing();
     
    311311        kBucketDestroy(&bucket);
    312312    }
    313     kTest_L(L);
     313    kTest_L(L,strat->tailRing);
    314314  }
    315315}
     
    75507550  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
    75517551  //L->Normalize(); // HANNES: should have a test
    7552   kTest_L(L);
     7552  kTest_L(L,strat->tailRing);
    75537553  return L->GetLmCurrRing();
    75547554}
     
    76657665  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
    76667666  //L->Normalize(); // HANNES: should have a test
    7667   kTest_L(L);
     7667  kTest_L(L,strat->tailRing);
    76687668  return L->GetLmCurrRing();
    76697669}
     
    77807780  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
    77817781  //L->Normalize(); // HANNES: should have a test
    7782   kTest_L(L);
     7782  kTest_L(L,strat->tailRing);
    77837783  return L->GetLmCurrRing();
    77847784}
     
    1267712677  }
    1267812678  L->Normalize(); // HANNES: should have a test
    12679   kTest_L(L);
     12679  kTest_L(L,strat->tailRing);
    1268012680  return L->GetLmCurrRing();
    1268112681}
  • kernel/GBEngine/kutil.h

    ra0f2b6 r724361  
    640640BOOLEAN kTest_TS(kStrategy strat);
    641641// test LObject
    642 BOOLEAN kTest_L(LObject* L, ring tailRing = NULL,
     642BOOLEAN kTest_L(LObject* L, ring tailRing,
    643643                 BOOLEAN testp = FALSE, int lpos = -1,
    644644                 TSet T = NULL, int tlength = -1);
     
    652652#define kTest_T(T)      (TRUE)
    653653#define kTest_S(T)      (TRUE)
    654 #define kTest_L(T    (TRUE)
     654#define kTest_L(T,R)    (TRUE)
    655655#endif
    656656
  • kernel/GBEngine/shiftgb.cc

    r46db08 r724361  
    3535#define freeT(A,v) omFreeSize((ADDRESS)A,(v+1)*sizeof(int))
    3636
    37 
    38 /* TODO: write p* stuff as instances of p_* for all the functions */
    39 /* p_* functions are new, p* are old */
    40 
    41 poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
     37poly p_LPshiftT(poly p, int sh, kStrategy strat, const ring r)
    4238{
    4339  /* assume shift takes place, shifts the poly p by sh */
     
    5551
    5652  poly q   = NULL;
    57   poly s   = p_mLPshift(p_Head(p,r), sh, uptodeg, lV, r); // lm in currRing
     53  poly s   = p_mLPshift(p_Head(p,r), sh, r); // lm in currRing
    5854  /* pNext(s) will be fixed below */
    5955  poly pp = pNext(p);
     
    6157  while (pp != NULL)
    6258  {
    63     poly h=p_mLPshift(p_Head(pp,strat->tailRing),sh,uptodeg,lV,strat->tailRing);
     59    poly h=p_mLPshift(p_Head(pp,strat->tailRing),sh,strat->tailRing);
    6460    pIter(pp);
    6561
     
    7167}
    7268
    73 poly p_LPshift(poly p, int sh, int uptodeg, int lV, const ring r)
     69poly p_LPshift(poly p, int sh, const ring r)
    7470{
    7571  /* assume shift takes place */
     
    7773
    7874  /* assume sh and uptodeg agree TODO check */
    79   assume(sh>=0);
    8075
    8176  if (sh == 0) return(p); /* the zero shift */
     
    8883    pIter(pp);
    8984    pNext(h)=NULL;
    90     h=p_mLPshift(h,sh,uptodeg,lV,r);
     85    h=p_mLPshift(h,sh,r);
    9186    q = p_Add_q(q, h,r);
    9287  }
     
    9489}
    9590
    96 poly p_mLPshift(poly p, int sh, int uptodeg, int lV, const ring r)
     91poly p_mLPshift(poly p, int sh, const ring r)
    9792{
    9893  /* p is a monomial from the ring r */
    9994
    100   if (sh == 0) return(p); /* the zero shift */
    101 
    102   assume(sh>=0);
    103   int L = p_mLastVblock(p,lV,r);
    104   assume(L+sh<=uptodeg);
     95  int lV = r->isLPring;
     96
     97  if (sh == 0 || p == NULL || p_LmIsConstantComp(p,r)) return(p);
     98
     99  int L = p_mLastVblock(p,r);
     100  assume(L+sh>=1);
     101  assume(L+sh<=r->N/lV);
    105102
    106103  int *e=(int *)omAlloc0((r->N+1)*sizeof(int));
     
    117114    {
    118115      assume(j + (sh*lV)<=r->N);
     116      assume(j + (sh*lV)>=1);
    119117      s[j + (sh*lV)] = e[j]; /* actually 1 */
    120118    }
     
    130128}
    131129
    132 int p_LastVblockT(poly p, int lV, kStrategy strat, const ring r)
    133 {
    134   /* returns the number of maximal block */
    135   /* appearing among the monomials of p */
    136   /* the 0th block is the 1st one */
    137 
    138   /* p is like TObject: lm in currRing = r, tail in tailRing  */
    139   assume(p_LmCheckIsFromRing(p,r));
    140   assume(p_CheckIsFromRing(pNext(p),strat->tailRing));
    141 
    142   int ans = p_mLastVblock(p, lV, r); // Block of LM
    143   poly q = pNext(p);
    144   int ansnew = 0;
    145   while (q != NULL)
    146   {
    147     ansnew = p_mLastVblock(q, lV, strat->tailRing);
    148     ans       = si_max(ans,ansnew);
    149     pIter(q);
    150   }
    151   /* do not need to delete q */
    152   return(ans);
    153 }
    154 
    155 int p_LastVblock(poly p, int lV, const ring r)
    156 {
    157   /* returns the number of maximal block */
    158   /* appearing among the monomials of p */
    159   /* the 0th block is the 1st one */
     130/* returns the number of maximal block */
     131/* appearing among the monomials of p */
     132/* the 0th block is the 1st one */
     133int p_LastVblock(poly p, const ring r)
     134{
    160135  poly q = p;
    161136  int ans = 0;
    162   int ansnew = 0;
    163137  while (q!=NULL)
    164138  {
    165     ansnew = p_mLastVblock(q, lV, r);
     139    int ansnew = p_mLastVblock(q, r);
    166140    ans    = si_max(ans,ansnew);
    167141    pIter(q);
     
    170144}
    171145
    172 int p_mLastVblock(poly p, int lV, const ring r)
    173 {
    174   /* for a monomial p, returns the number of the last block */
    175   /* where a nonzero exponent is sitting */
    176   if (p_LmIsConstant(p,r))
     146/* for a monomial p, returns the number of the last block */
     147/* where a nonzero exponent is sitting */
     148int p_mLastVblock(poly p, const ring r)
     149{
     150  if (p == NULL || p_LmIsConstantComp(p,r))
    177151  {
    178152    return(0);
    179153  }
     154
     155  int lV = r->isLPring;
    180156  int *e=(int *)omAlloc0((r->N+1)*sizeof(int));
    181157  p_GetExpV(p,e,r);
     
    189165}
    190166
    191 int pFirstVblock(poly p, int lV)
    192 {
    193   /* returns the number of maximal block */
    194   /* appearing among the monomials of p */
    195   /* the 0th block is the 1st one */
    196   poly q = p; //p_Copy(p,currRing); /* need it ? */
    197   int ans = 0;
    198   int ansnew = 0;
     167/* returns the number of maximal block */
     168/* appearing among the monomials of p */
     169/* the 0th block is the 1st one */
     170int p_FirstVblock(poly p, const ring r)
     171{
     172  if (p == NULL) {
     173    return 0;
     174  }
     175
     176  poly q = p;
     177  int ans = p_mFirstVblock(q, r);
    199178  while (q!=NULL)
    200179  {
    201     ansnew = pmFirstVblock(q,lV);
    202     ans    = si_min(ans,ansnew);
     180    int ansnew = p_mFirstVblock(q, r);
     181    if (ansnew > 0) { // don't count constants
     182      ans = si_min(ans,ansnew);
     183    }
    203184    pIter(q);
    204185  }
     
    207188}
    208189
    209 int pmFirstVblock(poly p, int lV)
    210 {
    211   if (pIsConstantPoly(p))
    212   {
    213     return(int(0));
    214   }
    215   /* for a monomial p, returns the number of the first block */
    216   /* where a nonzero exponent is sitting */
    217   int *e=(int *)omAlloc0((currRing->N+1)*sizeof(int));
    218   p_GetExpV(p,e,currRing);
     190/* for a monomial p, returns the number of the first block */
     191/* where a nonzero exponent is sitting */
     192int p_mFirstVblock(poly p, const ring r)
     193{
     194  if (p == NULL || p_LmIsConstantComp(p,r))
     195  {
     196    return(0);
     197  }
     198
     199  int lV = r->isLPring;
     200  int *e=(int *)omAlloc0((r->N+1)*sizeof(int));
     201  p_GetExpV(p,e,r);
    219202  int j,b;
    220203  j = 1;
    221   while ( (!e[j]) && (j<=currRing->N-1) ) j++;
    222   if (j==currRing->N + 1)
    223   {
    224 #ifdef PDEBUG
    225     PrintS("pmFirstVblock: unexpected zero exponent vector\n");
    226 #endif
    227     return(j);
    228   }
    229   b = (int)(j/lV)+1; /* the number of the block, 1<= N <= currRing->N  */
     204  while ( (!e[j]) && (j<=r->N-1) ) j++;
     205  freeT(e, r->N);
     206  assume(j <= r->N);
     207  b = (int)(j+lV-1)/lV; /* the number of the block, 1<= b <= r->N  */
    230208  return (b);
    231209}
    232210
    233   /* there should be two routines: */
    234   /* 1. test place-squarefreeness: in homog this suffices: isInV */
    235   /* 2. test the presence of a hole -> in the tail??? */
    236 
    237 int isInV(poly p, int lV)
    238 {
     211/* there should be two routines: */
     212/* 1. test place-squarefreeness: in homog this suffices: isInV */
     213/* 2. test the presence of a hole -> in the tail??? */
     214
     215int isInV(poly p, const ring r)
     216{
     217  int lV = r->isLPring;
    239218  /* investigate only the leading monomial of p in currRing */
    240219  if ( pTotaldegree(p)==0 ) return(1);
    241   if (lV <= 0) return(0);
    242220  /* returns 1 iff p is in V */
    243221  /* that is in each block up to a certain one there is only one nonzero exponent */
     
    287265}
    288266
    289 int poly_isInV(poly p, int lV)
    290 {
    291   /* tests whether the whole polynomial p in in V */
     267/* tests whether the whole polynomial p in in V */
     268int poly_isInV(poly p, const ring r)
     269{
    292270  poly q = p;
    293271  while (q!=NULL)
    294272  {
    295     if ( !isInV(q,lV) )
     273    if ( !isInV(q, r) )
    296274    {
    297275      return(0);
     
    302280}
    303281
    304 int ideal_isInV(ideal I, int lV)
    305 {
    306   /* tests whether each polynomial of an ideal I lies in in V */
     282/* tests whether each polynomial of an ideal I lies in in V */
     283int ideal_isInV(ideal I, const ring r)
     284{
    307285  int i;
    308286  int s    = IDELEMS(I)-1;
    309287  for(i = 0; i <= s; i++)
    310288  {
    311     if ( !poly_isInV(I->m[i],lV) )
     289    if ( !poly_isInV(I->m[i], r) )
    312290    {
    313291      return(0);
     
    318296
    319297
    320 int itoInsert(poly p, int uptodeg, int lV, const ring r)
    321 {
    322   /* for poly in lmCR/tailTR presentation */
     298/* for poly in lmCR/tailTR presentation */
     299int itoInsert(poly p, const ring r)
     300{
    323301  /* the below situation (commented out) might happen! */
    324302//   if (r == currRing)
     
    328306//   }
    329307  /* compute the number of insertions */
    330   int i = p_mLastVblock(p, lV, currRing);
     308  int i = p_mLastVblock(p, currRing);
    331309  if (pNext(p) != NULL)
    332310  {
    333     i = si_max(i, p_LastVblock(pNext(p), lV, r) );
     311    i = si_max(i, p_LastVblock(pNext(p), r) );
    334312  }
    335313  //  i = uptodeg  - i +1;
    336   i = uptodeg  - i;
     314  int uptodeg = r->N/r->isLPring;
    337315  //  p_wrp(p,currRing,r); Print("----i:%d",i); PrintLn();
    338   return(i);
    339 }
    340 
    341 poly p_ShrinkT(poly p, int lV, kStrategy strat, const ring r)
    342 //poly p_Shrink(poly p, int uptodeg, int lV, kStrategy strat, const ring r)
    343 {
    344   /* p is like TObject: lm in currRing = r, tail in tailRing  */
    345   /* proc shrinks the poly p in ring r */
    346   /* lV = the length of V = the number of orig vars */
    347   /* check assumes/exceptions */
    348   /* r->N is a multiple of lV */
    349 
    350   if (p==NULL) return(p);
    351 
    352   assume(p_LmCheckIsFromRing(p,r));
    353   assume(p_CheckIsFromRing(pNext(p),strat->tailRing));
    354 
    355   poly q   = NULL;
    356   poly s   = p_mShrink(p, lV, r); // lm in currRing
    357   poly pp = pNext(p);
    358 
    359   while (pp != NULL)
    360   {
    361     //    q = p_Add_q(q, p_mShrink(pp,uptodeg,lV,strat->tailRing),strat->tailRing);
    362     q = p_Add_q(q, p_mShrink(pp,lV,strat->tailRing),strat->tailRing);
    363     pIter(pp);
    364   }
    365   pNext(s) = q;
    366   return(s);
    367 }
    368 
    369 poly p_Shrink(poly p, int lV, const ring r)
    370 {
    371   /* proc shrinks the poly p in ring r */
    372   /* lV = the length of V = the number of orig vars */
    373   /* check assumes/exceptions */
    374   /* r->N is a multiple of lV */
    375 
    376   if (p==NULL) return(p);
    377   assume(p_CheckIsFromRing(p,r));
    378   poly q = NULL;
    379   poly pp = p;
    380 
    381   while (pp != NULL)
    382   {
    383     q = p_Add_q(q, p_mShrink(pp,lV,r),r);
    384     pIter(pp);
    385   }
    386   return(q);
    387 }
    388 
    389 poly p_mShrink(poly p, int lV, const ring r)
    390 {
    391   /* shrinks the monomial p in ring r */
    392   /* lV = the length of V = the number of orig vars */
    393 
    394   /* check assumes/exceptions */
    395   /* r->N is a multiple of lV */
    396 
    397   int *e = (int *)omAlloc0((r->N+1)*sizeof(int));
    398   int  b = (int)((r->N +lV-1)/lV); /* the number of blocks */
    399   //  int *B = (int *)omAlloc0((b+1)*sizeof(int)); /* the num of elements in a block */
    400   int *S = (int *)omAlloc0((r->N+1)*sizeof(int)); /* the shrinked exponent */
    401   p_GetExpV(p,e,r);
    402   int i,j; int cnt = 1; //counter for blocks in S
    403   for (j=1; j<=b; j++)
    404   {
    405     /* we go through all the vars */
    406     /* by blocks in lV vars */
    407     for (i=(j-1)*lV + 1; i<= j*lV; i++)
    408     {
    409       if (e[i]==1)
    410       {
    411          //      B[j] = B[j]+1; // for control in V?
    412          S[(cnt-1)*lV + (i - (j-1)*lV)] = e[i];
    413          /* assuming we are in V, can interrupt here */
    414          cnt++;
    415          //  break; //results in incomplete shrink!
    416          i = j*lV; // manual break under assumption p is in V
    417       }
    418     }
    419   }
    420 #ifdef PDEBUG
    421   //  Print("p_mShrink: cnt = [%d], b = %d\n",cnt,b);
     316  return uptodeg - i;
     317}
     318
     319// splits a frame (e.g. x(1)*y(5)) m1 into m1 and m2 (e.g. m1=x(1) and m2=y(1))
     320// according to p which is inside the frame
     321void k_SplitFrame(poly &m1, poly &m2, int at, const ring r) {
     322  int lV = r->isLPring;
     323
     324  number m1Coeff = pGetCoeff(m1);
     325
     326  int hole = lV * at;
     327  m2 = p_GetExp_k_n(m1, 1, hole, r);
     328  m1 = p_GetExp_k_n(m1, hole, r->N, r);
     329
     330  p_LPshift(m2, 1 - p_mFirstVblock(m2, r), r);
     331  p_SetCoeff(m1, m1Coeff, r);
     332}
     333
    422334#endif
    423   // cnt -1 <= b  must hold!
    424   //  freeT(B, b);
    425   poly s = p_One(r);
    426   p_SetExpV(s,S,r);
    427   freeT(e, r->N);
    428   freeT(S, r->N);
    429   /*  p_Setm(s,r); // done by p_SetExpV */
    430   p_SetComp(s,p_GetComp(p,r),r); // component is preserved
    431   p_SetCoeff(s,n_Copy(p_GetCoeff(p,r),r->cf),r);  // coeff is preserved
    432 #ifdef PDEBUG
    433   //  Print("p_mShrink: from "); p_wrp(p,r); Print(" to "); p_wrp(s,r); PrintLn();
    434 #endif
    435   return(s);
    436 }
    437 
    438 /* shiftgb stuff */
    439 
    440 
    441 /*2
    442  *if the leading term of p
    443  *divides the leading term of some T[i] it will be canceled
    444  */
    445 // static inline void clearSShift (poly p, unsigned long p_sev,int l, int* at, int* k,
    446 //                            kStrategy strat)
    447 // {
    448 //   assume(p_sev == pGetShortExpVector(p));
    449 //   if (!pLmShortDivisibleBy(p,p_sev, strat->T[*at].p, ~ strat->sevT[*at])) return;
    450 //   //  if (l>=strat->lenS[*at]) return;
    451 //   if (TEST_OPT_PROT)
    452 //     PrintS("!");
    453 //   mflush();
    454 //   //pDelete(&strat->S[*at]);
    455 //   deleteInS((*at),strat);
    456 //   (*at)--;
    457 //   (*k)--;
    458 // //  assume(lenS_correct(strat));
    459 // }
    460 
    461 /* remarks: cleanT : just deletion
    462 enlargeT: just reallocation */
    463 
    464 #endif
  • kernel/GBEngine/shiftgb.h

    r46db08 r724361  
    1212#include "polys/nc/nc.h"
    1313
    14 poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r);
    15 int p_LastVblockT(poly p, int lV, kStrategy strat, const ring r);
     14poly p_LPshiftT(poly p, int sh, kStrategy strat, const ring r);
    1615
    17 poly p_ShrinkT(poly p, int lV, kStrategy strat, const ring r);
    18 poly p_Shrink(poly p, int lV, const ring r);
    19 poly p_mShrink(poly p, int lV, const ring r);
    20 //poly p_Shrink(poly p, int uptodeg, int lV, kStrategy strat, const ring r);
    21 //poly p_mShrink(poly p, int uptodeg, int lV, const ring r);
     16poly p_LPshift(poly p, int sh, const ring r);
     17poly p_mLPshift(poly p, int sh, const ring r);
    2218
    23 poly p_LPshift(poly p, int sh, int uptodeg, int lV,const ring r);
    24 poly p_mLPshift(poly p, int sh, int uptodeg, int lV,const ring r);
     19int p_mLastVblock(poly p, const ring r);
     20int p_LastVblock(poly p, const ring r);
    2521
    26 int p_mLastVblock(poly p, int lV,const ring r);
    27 int p_LastVblock(poly p, int lV, const ring r);
     22#define pLastVblock(p) p_LastVblock(p,currRing)
     23#define pmLastVblock(p) p_mLastVblock(p,currRing)
    2824
    29 //int pLastVblock(poly p, int lV);
    30 #define pLastVblock(p,lV) p_LastVblock(p,lV,currRing)
    31 //int pmLastVblock(poly p, int lV);
    32 #define pmLastVblock(p,lV) p_mLastVblock(p,lV,currRing)
     25int p_FirstVblock(poly p, const ring r);
     26int p_mFirstVblock(poly p, const ring r);
    3327
    34 int pFirstVblock(poly p, int lV);
    35 int pmFirstVblock(poly p, int lV);
     28#define pFirstVblock(p) p_FirstVblock(p,currRing)
     29#define pmFirstVblock(p) p_mFirstVblock(p,currRing)
    3630
    37 int isInV(poly p, int lV);
    38 int poly_isInV(poly p, int lV);
    39 int ideal_isInV(ideal I, int lV);
     31int isInV(poly p, const ring r);
     32int poly_isInV(poly p, const ring r);
     33int ideal_isInV(ideal I, const ring r);
    4034
    41 int itoInsert(poly p, int uptodeg, int lV, const ring r);
     35int itoInsert(poly p, const ring r);
    4236
     37void k_SplitFrame(poly &m1, poly &m2, int at, const ring r);
    4338#endif
    4439#endif
  • libpolys/coeffs/longrat.cc

    r46db08 r724361  
    16381638#endif
    16391639    }
    1640     #ifdef LDEBUG
     1640#ifdef LDEBUG
    16411641    memset(*a,0,sizeof(**a));
    1642     #endif
     1642#endif
    16431643    FREE_RNUMBER(*a); // omFreeBin((void *) *a, rnumber_bin);
    16441644  }
  • libpolys/polys/Makefile.am

    r46db08 r724361  
    3535        kbuckets.cc sbuckets.cc weight.cc weight0.c simpleideals.cc matpol.cc \
    3636        sparsmat.cc \
     37        shiftop.cc \
    3738        ${USE_P_PROCS_STATIC_CC} ${USE_P_PROCS_DYNAMIC_CC} mod_raw.cc \
    3839        ext_fields/algext.cc ext_fields/transext.cc \
     
    4748        kbuckets.h sbuckets.h simpleideals.h weight.h matpol.h \
    4849        sparsmat.h clapsing.h clapconv.h coeffrings.h flintconv.h\
     50        shiftop.h \
    4951        ext_fields/algext.h ext_fields/transext.h mod_raw.h
    5052
  • libpolys/polys/kbuckets.cc

    r46db08 r724361  
    738738  {
    739739    pSetCoeff0(m, n_InpNeg(pGetCoeff(m),r->cf));
    740     p1=pp_Mult_mm(p,m,r);
     740    p1=r->p_Procs->pp_mm_Mult(p,m,r);
    741741    pSetCoeff0(m, n_InpNeg(pGetCoeff(m),r->cf));
    742742    l1=pLength(p1);
     
    780780      else
    781781      {
    782         p1 = r->p_Procs->pp_Mult_mm(p1, m, r);
     782        p1 = r->p_Procs->pp_mm_Mult(p1, m, r);
    783783      }
    784784      pSetCoeff0(m, n_InpNeg(pGetCoeff(m),r->cf));
  • libpolys/polys/templates/p_Procs_Set.h

    r46db08 r724361  
    1616#include "reporter/reporter.h"
    1717#include "misc/auxiliary.h"
     18#include "shiftop.h"
    1819
    1920// extract p_Procs properties from a ring
     
    165166  }
    166167  #endif
    167   _p_procs->p_mm_Mult=_p_procs->p_Mult_mm;
    168   _p_procs->pp_mm_Mult=_p_procs->pp_Mult_mm;
     168  if (r->isLPring) {
     169    _p_procs->pp_Mult_mm = shift_pp_Mult_mm;
     170    _p_procs->p_Mult_mm = shift_p_Mult_mm;
     171    _p_procs->p_mm_Mult = shift_p_mm_Mult;
     172    _p_procs->pp_mm_Mult = shift_pp_mm_Mult;
     173    _p_procs->p_Minus_mm_Mult_qq = shift_p_Minus_mm_Mult_qq;
     174    // Unsupported
     175    _p_procs->pp_Mult_mm_Noether = shift_pp_Mult_mm_Noether_STUB;
     176    _p_procs->pp_Mult_Coeff_mm_DivSelect = shift_pp_Mult_Coeff_mm_DivSelect_STUB;
     177    _p_procs->pp_Mult_Coeff_mm_DivSelectMult = shift_pp_Mult_Coeff_mm_DivSelectMult_STUB;
     178  } else {
     179    _p_procs->p_mm_Mult=_p_procs->p_Mult_mm;
     180    _p_procs->pp_mm_Mult=_p_procs->pp_Mult_mm;
     181  }
    169182  CheckProc(p_Copy);
    170183  CheckProc(p_Delete);
Note: See TracChangeset for help on using the changeset viewer.