My Project  debian-1:4.1.2-p1+ds-2
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_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 1203 of file kInline.h.

1204 {
1205  return FALSE;
1206 }
#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 1178 of file kInline.h.

1180 {
1181  assume(p_sev == pGetShortExpVector(p));
1182  if (strat->noClearS) return;
1183  #ifdef HAVE_RINGS
1185  {
1186  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1187  return;
1188  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1189  return;
1190  }
1191  else
1192  #endif
1193  {
1194  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1195  }
1196  deleteInS((*at),strat);
1197  (*at)--;
1198  (*k)--;
1199 }
int p
Definition: cfModGcd.cc:4019
polyset S
Definition: kutil.h:302
char noClearS
Definition: kutil.h:401
unsigned long * sevS
Definition: kutil.h:318
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:775
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1096
#define assume(x)
Definition: mod2.h:390
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
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479

◆ 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:53
#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:125
STATIC_VAR jList * T
Definition: janet.cc:30
TObject * TSet
Definition: kutil.h:55

◆ 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 964 of file kInline.h.

966 {
967  p_LmCheckPolyRing(p1, p_r);
968  p_LmCheckPolyRing(p2, p_r);
969 
970  int i;
971  long x;
972  m1 = p_Init(m_r,m_r->PolyBin);
973  m2 = p_Init(m_r,m_r->PolyBin);
974 
975  for (i = p_r->N; i; i--)
976  {
977  x = p_GetExpDiff(p1, p2, i, p_r);
978  if (x > 0)
979  {
980  if (x > (long) m_r->bitmask) goto false_return;
981  p_SetExp(m2,i,x, m_r);
982  p_SetExp(m1,i,0, m_r);
983  }
984  else
985  {
986  if (-x > (long) m_r->bitmask) goto false_return;
987  p_SetExp(m1,i,-x, m_r);
988  p_SetExp(m2,i,0, m_r);
989  }
990  }
991 
992  p_Setm(m1, m_r);
993  p_Setm(m2, m_r);
994  return TRUE;
995 
996  false_return:
997  p_LmFree(m1, m_r);
998  p_LmFree(m2, m_r);
999  m1 = m2 = NULL;
1000  return FALSE;
1001 }
#define TRUE
Definition: auxiliary.h:100
Variable x
Definition: cfModGcd.cc:4023
#define NULL
Definition: omList.c:12
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:634
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:118
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:487
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232
static void p_LmFree(poly p, ring)
Definition: p_polys.h:682
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1259

◆ 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 1007 of file kInline.h.

