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

1231{
1232 return FALSE;
1233}
#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 1205 of file kInline.h.

1207{
1208 assume(p_sev == pGetShortExpVector(p));
1209 if (strat->noClearS) return;
1210 #ifdef HAVE_RINGS
1212 {
1213 if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1214 return;
1215 if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1216 return;
1217 }
1218 else
1219 #endif
1220 {
1221 if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1222 }
1223 deleteInS((*at),strat);
1224 (*at)--;
1225 (*k)--;
1226}
int p
Definition: cfModGcd.cc:4080
polyset S
Definition: kutil.h:307
char noClearS
Definition: kutil.h:406
unsigned long * sevS
Definition: kutil.h:323
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:777
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1137
#define assume(x)
Definition: mod2.h:387
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: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 986 of file kInline.h.

988{
989 p_LmCheckPolyRing(p1, p_r);
990 p_LmCheckPolyRing(p2, p_r);
991
992 int i;
993 long x;
994 m1 = p_Init(m_r,m_r->PolyBin);
995 m2 = p_Init(m_r,m_r->PolyBin);
996
997 for (i = p_r->N; i; i--)
998 {
999 x = p_GetExpDiff(p1, p2, i, p_r);
1000 if (x > 0)
1001 {
1002 if (x > (long) m_r->bitmask) goto false_return;
1003 p_SetExp(m2,i,x, m_r);
1004 p_SetExp(m1,i,0, m_r);
1005 }
1006 else
1007 {
1008 if (-x > (long) m_r->bitmask) goto false_return;
1009 p_SetExp(m1,i,-x, m_r);
1010 p_SetExp(m2,i,0, m_r);
1011 }
1012 }
1013
1014 p_Setm(m1, m_r);
1015 p_Setm(m2, m_r);
1016 return TRUE;
1017
1018 false_return:
1019 p_LmFree(m1, m_r);
1020 p_LmFree(m2, m_r);
1021 m1 = m2 = NULL;
1022 return FALSE;
1023}
#define NULL
Definition: auxiliary.h:104
#define TRUE
Definition: auxiliary.h:100
Variable x
Definition: cfModGcd.cc:4084
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: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: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:1280

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

1031{
1032 p_LmCheckPolyRing(p1, leadRing);
1033 p_LmCheckPolyRing(p2, leadRing);
1034
1035 int i;
1036 int x;
1037 int e1;
1038 int e2;
1039 int s;
1040 m1 = p_Init(tailRing,tailRing->PolyBin);
1041 m2 = p_Init(tailRing,tailRing->PolyBin);
1042 lcm = p_Init(leadRing,leadRing->PolyBin);
1043
1044 for (i = leadRing->N; i>=0; i--)
1045 {
1046 e1 = p_GetExp(p1,i,leadRing);
1047 e2 = p_GetExp(p2,i,leadRing);
1048 x = e1 - e2;
1049 if (x > 0)
1050 {
1051 p_SetExp(m2,i,x, tailRing);
1052 //p_SetExp(m1,i,0, tailRing); // done by p_Init
1053 s = e1;
1054 }
1055 else if (x<0)
1056 {
1057 p_SetExp(m1,i,-x, tailRing);
1058 //p_SetExp(m2,i,0, tailRing); // done by p_Init
1059 s = e2;
1060 }
1061 else
1062 s = e1; // e1==e2
1063 p_SetExp(lcm,i,s, leadRing);
1064 }
1065
1066 p_Setm(m1, tailRing);
1067 p_Setm(m2, tailRing);
1068 p_Setm(lcm, leadRing);
1069}
CanonicalForm lcm(const CanonicalForm &, const CanonicalForm &)
CanonicalForm lcm ( const CanonicalForm & f, const CanonicalForm & g )
Definition: cf_gcd.cc:763
const CanonicalForm int s
Definition: facAbsFact.cc:51
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 959 of file kInline.h.

960{
961 return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
962}
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:927

◆ k_LmInit_currRing_2_tailRing() [2/2]

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

Definition at line 927 of file kInline.h.

928{
929
930 poly t_p = p_LmInit(p, currRing, tailRing, tailBin);
931 pNext(t_p) = pNext(p);
932 pSetCoeff0(t_p, pGetCoeff(p));
933 return t_p;
934}
#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:1295

