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

1256{
1257 return FALSE;
1258}
#define FALSE
Definition auxiliary.h:97

◆ clearS()

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

Definition at line 1232 of file kInline.h.

1234{
1235 assume(p_sev == pGetShortExpVector(p));
1236 if (strat->noClearS) return;
1238 {
1239 if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
1240 return;
1241 if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
1242 return;
1243 }
1244 else
1245 {
1246 if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
1247 }
1248 deleteInS((*at),strat);
1249 (*at)--;
1250 (*k)--;
1251}
int p
Definition cfModGcd.cc:4086
polyset S
Definition kutil.h:307
char noClearS
Definition kutil.h:401
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:748
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:147
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition polys.h:153
#define rField_is_Ring(R)
Definition ring.h:491

◆ 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:34
class sTObject TObject
Definition kutil.h:58
#define omAlloc0(size)

◆ 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:60

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

1017{
1018 p_LmCheckPolyRing(p1, p_r);
1019 p_LmCheckPolyRing(p2, p_r);
1020
1021 int i;
1022 long x;
1023 m1 = p_Init(m_r,m_r->PolyBin);
1024 m2 = p_Init(m_r,m_r->PolyBin);
1025
1026 for (i = p_r->N; i; i--)
1027 {
1028 x = p_GetExpDiff(p1, p2, i, p_r);
1029 if (x > 0)
1030 {
1031 if (x > (long) m_r->bitmask) goto false_return;
1032 p_SetExp(m2,i,x, m_r);
1033 p_SetExp(m1,i,0, m_r);
1034 }
1035 else
1036 {
1037 if (-x > (long) m_r->bitmask) goto false_return;
1038 p_SetExp(m1,i,-x, m_r);
1039 p_SetExp(m2,i,0, m_r);
1040 }
1041 }
1042
1043 p_Setm(m1, m_r);
1044 p_Setm(m2, m_r);
1045 return TRUE;
1046
1047 false_return:
1048 p_LmFree(m1, m_r);
1049 p_LmFree(m2, m_r);
1050 m1 = m2 = NULL;
1051 return FALSE;
1052}
#define TRUE
Definition auxiliary.h:101
Variable x
Definition cfModGcd.cc:4090
#define NULL
Definition omList.c:12
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition p_polys.h:637
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:490
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
static void p_LmFree(poly p, ring)
Definition p_polys.h:685
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1336

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

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

◆ k_LmInit_currRing_2_tailRing() [1/2]

KINLINE poly k_LmInit_currRing_2_tailRing ( poly p,
ring tailRing )

Definition at line 988 of file kInline.h.

989{
990 return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
991}
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition kInline.h:956

◆ k_LmInit_currRing_2_tailRing() [2/2]

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

Definition at line 956 of file kInline.h.

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

◆ k_LmInit_tailRing_2_currRing() [1/2]

KINLINE poly k_LmInit_tailRing_2_currRing ( poly p,
ring tailRing )

Definition at line 993 of file kInline.h.

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

◆ k_LmInit_tailRing_2_currRing() [2/2]

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

Definition at line 965 of file kInline.h.

966{
967 poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
968 pNext(p) = pNext(t_p);
969 pSetCoeff0(p, pGetCoeff(t_p));
970 return p;
971}

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing ( poly p,
ring tailRing )

Definition at line 998 of file kInline.h.

999{
1000 return k_LmShallowCopyDelete_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
1001}
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition kInline.h:974

◆ k_LmShallowCopyDelete_currRing_2_tailRing() [2/2]

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

Definition at line 974 of file kInline.h.

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

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing ( poly p,
ring tailRing )

Definition at line 1003 of file kInline.h.

1004{
1005 return k_LmShallowCopyDelete_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
1006}
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition kInline.h:981

◆ k_LmShallowCopyDelete_tailRing_2_currRing() [2/2]

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

Definition at line 981 of file kInline.h.

982{
983 poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
984 p_LmFree(p, tailRing);
985 return np;
986}

◆ ksOldCreateSpoly()

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

Definition at line 1191 of file kInline.h.

1192{
1193 LObject L(r);
1194 L.p1 = p1;
1195 L.p2 = p2;
1196
1197 ksCreateSpoly(&L, spNoether);
1198 return L.GetLmCurrRing();
1199}
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition kspoly.cc:1203
class sLObject LObject
Definition kutil.h:59

◆ ksOldSpolyRed()

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

Definition at line 1171 of file kInline.h.

1172{
1173 LObject L(p2);
1174 TObject T(p1);
1175
1176 ksReducePoly(&L, &T, spNoether);
1177
1178 return L.GetLmCurrRing();
1179}
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, poly *mon, kStrategy strat, BOOLEAN reduce)
Definition kspoly.cc:187

◆ ksOldSpolyRedNew()

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

Definition at line 1181 of file kInline.h.

1182{
1183 LObject L(p_Copy(p2, currRing));
1184 TObject T(p1);
1185
1186 ksReducePoly(&L, &T, spNoether);
1187
1188 return L.GetLmCurrRing();
1189}
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848

◆ ksOldSpolyTail()

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

Definition at line 1201 of file kInline.h.

1202{
1203 LObject L(q, currRing, r);
1204 TObject T(p1, currRing, r);
1205
1206 ksReducePolyTail(&L, &T, q2, spNoether);
1207}
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition kInline.h:1144

◆ ksReducePolyTail()

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

Definition at line 1144 of file kInline.h.

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

◆ ksReducePolyTail_Z()

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

Definition at line 1122 of file kInline.h.

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

◆ ksReducePolyTailLC_Z()

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

Definition at line 1104 of file kInline.h.

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

1210{
1211 LObject L(p);
1212 return redtailBba(&L, pos, strat,FALSE, normalize);
1213}
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition kInline.h:1209
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 1221 of file kInline.h.

1222{
1223 LObject L(p, currRing, strat->tailRing);
1224 return redtailBba_Ring(&L, pos, strat);
1225}
ring tailRing
Definition kutil.h:344
KINLINE poly redtailBba_Ring(poly p, int pos, kStrategy strat)
Definition kInline.h:1221

◆ redtailBba_Z()

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

Definition at line 1226 of file kInline.h.

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

◆ redtailBbaBound()

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

Definition at line 1215 of file kInline.h.

1216{
1217 LObject L(p, currRing, strat->tailRing); // ? L(p); ??
1218 return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
1219}
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:1215