My Project
Macros | Functions
kInline.h File Reference
#include "omalloc/omalloc.h"
#include "misc/options.h"
#include "polys/monomials/p_polys.h"
#include "polys/kbuckets.h"
#include "kernel/polys.h"
#include "polys/shiftop.h"

Go to the source code of this file.

Macros

#define HAVE_TAIL_BIN
 

Functions

KINLINE TSet initT ()
 
KINLINE TObject ** initR ()
 
KINLINE unsigned long * initsevT ()
 
KINLINE poly k_LmInit_currRing_2_tailRing (poly p, ring tailRing, omBin tailBin)
 
KINLINE poly k_LmInit_tailRing_2_currRing (poly t_p, ring tailRing, omBin lmBin)
 
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing (poly p, ring tailRing, omBin tailBin)
 
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing (poly p, ring tailRing, omBin lmBin)
 
KINLINE poly k_LmInit_currRing_2_tailRing (poly p, ring tailRing)
 
KINLINE poly k_LmInit_tailRing_2_currRing (poly p, ring tailRing)
 
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing (poly p, ring tailRing)
 
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing (poly p, ring tailRing)
 
KINLINE BOOLEAN k_GetLeadTerms (const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
 
KINLINE void k_GetStrongLeadTerms (const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
 
KINLINE int ksReducePolyTailLC_Z (LObject *PR, TObject *PW, LObject *Red)
 
KINLINE int ksReducePolyTail_Z (LObject *PR, TObject *PW, LObject *Red)
 
KINLINE int ksReducePolyTail (LObject *PR, TObject *PW, LObject *Red)
 
KINLINE poly ksOldSpolyRed (poly p1, poly p2, poly spNoether)
 
KINLINE poly ksOldSpolyRedNew (poly p1, poly p2, poly spNoether)
 
KINLINE poly ksOldCreateSpoly (poly p1, poly p2, poly spNoether, ring r)
 
void ksOldSpolyTail (poly p1, poly q, poly q2, poly spNoether, ring r)
 
KINLINE poly redtailBba (poly p, int pos, kStrategy strat, BOOLEAN normalize)
 
KINLINE poly redtailBbaBound (poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
 
KINLINE poly redtailBba_Ring (poly p, int pos, kStrategy strat)
 
KINLINE poly redtailBba_Z (poly p, int pos, kStrategy strat)
 
KINLINE void clearS (poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
 
KINLINE BOOLEAN arriRewDummy (poly, unsigned long, poly, kStrategy, int)
 

Macro Definition Documentation

◆ HAVE_TAIL_BIN

#define HAVE_TAIL_BIN

Definition at line 32 of file kInline.h.

Function Documentation

◆ arriRewDummy()

KINLINE BOOLEAN arriRewDummy ( poly  sig,
unsigned long  not_sevSig,
poly  lm,
kStrategy  strat,
int  start 
)

Definition at line 1273 of file kInline.h.

1274 {
1275  return FALSE;
1276 }
#define FALSE
Definition: auxiliary.h:96

◆ clearS()

KINLINE void clearS ( poly  p,
unsigned long  p_sev,
int *  at,
int *  k,
kStrategy  strat 
)

Definition at line 1248 of file kInline.h.

1250 {
1251  assume(p_sev == pGetShortExpVector(p));
1252  if (strat->noClearS) return;
1253  #ifdef HAVE_RINGS
1255  {
1256  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1257  return;
1258  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1259  return;
1260  }
1261  else
1262  #endif
1263  {
1264  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1265  }
1266  deleteInS((*at),strat);
1267  (*at)--;
1268  (*k)--;
1269 }
int p
Definition: cfModGcd.cc:4078
polyset S
Definition: kutil.h:306
char noClearS
Definition: kutil.h:402
unsigned long * sevS
Definition: kutil.h:322
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:753
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1163
#define assume(x)
Definition: mod2.h:389
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:146
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
#define rField_is_Ring(R)
Definition: ring.h:486

◆ initR()

KINLINE TObject** initR ( )

Definition at line 95 of file kInline.h.

96 {
97  return (TObject**) omAlloc0(setmaxT*sizeof(TObject*));
98 }
#define setmaxT
Definition: kutil.h:33
class sTObject TObject
Definition: kutil.h:57
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ initsevT()

KINLINE unsigned long* initsevT ( )

Definition at line 100 of file kInline.h.

101 {
102  return (unsigned long*) omAlloc0(setmaxT*sizeof(unsigned long));
103 }

◆ initT()

KINLINE TSet initT ( )

Definition at line 84 of file kInline.h.

85 {
86  TSet T = (TSet)omAlloc0(setmaxT*sizeof(TObject));
87  for (int i=setmaxT-1; i>=0; i--)
88  {
89  T[i].tailRing = currRing;
90  T[i].i_r = -1;
91  }
92  return T;
93 }
int i
Definition: cfEzgcd.cc:132
STATIC_VAR jList * T
Definition: janet.cc:30
TObject * TSet
Definition: kutil.h:59

◆ k_GetLeadTerms()

KINLINE BOOLEAN k_GetLeadTerms ( const poly  p1,
const poly  p2,
const ring  p_r,
poly &  m1,
poly &  m2,
const ring  m_r 
)

Definition at line 1029 of file kInline.h.

1031 {
1032  p_LmCheckPolyRing(p1, p_r);
1033  p_LmCheckPolyRing(p2, p_r);
1034 
1035  int i;
1036  long x;
1037  m1 = p_Init(m_r,m_r->PolyBin);
1038  m2 = p_Init(m_r,m_r->PolyBin);
1039 
1040  for (i = p_r->N; i; i--)
1041  {
1042  x = p_GetExpDiff(p1, p2, i, p_r);
1043  if (x > 0)
1044  {
1045  if (x > (long) m_r->bitmask) goto false_return;
1046  p_SetExp(m2,i,x, m_r);
1047  p_SetExp(m1,i,0, m_r);
1048  }
1049  else
1050  {
1051  if (-x > (long) m_r->bitmask) goto false_return;
1052  p_SetExp(m1,i,-x, m_r);
1053  p_SetExp(m2,i,0, m_r);
1054  }
1055  }
1056 
1057  p_Setm(m1, m_r);
1058  p_Setm(m2, m_r);
1059  return TRUE;
1060 
1061  false_return:
1062  p_LmFree(m1, m_r);
1063  p_LmFree(m2, m_r);
1064  m1 = m2 = NULL;
1065  return FALSE;
1066 }
#define TRUE
Definition: auxiliary.h:100
Variable x
Definition: cfModGcd.cc:4082
#define NULL
Definition: omList.c:12
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:637
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:490
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:235
static void p_LmFree(poly p, ring)
Definition: p_polys.h:685
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1322

◆ k_GetStrongLeadTerms()

KINLINE void k_GetStrongLeadTerms ( const poly  p1,
const poly  p2,
const ring  leadRing,
poly &  m1,
poly &  m2,
poly &  lcm,
const ring  tailRing 
)

Definition at line 1072 of file kInline.h.

1074 {
1075  p_LmCheckPolyRing(p1, leadRing);
1076  p_LmCheckPolyRing(p2, leadRing);
1077 
1078  int i;
1079  int x;
1080  int e1;
1081  int e2;
1082  int s;
1083  m1 = p_Init(tailRing,tailRing->PolyBin);
1084  m2 = p_Init(tailRing,tailRing->PolyBin);
1085  lcm = p_Init(leadRing,leadRing->PolyBin);
1086 
1087  for (i = leadRing->N; i>=0; i--)
1088  {
1089  e1 = p_GetExp(p1,i,leadRing);
1090  e2 = p_GetExp(p2,i,leadRing);
1091  x = e1 - e2;
1092  if (x > 0)
1093  {
1094  p_SetExp(m2,i,x, tailRing);
1095  //p_SetExp(m1,i,0, tailRing); // done by p_Init
1096  s = e1;
1097  }
1098  else if (x<0)
1099  {
1100  p_SetExp(m1,i,-x, tailRing);
1101  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1102  s = e2;
1103  }
1104  else
1105  s = e1; // e1==e2
1106  p_SetExp(lcm,i,s, leadRing);
1107  }
1108 
1109  p_Setm(m1, tailRing);
1110  p_Setm(m2, tailRing);
1111  p_Setm(lcm, leadRing);
1112 }
const CanonicalForm int s
Definition: facAbsFact.cc:51
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:709
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:471

◆ k_LmInit_currRing_2_tailRing() [1/2]

KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 1002 of file kInline.h.

1003 {
1004  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
1005 }
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:970

◆ k_LmInit_currRing_2_tailRing() [2/2]

KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing,
omBin  tailBin 
)

Definition at line 970 of file kInline.h.

971 {
972 
973  poly t_p = p_LmInit(p, currRing, tailRing, tailBin);
974  pNext(t_p) = pNext(p);
975  pSetCoeff0(t_p, pGetCoeff(p));
976  return t_p;
977 }
#define pNext(p)
Definition: monomials.h:36
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1337

◆ k_LmInit_tailRing_2_currRing() [1/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 1007 of file kInline.h.

1008 {
1009  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
1010 }
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:979

◆ k_LmInit_tailRing_2_currRing() [2/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly  t_p,
ring  tailRing,
omBin  lmBin 
)

Definition at line 979 of file kInline.h.

980 {
981  poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
982  pNext(p) = pNext(t_p);
983  pSetCoeff0(p, pGetCoeff(t_p));
984  return p;
985 }

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 1012 of file kInline.h.

1013 {
1014  return k_LmShallowCopyDelete_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
1015 }
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:988

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [2/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing,
omBin  tailBin 
)

Definition at line 988 of file kInline.h.

989 {
990  poly np = k_LmInit_currRing_2_tailRing(p, tailRing, tailBin);
991  p_LmFree(p, currRing);
992  return np;
993 }

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 1017 of file kInline.h.

1018 {
1019  return k_LmShallowCopyDelete_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
1020 }
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:995

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [2/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing,
omBin  lmBin 
)

Definition at line 995 of file kInline.h.

996 {
997  poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
998  p_LmFree(p, tailRing);
999  return np;
1000 }

◆ ksOldCreateSpoly()

KINLINE poly ksOldCreateSpoly ( poly  p1,
poly  p2,
poly  spNoether,
ring  r 
)

Definition at line 1205 of file kInline.h.

1206 {
1207  LObject L(r);
1208  L.p1 = p1;
1209  L.p2 = p2;
1210 
1211  ksCreateSpoly(&L, spNoether);
1212  return L.GetLmCurrRing();
1213 }
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1185
class sLObject LObject
Definition: kutil.h:58

◆ ksOldSpolyRed()

KINLINE poly ksOldSpolyRed ( poly  p1,
poly  p2,
poly  spNoether 
)

Definition at line 1185 of file kInline.h.

1186 {
1187  LObject L(p2);
1188  TObject T(p1);
1189 
1190  ksReducePoly(&L, &T, spNoether);
1191 
1192  return L.GetLmCurrRing();
1193 }
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, poly *mon, kStrategy strat)
Definition: kspoly.cc:187

◆ ksOldSpolyRedNew()

KINLINE poly ksOldSpolyRedNew ( poly  p1,
poly  p2,
poly  spNoether 
)

Definition at line 1195 of file kInline.h.

1196 {
1197  LObject L(p_Copy(p2, currRing));
1198  TObject T(p1);
1199 
1200  ksReducePoly(&L, &T, spNoether);
1201 
1202  return L.GetLmCurrRing();
1203 }
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:848

◆ ksOldSpolyTail()

void ksOldSpolyTail ( poly  p1,
poly  q,
poly  q2,
poly  spNoether,
ring  r 
)

Definition at line 1215 of file kInline.h.

1216 {
1217  LObject L(q, currRing, r);
1218  TObject T(p1, currRing, r);
1219 
1220  ksReducePolyTail(&L, &T, q2, spNoether);
1221 }
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1158

◆ ksReducePolyTail()

KINLINE int ksReducePolyTail ( LObject PR,
TObject PW,
LObject Red 
)

Definition at line 1158 of file kInline.h.

1159 {
1160  BOOLEAN ret;
1161  number coef;
1162 
1163  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1164  Red->HeadNormalize();
1165  ret = ksReducePoly(Red, PW, NULL, &coef);
1166 
1167  if (!ret)
1168  {
1169  if (! n_IsOne(coef, currRing->cf))
1170  {
1171  PR->Mult_nn(coef);
1172  // HANNES: mark for Normalize
1173  }
1174  n_Delete(&coef, currRing->cf);
1175  }
1176  return ret;
1177 }
int BOOLEAN
Definition: auxiliary.h:87
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468

◆ ksReducePolyTail_Z()

KINLINE int ksReducePolyTail_Z ( LObject PR,
TObject PW,
LObject Red 
)

Definition at line 1138 of file kInline.h.

1139 {
1140  BOOLEAN ret;
1141  number coef;
1142 
1143  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1144  ret = ksReducePoly(Red, PW, NULL, &coef);
1145 
1146  if (!ret)
1147  {
1148  if (! n_IsOne(coef, currRing->cf))
1149  {
1150  PR->Mult_nn(coef);
1151  // HANNES: mark for Normalize
1152  }
1153  n_Delete(&coef, currRing->cf);
1154  }
1155  return ret;
1156 }

◆ ksReducePolyTailLC_Z()

KINLINE int ksReducePolyTailLC_Z ( LObject PR,
TObject PW,
LObject Red 
)

Definition at line 1120 of file kInline.h.

1121 {
1122  BOOLEAN ret;
1123  number mult, rest;
1124  TObject red = *PW;
1125  red.Copy();
1126  rest = n_QuotRem(pGetCoeff(Red->p), pGetCoeff(red.p),
1127  &mult, currRing->cf);
1128  red.Mult_nn(rest);
1129 
1130  assume(PR->GetLmCurrRing() != red.GetLmCurrRing());
1131  ret = ksReducePolyLC(Red, &red, NULL, &mult);
1132  red.Delete();
1133  red.Clear();
1134 
1135  return ret;
1136 }
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition: coeffs.h:681
int ksReducePolyLC(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:458
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:647

◆ redtailBba()

KINLINE poly redtailBba ( poly  p,
int  pos,
kStrategy  strat,
BOOLEAN  normalize 
)

Definition at line 1223 of file kInline.h.

1224 {
1225  LObject L(p);
1226  return redtailBba(&L, pos, strat,FALSE, normalize);
1227 }
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1223
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1026

◆ redtailBba_Ring()

KINLINE poly redtailBba_Ring ( poly  p,
int  pos,
kStrategy  strat 
)

Definition at line 1236 of file kInline.h.

1237 {
1238  LObject L(p, currRing, strat->tailRing);
1239  return redtailBba_Ring(&L, pos, strat);
1240 }
ring tailRing
Definition: kutil.h:343
KINLINE poly redtailBba_Ring(poly p, int pos, kStrategy strat)
Definition: kInline.h:1236

◆ redtailBba_Z()

KINLINE poly redtailBba_Z ( poly  p,
int  pos,
kStrategy  strat 
)

Definition at line 1241 of file kInline.h.

1242 {
1243  LObject L(p, currRing, strat->tailRing);
1244  return redtailBba_Z(&L, pos, strat);
1245 }
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1241

◆ redtailBbaBound()

KINLINE poly redtailBbaBound ( poly  p,
int  pos,
kStrategy  strat,
int  bound,
BOOLEAN  normalize 
)

Definition at line 1229 of file kInline.h.

1230 {
1231  LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1232  return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1233 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition: kInline.h:1229