My Project  UNKNOWN_GIT_VERSION
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 30 of file kInline.h.

Function Documentation

◆ arriRewDummy()

KINLINE BOOLEAN arriRewDummy ( poly  ,
unsigned long  ,
poly  ,
kStrategy  ,
int   
)

Definition at line 1132 of file kInline.h.

1133 {
1134  return FALSE;
1135 }

◆ clearS()

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

Definition at line 1107 of file kInline.h.

1109 {
1110  assume(p_sev == pGetShortExpVector(p));
1111  if (strat->noClearS) return;
1112  #ifdef HAVE_RINGS
1114  {
1115  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1116  return;
1117  if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1118  return;
1119  }
1120  else
1121  #endif
1122  {
1123  if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1124  }
1125  deleteInS((*at),strat);
1126  (*at)--;
1127  (*k)--;
1128 }

◆ initR()

KINLINE TObject** initR ( )

Definition at line 92 of file kInline.h.

93 {
94  return (TObject**) omAlloc0(setmaxT*sizeof(TObject*));
95 }

◆ 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 }

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

933 {
934  p_LmCheckPolyRing(p1, p_r);
935  p_LmCheckPolyRing(p2, p_r);
936 
937  int i;
938  long x;
939  m1 = p_Init(m_r,m_r->PolyBin);
940  m2 = p_Init(m_r,m_r->PolyBin);
941 
942  for (i = p_r->N; i; i--)
943  {
944  x = p_GetExpDiff(p1, p2, i, p_r);
945  if (x > 0)
946  {
947  if (x > (long) m_r->bitmask) goto false_return;
948  p_SetExp(m2,i,x, m_r);
949  p_SetExp(m1,i,0, m_r);
950  }
951  else
952  {
953  if (-x > (long) m_r->bitmask) goto false_return;
954  p_SetExp(m1,i,-x, m_r);
955  p_SetExp(m2,i,0, m_r);
956  }
957  }
958 
959  p_Setm(m1, m_r);
960  p_Setm(m2, m_r);
961  return TRUE;
962 
963  false_return:
964  p_LmFree(m1, m_r);
965  p_LmFree(m2, m_r);
966  m1 = m2 = NULL;
967  return FALSE;
968 }

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

976 {
977  p_LmCheckPolyRing(p1, leadRing);
978  p_LmCheckPolyRing(p2, leadRing);
979 
980  int i;
981  int x;
982  int e1;
983  int e2;
984  int s;
985  m1 = p_Init(tailRing,tailRing->PolyBin);
986  m2 = p_Init(tailRing,tailRing->PolyBin);
987  lcm = p_Init(leadRing,leadRing->PolyBin);
988 
989  for (i = leadRing->N; i>=0; i--)
990  {
991  e1 = p_GetExp(p1,i,leadRing);
992  e2 = p_GetExp(p2,i,leadRing);
993  x = e1 - e2;
994  if (x > 0)
995  {
996  p_SetExp(m2,i,x, tailRing);
997  //p_SetExp(m1,i,0, tailRing); // done by p_Init
998  s = e1;
999  }
1000  else if (x<0)
1001  {
1002  p_SetExp(m1,i,-x, tailRing);
1003  //p_SetExp(m2,i,0, tailRing); // done by p_Init
1004  s = e2;
1005  }
1006  else
1007  s = e1; // e1==e2
1008  p_SetExp(lcm,i,s, leadRing);
1009  }
1010 
1011  p_Setm(m1, tailRing);
1012  p_Setm(m2, tailRing);
1013  p_Setm(lcm, leadRing);
1014 }

◆ k_LmInit_currRing_2_tailRing() [1/2]

KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 904 of file kInline.h.

905 {
906  return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
907 }

◆ k_LmInit_currRing_2_tailRing() [2/2]

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

Definition at line 872 of file kInline.h.

873 {
874 
875  poly t_p = p_LmInit(p, currRing, tailRing, tailBin);
876  pNext(t_p) = pNext(p);
877  pSetCoeff0(t_p, pGetCoeff(p));
878  return t_p;
879 }

