My Project  debian-1:4.1.1-p2+ds-4build4
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"

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 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 29 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 1140 of file kInline.h.

1141 {
1142  return FALSE;
1143 }
#define FALSE
Definition: auxiliary.h:94

◆ clearS()

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

Definition at line 1115 of file kInline.h.

1117 {
1118  assume(p_sev == pGetShortExpVector(p));
1119  if (strat->noClearS) return;
1120  #ifdef HAVE_RINGS
1122  {
1123  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1124  return;
1125  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1126  return;
1127  }
1128  else
1129  #endif
1130  {
1131  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1132  }
1133  deleteInS((*at),strat);
1134  (*at)--;
1135  (*k)--;
1136 }
int p
Definition: cfModGcd.cc:4019
polyset S
Definition: kutil.h:297
char noClearS
Definition: kutil.h:396
unsigned long * sevS
Definition: kutil.h:313
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:784
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1045
#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:51
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:477

◆ initR()

KINLINE TObject** initR ( )

Definition at line 92 of file kInline.h.

93 {
94  return (TObject**) omAlloc0(setmaxT*sizeof(TObject*));
95 }
#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 97 of file kInline.h.

98 {
99  return (unsigned long*) omAlloc0(setmaxT*sizeof(unsigned long));
100 }

◆ initT()

KINLINE TSet initT ( )

Definition at line 81 of file kInline.h.

82 {
83  TSet T = (TSet)omAlloc0(setmaxT*sizeof(TObject));
84  for (int i=setmaxT-1; i>=0; i--)
85  {
86  T[i].tailRing = currRing;
87  T[i].i_r = -1;
88  }
89  return T;
90 }
int i
Definition: cfEzgcd.cc:125
static jList * T
Definition: janet.cc:31
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 939 of file kInline.h.

941 {
942  p_LmCheckPolyRing(p1, p_r);
943  p_LmCheckPolyRing(p2, p_r);
944 
945  int i;
946  long x;
947  m1 = p_Init(m_r,m_r->PolyBin);
948  m2 = p_Init(m_r,m_r->PolyBin);
949 
950  for (i = p_r->N; i; i--)
951  {
952  x = p_GetExpDiff(p1, p2, i, p_r);
953  if (x > 0)
954  {
955  if (x > (long) m_r->bitmask) goto false_return;
956  p_SetExp(m2,i,x, m_r);
957  p_SetExp(m1,i,0, m_r);
958  }
959  else
960  {
961  if (-x > (long) m_r->bitmask) goto false_return;
962  p_SetExp(m1,i,-x, m_r);
963  p_SetExp(m2,i,0, m_r);
964  }
965  }
966 
967  p_Setm(m1, m_r);
968  p_Setm(m2, m_r);
969  return TRUE;
970 
971  false_return:
972  p_LmFree(m1, m_r);
973  p_LmFree(m2, m_r);
974  m1 = m2 = NULL;
975  return FALSE;
976 }
#define TRUE
Definition: auxiliary.h:98
Variable x
Definition: cfModGcd.cc:4023
#define NULL
Definition: omList.c:10
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:635
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:488
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:233
static void p_LmFree(poly p, ring)
Definition: p_polys.h:683
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1266

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

984 {
985  p_LmCheckPolyRing(p1, leadRing);
986  p_LmCheckPolyRing(p2, leadRing);
987 
988  int i;
989  int x;
990  int e1;
991  int e2;
992  int s;
993  m1 = p_Init(tailRing,tailRing->PolyBin);
994  m2 = p_Init(tailRing,tailRing->PolyBin);
995  lcm = p_Init(leadRing,leadRing->PolyBin);
996 
997  for (i = leadRing->N; i>=0; i--)
998  {
999  e1 = p_GetExp(p1,i,leadRing);
1000  e2 = p_GetExp(p2,i,leadRing);
1001  x = e1 - e2;
1002  if (x > 0)
1003  {
1004  p_SetExp(m2,i,x, tailRing);
1005  //p_SetExp(m1,i,0, tailRing); // done by p_Init
1006  s = e1;
1007  }
1008  else if (x<0)
1009  {
1010  p_SetExp(m1,i,-x, tailRing);
1011  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1012  s = e2;
1013  }
1014  else
1015  s = e1; // e1==e2
1016  p_SetExp(lcm,i,s, leadRing);
1017  }
1018 
1019  p_Setm(m1, tailRing);
1020  p_Setm(m2, tailRing);
1021  p_Setm(lcm, leadRing);
1022 }
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:469

