Ticket #13731: singular_15435.patch

File singular_15435.patch, 3.7 KB (added by SimonKing, 7 years ago)

Backporting Singular changeset 15435

  • kernel/ring.h

    diff --git a/kernel/ring.h b/kernel/ring.h
    a b  
    409409#define rHasLocalOrMixedOrdering(R) ((R)->OrdSgn==-1)
    410410#define rHasLocalOrMixedOrdering_currRing() (pOrdSgn==-1)
    411 BOOLEAN rOrd_is_Totaldegree_Ordering(ring r =currRing);
     411BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r =currRing);
    412412
    413413/// return TRUE if p_SetComp requires p_Setm
    414 BOOLEAN rOrd_SetCompRequiresSetm(ring r);
    415 rOrderType_t    rGetOrderType(ring r);
     414BOOLEAN rOrd_SetCompRequiresSetm(const ring r);
     415rOrderType_t    rGetOrderType(const ring r);
    416416
    417417/// returns TRUE if var(i) belongs to p-block
    418 BOOLEAN rIsPolyVar(int i, ring r = currRing);
    419 
    420 static inline BOOLEAN rOrd_is_Comp_dp(ring r)
     418BOOLEAN rIsPolyVar(int i, const ring r = currRing);
     419
     420static inline BOOLEAN rOrd_is_Comp_dp(const ring r)
    421421{
    422422  return ((r->order[0] == ringorder_c || r->order[0] == ringorder_C) &&
  • kernel/ring.cc

    diff --git a/kernel/ring.cc b/kernel/ring.cc
    a b  
    18991899}
    19001900
    1901 rOrderType_t rGetOrderType(ring r)
     1901rOrderType_t rGetOrderType(const ring r)
    19021902{
    19031903  // check for simple ordering
     
    20172017}
    20182018
    2019 BOOLEAN rHasSimpleOrderAA(ring r)
     2019BOOLEAN rHasSimpleOrderAA(const ring r)
    20202020{
    20212021  if (r->order[0] == ringorder_unspec) return TRUE;
     
    20482048
    20492049// return TRUE if p_SetComp requires p_Setm
    2050 BOOLEAN rOrd_SetCompRequiresSetm(ring r)
     2050BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
    20512051{
    20522052  if (r->typ != NULL)
     
    20622062}
    20632063
     2064BOOLEAN rHasModuleOrder(const ring r)
     2065{
     2066  int i=0;
     2067  loop
     2068  {
     2069    if ((r->order[i]==ringorder_c)
     2070    || (r->order[i]==ringorder_C))
     2071      return TRUE;
     2072    if (r->order[i]==0) return FALSE;
     2073    i++;
     2074  }
     2075  return FALSE; /*never reached */
     2076}
    20642077// return TRUE if p->exp[r->pOrdIndex] holds total degree of p */
    2065 BOOLEAN rOrd_is_Totaldegree_Ordering(ring r)
     2078BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r)
    20662079{
    20672080  // Hmm.... what about Syz orderings?
     
    20702083           (rOrder_is_DegOrdering((rRingOrder_t)r->order[0]) ||
    20712084            rOrder_is_DegOrdering(( rRingOrder_t)r->order[1]))) ||
    2072            (rHasSimpleOrderAA(r) &&
     2085           (rHasSimpleOrderAA(r) && rHasModuleOrder(r) &&
    20732086            (rOrder_is_DegOrdering((rRingOrder_t)r->order[1]) ||
    20742087             rOrder_is_DegOrdering((rRingOrder_t)r->order[2])))));
     
    20852098}
    20862099
    2087 BOOLEAN rIsPolyVar(int v, ring r)
     2100BOOLEAN rIsPolyVar(int v, const ring r)
    20882101{
    20892102  int  i=0;
  • kernel/gring.cc

    diff --git a/kernel/gring.cc b/kernel/gring.cc
    a b  
    3535#include <kernel/p_Mult_q.h>
    3636#include <kernel/pInline1.h>
    37 
    38 // dirty tricks:
    39 #include <kernel/p_MemAdd.h>
    4037
    4138#include <kernel/gring.h>
     
    461458}
    462459
    463 
    464 
    465460poly gnc_mm_Mult_nn(int *F0, int *G0, const ring r)
    466461/* destroys nothing, no coeffs and exps */
     
    470465  int iF,jG,iG;
    471466  int rN=r->N;
    472   int ExpSize=(((rN+1)*sizeof(int)+sizeof(long)-1)/sizeof(long))*sizeof(long);
    473467
    474468  int *F=(int *)omAlloc0((rN+1)*sizeof(int));
     
    479473  memcpy(G, G0,(rN+1)*sizeof(int));
    480474  //  pExpVectorCopy(G,G0);
    481   F[0]=0; /* important for p_MemAdd */
     475  F[0]=0;
    482476  G[0]=0;
    483477
     
    503497    /* i.e. no mixed exp_num , MERGE case */
    504498  {
    505     p_MemAdd_LengthGeneral(F, G, ExpSize/sizeof(long));
     499    { for(int ii=rN;ii>0;ii--) F[ii]+=G[ii]; }
    506500    p_SetExpV(out,F,r);
    507501    p_Setm(out,r);
    508     //    omFreeSize((ADDRESS)F,ExpSize);
    509502    freeT(F,rN);
    510503    freeT(G,rN);
     
    565558      cff=totcff;
    566559    }
    567     p_MemAdd_LengthGeneral(F, G, ExpSize/sizeof(long));
     560    { for(int ii=rN;ii>0;ii--) F[ii]+=G[ii]; }
    568561    p_SetExpV(out,F,r);
    569562    p_Setm(out,r);
    570563    p_SetCoeff(out,cff,r);
    571     //    p_MemAdd_NegWeightAdjust(p, r); ??? do we need this?
    572564    freeT(F,rN);
    573565    freeT(G,rN);