◆ k_LmInit_tailRing_2_currRing() [1/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 909 of file kInline.h.

910 {
911  return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
912 }

◆ k_LmInit_tailRing_2_currRing() [2/2]

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

Definition at line 881 of file kInline.h.

882 {
883  poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
884  pNext(p) = pNext(t_p);
885  pSetCoeff0(p, pGetCoeff(t_p));
886  return p;
887 }

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 914 of file kInline.h.

915 {
916  return k_LmShallowCopyDelete_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
917 }

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [2/2]

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

Definition at line 890 of file kInline.h.

891 {
892  poly np = k_LmInit_currRing_2_tailRing(p, tailRing, tailBin);
893  p_LmFree(p, currRing);
894  return np;
895 }

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 919 of file kInline.h.

920 {
921  return k_LmShallowCopyDelete_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
922 }

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [2/2]

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

Definition at line 897 of file kInline.h.

898 {
899  poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
900  p_LmFree(p, tailRing);
901  return np;
902 }

◆ ksOldCreateSpoly()

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

Definition at line 1069 of file kInline.h.

1070 {
1071  LObject L(r);
1072  L.p1 = p1;
1073  L.p2 = p2;
1074 
1075  ksCreateSpoly(&L, spNoether);
1076  return L.GetLmCurrRing();
1077 }

◆ ksOldSpolyRed()

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

Definition at line 1049 of file kInline.h.

1050 {
1051  LObject L(p2);
1052  TObject T(p1);
1053 
1054  ksReducePoly(&L, &T, spNoether);
1055 
1056  return L.GetLmCurrRing();
1057 }

◆ ksOldSpolyRedNew()

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

Definition at line 1059 of file kInline.h.

1060 {
1061  LObject L(p_Copy(p2, currRing));
1062  TObject T(p1);
1063 
1064  ksReducePoly(&L, &T, spNoether);
1065 
1066  return L.GetLmCurrRing();
1067 }

◆ ksOldSpolyTail()

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

Definition at line 1079 of file kInline.h.

1080 {
1081  LObject L(q, currRing, r);
1082  TObject T(p1, currRing, r);
1083 
1084  ksReducePolyTail(&L, &T, q2, spNoether);
1085 }

◆ ksReducePolyTail()

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

Definition at line 1022 of file kInline.h.

1023 {
1024  BOOLEAN ret;
1025  number coef;
1026 
1027  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1028  Red->HeadNormalize();
1029  ret = ksReducePoly(Red, PW, NULL, &coef);
1030 
1031  if (!ret)
1032  {
1033  if (! n_IsOne(coef, currRing->cf))
1034  {
1035  PR->Mult_nn(coef);
1036  // HANNES: mark for Normalize
1037  }
1038  n_Delete(&coef, currRing->cf);
1039  }
1040  return ret;
1041 }

◆ redtailBba()

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

Definition at line 1087 of file kInline.h.

1088 {
1089  LObject L(p);
1090  return redtailBba(&L, pos, strat,FALSE, normalize);
1091 }

◆ redtailBba_Z()

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

Definition at line 1100 of file kInline.h.

1101 {
1102  LObject L(p, currRing, strat->tailRing);
1103  return redtailBba_Z(&L, pos, strat);
1104 }

◆ redtailBbaBound()

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

Definition at line 1093 of file kInline.h.

1094 {
1095  LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1096  return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1097 }
FALSE
#define FALSE
Definition: auxiliary.h:94
k_LmShallowCopyDelete_currRing_2_tailRing
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:890
k_LmInit_tailRing_2_currRing
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:881
p_GetExp
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:470
TObject
class sTObject TObject
Definition: kutil.h:53
x
Variable x
Definition: cfModGcd.cc:4023
skStrategy::S
polyset S
Definition: kutil.h:297
p_LmInit
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1272
skStrategy::tailRing
ring tailRing
Definition: kutil.h:336
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
pGetShortExpVector
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
skStrategy::sevS
unsigned long * sevS
Definition: kutil.h:313
n_IsOne
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
p_SetExp
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:489
k_LmInit_currRing_2_tailRing
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:872
p_LmCheckPolyRing
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:120
redtailBba_Z
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1100
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:813
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
ksCreateSpoly
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:752
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
ksReducePoly
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:41
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
ksReducePolyTail
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1022
T
static jList * T
Definition: janet.cc:31
rField_is_Ring
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
TSet
TObject * TSet
Definition: kutil.h:55
setmaxT
#define setmaxT
Definition: kutil.h:33
k_LmShallowCopyDelete_tailRing_2_currRing
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:897
p_Init
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257
p_LmFree
static void p_LmFree(poly p, ring)
Definition: p_polys.h:684
redtailBba
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1087
normalize
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
bound
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
redtailBbaBound
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition: kInline.h:1093
pSetCoeff0
#define pSetCoeff0(p, n)
Definition: monomials.h:60
p_GetExpDiff
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:636
n_DivBy
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
assume
#define assume(x)
Definition: mod2.h:390
NULL
#define NULL
Definition: omList.c:10
skStrategy::noClearS
char noClearS
Definition: kutil.h:396
pLmShortDivisibleBy
#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
lcm
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:709
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
LObject
class sLObject LObject
Definition: kutil.h:54
p
int p
Definition: cfModGcd.cc:4019
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
deleteInS
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1069
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
pNext
#define pNext(p)
Definition: monomials.h:37
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211