◆ k_LmInit_tailRing_2_currRing() [1/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 964 of file kInline.h.

965{
966 return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
967}
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:936

◆ k_LmInit_tailRing_2_currRing() [2/2]

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

Definition at line 936 of file kInline.h.

937{
938 poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
939 pNext(p) = pNext(t_p);
940 pSetCoeff0(p, pGetCoeff(t_p));
941 return p;
942}

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 969 of file kInline.h.

970{
971 return k_LmShallowCopyDelete_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
972}
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:945

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [2/2]

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

Definition at line 945 of file kInline.h.

946{
947 poly np = k_LmInit_currRing_2_tailRing(p, tailRing, tailBin);
949 return np;
950}

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 974 of file kInline.h.

975{
976 return k_LmShallowCopyDelete_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
977}
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:952

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [2/2]

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

Definition at line 952 of file kInline.h.

953{
954 poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
955 p_LmFree(p, tailRing);
956 return np;
957}

◆ ksOldCreateSpoly()

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

Definition at line 1162 of file kInline.h.

1163{
1164 LObject L(r);
1165 L.p1 = p1;
1166 L.p2 = p2;
1167
1168 ksCreateSpoly(&L, spNoether);
1169 return L.GetLmCurrRing();
1170}
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1167
class sLObject LObject
Definition: kutil.h:58

◆ ksOldSpolyRed()

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

Definition at line 1142 of file kInline.h.

1143{
1144 LObject L(p2);
1145 TObject T(p1);
1146
1147 ksReducePoly(&L, &T, spNoether);
1148
1149 return L.GetLmCurrRing();
1150}
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, poly *mon, kStrategy strat)
Definition: kspoly.cc:185

◆ ksOldSpolyRedNew()

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

Definition at line 1152 of file kInline.h.

1153{
1154 LObject L(p_Copy(p2, currRing));
1155 TObject T(p1);
1156
1157 ksReducePoly(&L, &T, spNoether);
1158
1159 return L.GetLmCurrRing();
1160}
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 1172 of file kInline.h.

1173{
1174 LObject L(q, currRing, r);
1175 TObject T(p1, currRing, r);
1176
1177 ksReducePolyTail(&L, &T, q2, spNoether);
1178}
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1115

◆ ksReducePolyTail()

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

Definition at line 1115 of file kInline.h.

1116{
1117 BOOLEAN ret;
1118 number coef;
1119
1120 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1121 Red->HeadNormalize();
1122 ret = ksReducePoly(Red, PW, NULL, &coef);
1123
1124 if (!ret)
1125 {
1126 if (! n_IsOne(coef, currRing->cf))
1127 {
1128 PR->Mult_nn(coef);
1129 // HANNES: mark for Normalize
1130 }
1131 n_Delete(&coef, currRing->cf);
1132 }
1133 return ret;
1134}
int BOOLEAN
Definition: auxiliary.h:87
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

◆ ksReducePolyTail_Z()

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

Definition at line 1095 of file kInline.h.

1096{
1097 BOOLEAN ret;
1098 number coef;
1099
1100 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1101 ret = ksReducePoly(Red, PW, NULL, &coef);
1102
1103 if (!ret)
1104 {
1105 if (! n_IsOne(coef, currRing->cf))
1106 {
1107 PR->Mult_nn(coef);
1108 // HANNES: mark for Normalize
1109 }
1110 n_Delete(&coef, currRing->cf);
1111 }
1112 return ret;
1113}

◆ ksReducePolyTailLC_Z()

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

Definition at line 1077 of file kInline.h.

1078{
1079 BOOLEAN ret;
1080 number mult, rest;
1081 TObject red = *PW;
1082 red.Copy();
1083 rest = n_QuotRem(pGetCoeff(Red->p), pGetCoeff(red.p),
1084 &mult, currRing->cf);
1085 red.Mult_nn(rest);
1086
1087 assume(PR->GetLmCurrRing() != red.GetLmCurrRing());
1088 ret = ksReducePolyLC(Red, &red, NULL, &mult);
1089 red.Delete();
1090 red.Clear();
1091
1092 return ret;
1093}
void mult(CFList &L1, const CFList &L2)
multiply two lists componentwise
Definition: cfModGcd.cc:2178
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition: coeffs.h:704
int ksReducePolyLC(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:452

◆ redtailBba()

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

Definition at line 1180 of file kInline.h.

1181{
1182 LObject L(p);
1183 return redtailBba(&L, pos, strat,FALSE, normalize);
1184}
CanonicalForm normalize(const CanonicalForm &F)
normalize a poly, i.e. in char 0 clear denominators, remove integer content in char p divide by leadi...
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1180

◆ redtailBba_Ring()

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

Definition at line 1193 of file kInline.h.

1194{
1195 LObject L(p, currRing, strat->tailRing);
1196 return redtailBba_Ring(&L, pos, strat);
1197}
ring tailRing
Definition: kutil.h:346
KINLINE poly redtailBba_Ring(poly p, int pos, kStrategy strat)
Definition: kInline.h:1193

◆ redtailBba_Z()

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

Definition at line 1198 of file kInline.h.

1199{
1200 LObject L(p, currRing, strat->tailRing);
1201 return redtailBba_Z(&L, pos, strat);
1202}
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1198

◆ redtailBbaBound()

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

Definition at line 1186 of file kInline.h.

1187{
1188 LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1189 return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1190}
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:1186