1009 {
1010  p_LmCheckPolyRing(p1, leadRing);
1011  p_LmCheckPolyRing(p2, leadRing);
1012 
1013  int i;
1014  int x;
1015  int e1;
1016  int e2;
1017  int s;
1018  m1 = p_Init(tailRing,tailRing->PolyBin);
1019  m2 = p_Init(tailRing,tailRing->PolyBin);
1020  lcm = p_Init(leadRing,leadRing->PolyBin);
1021 
1022  for (i = leadRing->N; i>=0; i--)
1023  {
1024  e1 = p_GetExp(p1,i,leadRing);
1025  e2 = p_GetExp(p2,i,leadRing);
1026  x = e1 - e2;
1027  if (x > 0)
1028  {
1029  p_SetExp(m2,i,x, tailRing);
1030  //p_SetExp(m1,i,0, tailRing); // done by p_Init
1031  s = e1;
1032  }
1033  else if (x<0)
1034  {
1035  p_SetExp(m1,i,-x, tailRing);
1036  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1037  s = e2;
1038  }
1039  else
1040  s = e1; // e1==e2
1041  p_SetExp(lcm,i,s, leadRing);
1042  }
1043 
1044  p_Setm(m1, tailRing);
1045  p_Setm(m2, tailRing);
1046  p_Setm(lcm, leadRing);
1047 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
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:468

◆ k_LmInit_currRing_2_tailRing() [1/2]

KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 937 of file kInline.h.

938 {
939  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
940 }
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905

◆ k_LmInit_currRing_2_tailRing() [2/2]

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

Definition at line 905 of file kInline.h.

906 {
907 
908  poly t_p = p_LmInit(p, currRing, tailRing, tailBin);
909  pNext(t_p) = pNext(p);
910  pSetCoeff0(t_p, pGetCoeff(p));
911  return t_p;
912 }
#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:1274

◆ k_LmInit_tailRing_2_currRing() [1/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 942 of file kInline.h.

943 {
944  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
945 }
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:914

◆ k_LmInit_tailRing_2_currRing() [2/2]

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

Definition at line 914 of file kInline.h.

915 {
916  poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
917  pNext(p) = pNext(t_p);
918  pSetCoeff0(p, pGetCoeff(t_p));
919  return p;
920 }

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 947 of file kInline.h.

948 {
949  return k_LmShallowCopyDelete_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
950 }
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:923

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [2/2]

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

Definition at line 923 of file kInline.h.

924 {
925  poly np = k_LmInit_currRing_2_tailRing(p, tailRing, tailBin);
926  p_LmFree(p, currRing);
927  return np;
928 }

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 952 of file kInline.h.

953 {
954  return k_LmShallowCopyDelete_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
955 }
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:930

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [2/2]

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

Definition at line 930 of file kInline.h.

931 {
932  poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
933  p_LmFree(p, tailRing);
934  return np;
935 }

◆ ksOldCreateSpoly()

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

Definition at line 1140 of file kInline.h.

1141 {
1142  LObject L(r);
1143  L.p1 = p1;
1144  L.p2 = p2;
1145 
1146  ksCreateSpoly(&L, spNoether);
1147  return L.GetLmCurrRing();
1148 }
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1159
class sLObject LObject
Definition: kutil.h:54

◆ ksOldSpolyRed()

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

Definition at line 1120 of file kInline.h.

1121 {
1122  LObject L(p2);
1123  TObject T(p1);
1124 
1125  ksReducePoly(&L, &T, spNoether);
1126 
1127  return L.GetLmCurrRing();
1128 }
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:188

◆ ksOldSpolyRedNew()

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

Definition at line 1130 of file kInline.h.

1131 {
1132  LObject L(p_Copy(p2, currRing));
1133  TObject T(p1);
1134 
1135  ksReducePoly(&L, &T, spNoether);
1136 
1137  return L.GetLmCurrRing();
1138 }
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811

◆ ksOldSpolyTail()

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

Definition at line 1150 of file kInline.h.

1151 {
1152  LObject L(q, currRing, r);
1153  TObject T(p1, currRing, r);
1154 
1155  ksReducePolyTail(&L, &T, q2, spNoether);
1156 }
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1093

◆ ksReducePolyTail()

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

Definition at line 1093 of file kInline.h.

1094 {
1095  BOOLEAN ret;
1096  number coef;
1097 
1098  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1099  Red->HeadNormalize();
1100  ret = ksReducePoly(Red, PW, NULL, &coef);
1101 
1102  if (!ret)
1103  {
1104  if (! n_IsOne(coef, currRing->cf))
1105  {
1106  PR->Mult_nn(coef);
1107  // HANNES: mark for Normalize
1108  }
1109  n_Delete(&coef, currRing->cf);
1110  }
1111  return ret;
1112 }
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 1073 of file kInline.h.

1074 {
1075  BOOLEAN ret;
1076  number coef;
1077 
1078  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1079  ret = ksReducePoly(Red, PW, NULL, &coef);
1080 
1081  if (!ret)
1082  {
1083  if (! n_IsOne(coef, currRing->cf))
1084  {
1085  PR->Mult_nn(coef);
1086  // HANNES: mark for Normalize
1087  }
1088  n_Delete(&coef, currRing->cf);
1089  }
1090  return ret;
1091 }

◆ ksReducePolyTailLC_Z()

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

Definition at line 1055 of file kInline.h.

1056 {
1057  BOOLEAN ret;
1058  number mult, rest;
1059  TObject red = *PW;
1060  red.Copy();
1061  rest = n_QuotRem(pGetCoeff(Red->p), pGetCoeff(red.p),
1062  &mult, currRing->cf);
1063  red.Mult_nn(rest);
1064 
1065  assume(PR->GetLmCurrRing() != red.GetLmCurrRing());
1066  ret = ksReducePolyLC(Red, &red, NULL, &mult);
1067  red.Delete();
1068  red.Clear();
1069 
1070  return ret;
1071 }
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition: coeffs.h:703
int ksReducePolyLC(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:436
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 1158 of file kInline.h.

1159 {
1160  LObject L(p);
1161  return redtailBba(&L, pos, strat,FALSE, normalize);
1162 }
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1158
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_Z()

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

Definition at line 1171 of file kInline.h.

1172 {
1173  LObject L(p, currRing, strat->tailRing);
1174  return redtailBba_Z(&L, pos, strat);
1175 }
ring tailRing
Definition: kutil.h:341
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1171

◆ redtailBbaBound()

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

Definition at line 1164 of file kInline.h.

1165 {
1166  LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1167  return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1168 }
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:1164