◆ k_LmInit_currRing_2_tailRing() [1/2]

KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 912 of file kInline.h.

913 {
914  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
915 }
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:880

◆ k_LmInit_currRing_2_tailRing() [2/2]

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

Definition at line 880 of file kInline.h.

881 {
882 
883  poly t_p = p_LmInit(p, currRing, tailRing, tailBin);
884  pNext(t_p) = pNext(p);
885  pSetCoeff0(t_p, pGetCoeff(p));
886  return t_p;
887 }
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:66
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1281

◆ k_LmInit_tailRing_2_currRing() [1/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 917 of file kInline.h.

918 {
919  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
920 }
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:889

◆ k_LmInit_tailRing_2_currRing() [2/2]

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

Definition at line 889 of file kInline.h.

890 {
891  poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
892  pNext(p) = pNext(t_p);
893  pSetCoeff0(p, pGetCoeff(t_p));
894  return p;
895 }

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 922 of file kInline.h.

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

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [2/2]

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

Definition at line 898 of file kInline.h.

899 {
900  poly np = k_LmInit_currRing_2_tailRing(p, tailRing, tailBin);
901  p_LmFree(p, currRing);
902  return np;
903 }

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 927 of file kInline.h.

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

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [2/2]

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

Definition at line 905 of file kInline.h.

906 {
907  poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
908  p_LmFree(p, tailRing);
909  return np;
910 }

◆ ksOldCreateSpoly()

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

Definition at line 1077 of file kInline.h.

1078 {
1079  LObject L(r);
1080  L.p1 = p1;
1081  L.p2 = p2;
1082 
1083  ksCreateSpoly(&L, spNoether);
1084  return L.GetLmCurrRing();
1085 }
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:759
class sLObject LObject
Definition: kutil.h:54

◆ ksOldSpolyRed()

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

Definition at line 1057 of file kInline.h.

1058 {
1059  LObject L(p2);
1060  TObject T(p1);
1061 
1062  ksReducePoly(&L, &T, spNoether);
1063 
1064  return L.GetLmCurrRing();
1065 }
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41

◆ ksOldSpolyRedNew()

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

Definition at line 1067 of file kInline.h.

1068 {
1069  LObject L(p_Copy(p2, currRing));
1070  TObject T(p1);
1071 
1072  ksReducePoly(&L, &T, spNoether);
1073 
1074  return L.GetLmCurrRing();
1075 }
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:812

◆ ksOldSpolyTail()

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

Definition at line 1087 of file kInline.h.

1088 {
1089  LObject L(q, currRing, r);
1090  TObject T(p1, currRing, r);
1091 
1092  ksReducePolyTail(&L, &T, q2, spNoether);
1093 }
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1030

◆ ksReducePolyTail()

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

Definition at line 1030 of file kInline.h.

1031 {
1032  BOOLEAN ret;
1033  number coef;
1034 
1035  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1036  Red->HeadNormalize();
1037  ret = ksReducePoly(Red, PW, NULL, &coef);
1038 
1039  if (!ret)
1040  {
1041  if (! n_IsOne(coef, currRing->cf))
1042  {
1043  PR->Mult_nn(coef);
1044  // HANNES: mark for Normalize
1045  }
1046  n_Delete(&coef, currRing->cf);
1047  }
1048  return ret;
1049 }
int BOOLEAN
Definition: auxiliary.h:85
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:469

◆ redtailBba()

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

Definition at line 1095 of file kInline.h.

1096 {
1097  LObject L(p);
1098  return redtailBba(&L, pos, strat,FALSE, normalize);
1099 }
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1095
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027

◆ redtailBba_Z()

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

Definition at line 1108 of file kInline.h.

1109 {
1110  LObject L(p, currRing, strat->tailRing);
1111  return redtailBba_Z(&L, pos, strat);
1112 }
ring tailRing
Definition: kutil.h:336
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1108

◆ redtailBbaBound()

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

Definition at line 1101 of file kInline.h.

1102 {
1103  LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1104  return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1105 }
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:1101