My Project
Loading...
Searching...
No Matches
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 1264 of file kInline.h.

1265{
1266 return FALSE;
1267}
#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 1239 of file kInline.h.

1241{
1242 assume(p_sev == pGetShortExpVector(p));
1243 if (strat->noClearS) return;
1244 #ifdef HAVE_RINGS
1246 {
1247 if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1248 return;
1249 if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1250 return;
1251 }
1252 else
1253 #endif
1254 {
1255 if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1256 }
1257 deleteInS((*at),strat);
1258 (*at)--;
1259 (*k)--;
1260}
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:750
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1139
#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:485

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

1020{
1021 p_LmCheckPolyRing(p1, p_r);
1022 p_LmCheckPolyRing(p2, p_r);
1023
1024 int i;
1025 long x;
1026 m1 = p_Init(m_r,m_r->PolyBin);
1027 m2 = p_Init(m_r,m_r->PolyBin);
1028
1029 for (i = p_r->N; i; i--)
1030 {
1031 x = p_GetExpDiff(p1, p2, i, p_r);
1032 if (x > 0)
1033 {
1034 if (x > (long) m_r->bitmask) goto false_return;
1035 p_SetExp(m2,i,x, m_r);
1036 p_SetExp(m1,i,0, m_r);
1037 }
1038 else
1039 {
1040 if (-x > (long) m_r->bitmask) goto false_return;
1041 p_SetExp(m1,i,-x, m_r);
1042 p_SetExp(m2,i,0, m_r);
1043 }
1044 }
1045
1046 p_Setm(m1, m_r);
1047 p_Setm(m2, m_r);
1048 return TRUE;
1049
1050 false_return:
1051 p_LmFree(m1, m_r);
1052 p_LmFree(m2, m_r);
1053 m1 = m2 = NULL;
1054 return FALSE;
1055}
#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:633
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition: pDebug.cc:123
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:486
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:231
static void p_LmFree(poly p, ring)
Definition: p_polys.h:681
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1318

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

1063{
1064 p_LmCheckPolyRing(p1, leadRing);
1065 p_LmCheckPolyRing(p2, leadRing);
1066
1067 int i;
1068 int x;
1069 int e1;
1070 int e2;
1071 int s;
1072 m1 = p_Init(tailRing,tailRing->PolyBin);
1073 m2 = p_Init(tailRing,tailRing->PolyBin);
1074 lcm = p_Init(leadRing,leadRing->PolyBin);
1075
1076 for (i = leadRing->N; i>=0; i--)
1077 {
1078 e1 = p_GetExp(p1,i,leadRing);
1079 e2 = p_GetExp(p2,i,leadRing);
1080 x = e1 - e2;
1081 if (x > 0)
1082 {
1083 p_SetExp(m2,i,x, tailRing);
1084 //p_SetExp(m1,i,0, tailRing); // done by p_Init
1085 s = e1;
1086 }
1087 else if (x<0)
1088 {
1089 p_SetExp(m1,i,-x, tailRing);
1090 //p_SetExp(m2,i,0, tailRing); // done by p_Init
1091 s = e2;
1092 }
1093 else
1094 s = e1; // e1==e2
1095 p_SetExp(lcm,i,s, leadRing);
1096 }
1097
1098 p_Setm(m1, tailRing);
1099 p_Setm(m2, tailRing);
1100 p_Setm(lcm, leadRing);
1101}
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:467

◆ k_LmInit_currRing_2_tailRing() [1/2]

KINLINE poly k_LmInit_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 991 of file kInline.h.

992{
993 return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
994}
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:959

◆ k_LmInit_currRing_2_tailRing() [2/2]

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

Definition at line 959 of file kInline.h.

960{
961
962 poly t_p = p_LmInit(p, currRing, tailRing, tailBin);
963 pNext(t_p) = pNext(p);
964 pSetCoeff0(t_p, pGetCoeff(p));
965 return t_p;
966}
#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:1333

◆ k_LmInit_tailRing_2_currRing() [1/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 996 of file kInline.h.

997{
998 return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
999}
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition: kInline.h:968

◆ k_LmInit_tailRing_2_currRing() [2/2]

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

Definition at line 968 of file kInline.h.

969{
970 poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
971 pNext(p) = pNext(t_p);
972 pSetCoeff0(p, pGetCoeff(t_p));
973 return p;
974}

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly  p,
ring  tailRing 
)

Definition at line 1001 of file kInline.h.

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

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [2/2]

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

Definition at line 977 of file kInline.h.

978{
979 poly np = k_LmInit_currRing_2_tailRing(p, tailRing, tailBin);
981 return np;
982}

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly  p,
ring  tailRing 
)

Definition at line 1006 of file kInline.h.

1007{
1008 return k_LmShallowCopyDelete_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
1009}
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition: kInline.h:984

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [2/2]

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

Definition at line 984 of file kInline.h.

985{
986 poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
987 p_LmFree(p, tailRing);
988 return np;
989}

◆ ksOldCreateSpoly()

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

Definition at line 1196 of file kInline.h.

1197{
1198 LObject L(r);
1199 L.p1 = p1;
1200 L.p2 = p2;
1201
1202 ksCreateSpoly(&L, spNoether);
1203 return L.GetLmCurrRing();
1204}
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1208
class sLObject LObject
Definition: kutil.h:58

◆ ksOldSpolyRed()

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

Definition at line 1176 of file kInline.h.

1177{
1178 LObject L(p2);
1179 TObject T(p1);
1180
1181 ksReducePoly(&L, &T, spNoether);
1182
1183 return L.GetLmCurrRing();
1184}
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, poly *mon, kStrategy strat, BOOLEAN reduce)
Definition: kspoly.cc:189

◆ ksOldSpolyRedNew()

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

Definition at line 1186 of file kInline.h.

1187{
1188 LObject L(p_Copy(p2, currRing));
1189 TObject T(p1);
1190
1191 ksReducePoly(&L, &T, spNoether);
1192
1193 return L.GetLmCurrRing();
1194}
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:844

◆ ksOldSpolyTail()

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

Definition at line 1206 of file kInline.h.

1207{
1208 LObject L(q, currRing, r);
1209 TObject T(p1, currRing, r);
1210
1211 ksReducePolyTail(&L, &T, q2, spNoether);
1212}
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1149

◆ ksReducePolyTail()

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

Definition at line 1149 of file kInline.h.

1150{
1151 BOOLEAN ret;
1152 number coef;
1153
1154 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1155 Red->HeadNormalize();
1156 ret = ksReducePoly(Red, PW, NULL, &coef);
1157
1158 if (!ret)
1159 {
1160 if (! n_IsOne(coef, currRing->cf))
1161 {
1162 PR->Mult_nn(coef);
1163 // HANNES: mark for Normalize
1164 }
1165 n_Delete(&coef, currRing->cf);
1166 }
1167 return ret;
1168}
int BOOLEAN
Definition: auxiliary.h:87
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:452
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:465

◆ ksReducePolyTail_Z()

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

Definition at line 1127 of file kInline.h.

1128{
1129 BOOLEAN ret;
1130 number coef=NULL;
1131
1132 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1133 ret = ksReducePoly(Red, PW, NULL, &coef, NULL,NULL,TRUE);
1134
1135#if 0 // shlould not happen
1136 if (!ret)
1137 {
1138 if (! n_IsOne(coef, currRing->cf))
1139 {
1140 PR->Mult_nn(coef);
1141 // HANNES: mark for Normalize
1142 }
1143 }
1144#endif
1145 n_Delete(&coef, currRing->cf);
1146 return ret;
1147}

◆ ksReducePolyTailLC_Z()

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

Definition at line 1109 of file kInline.h.

1110{
1111 BOOLEAN ret;
1112 number mult, rest;
1113 TObject red = *PW;
1114 red.Copy();
1115 rest = n_QuotRem(pGetCoeff(Red->p), pGetCoeff(red.p),
1116 &mult, currRing->cf);
1117 red.Mult_nn(rest);
1118
1119 assume(PR->GetLmCurrRing() != red.GetLmCurrRing());
1120 ret = ksReducePolyLC(Red, &red, NULL, &mult);
1121 red.Delete();
1122 red.Clear();
1123
1124 return ret;
1125}
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition: coeffs.h:678
int ksReducePolyLC(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:481
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 1214 of file kInline.h.

1215{
1216 LObject L(p);
1217 return redtailBba(&L, pos, strat,FALSE, normalize);
1218}
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1214
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_Ring()

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

Definition at line 1227 of file kInline.h.

1228{
1229 LObject L(p, currRing, strat->tailRing);
1230 return redtailBba_Ring(&L, pos, strat);
1231}
ring tailRing
Definition: kutil.h:343
KINLINE poly redtailBba_Ring(poly p, int pos, kStrategy strat)
Definition: kInline.h:1227

◆ redtailBba_Z()

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

Definition at line 1232 of file kInline.h.

1233{
1234 LObject L(p, currRing, strat->tailRing);
1235 return redtailBba_Z(&L, pos, strat);
1236}
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1232

◆ redtailBbaBound()

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

Definition at line 1220 of file kInline.h.

1221{
1222 LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1223 return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1224}
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:1220