Loading...
Searching...
No Matches
janet.cc
Go to the documentation of this file.
#include "kernel/mod2.h"
#include "coeffs/numbers.h"
#include "polys/monomials/ring.h"
#include "polys/monomials/p_polys.h"
#include "polys/kbuckets.h"
#include "kernel/ideals.h"
#include "kernel/polys.h"
#include "kernel/GBEngine/kutil.h"
#include "kernel/GBEngine/janet.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <time.h>
#if (defined(__CYGWIN__))
#include <ctype.h>
#endif
//------GLOBALS-------
STATIC_VAR int /*m_s,v_s,vectorized,VarN1,*/offset;
STATIC_VAR jList *T,*Q;
STATIC_VAR TreeM *G;
// static Poly *phD;
STATIC_VAR NodeM *FreeNodes;
STATIC_VAR int degree_compatible;
STATIC_VAR int (*ListGreatMove)(jList *,jList *,poly);
STATIC_VAR int Mask[8]={0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1};
//#define DebugPrint
//#define pow_(x) pTotaldegree((x))
//#define pow_(x) p_Deg((x,currRing))
VAR pFDegProc jDeg;
#define pow_(x) jDeg((x),currRing)
#if 0
void Debug()
{
LCI it=T->root;
PrintS("T==================================\n");
while (it)
{
pWrite(it->info->root);
it=it->next;
}
it=Q->root;
PrintS("Q==================================\n");
while (it)
{
if (it->info->root) pWrite(it->info->root);
else
{
Print("%d.........",it->info->prolonged);
pWrite(it->info->history);
}
it=it->next;
}
PrintS("===================================\n");
}
#endif
int ReducePolyLead(Poly *x,Poly *y)
{
if (!x->root || !y->root)
return 0;
/* poly b1=pMDivide(x->root,y->root);
number gcd=n_Gcd(pGetCoeff(x->root),pGetCoeff(y->root),currRing->cf);
number a1=nDiv(pGetCoeff(y->root),gcd);
pGetCoeff(b1)=nDiv(pGetCoeff(x->root),gcd);
x->root=pMult_nn(x->root,a1);
nDelete(&a1);
x->root=pMinus_mm_Mult_qq(x->root,b1,y->root);
pDelete(&b1);
*/
#if 1
if (x->root_b==NULL)
{
if (x->root_l<=0) x->root_l=pLength(x->root);
x->root_b=kBucketCreate(currRing);
kBucketInit(x->root_b,x->root,x->root_l);
}
number coef;
if (y->root_l<=0) y->root_l=pLength(y->root);
coef=kBucketPolyRed(x->root_b,y->root,y->root_l,NULL);
nDelete(&coef);
x->root=kBucketGetLm(x->root_b);
if (x->root==NULL)
{
kBucketDestroy(&x->root_b);
x->root_b=NULL;
x->root_l=0;
}
#else
x->root=ksOldSpolyRed(y->root,x->root,NULL);
#endif
// if (x->root) p_SimpleContent(x->root,5,currRing);
return 1;
}
int ReducePoly(Poly *x,poly from,Poly *y)
{
if (!x->root || !y->root)
return 0;
/* poly b1=pMDivide(from,y->root);
number gcd=n_Gcd(pGetCoeff(from),pGetCoeff(y->root),currRing->cf);
number a1=nDiv(pGetCoeff(y->root),gcd);
pGetCoeff(b1)=nDiv(pGetCoeff(from),gcd);
x->root=pMult_nn(x->root,a1);
nDelete(&a1);*/
// x->root=pMinus_mm_Mult_qq(x->root,b1,y->root);
// pDelete(&b1);
ksOldSpolyTail(y->root,x->root,from,NULL,currRing);
y->root_l=0;
return 1;
}
void PNF(Poly *p, TreeM *F)
{
if (p->root==NULL) return;
Poly *f;
BOOLEAN done=FALSE;
poly temp=p->root;
// if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
int count=0;
poly pp=p->root;
int old_size=nSize(pGetCoeff(pp));
p->root_l=0;
while(temp->next)
{
f=is_div_(F,temp->next);
if (f)
{
if (ReducePoly(p,temp,f)) //temp->next
{
count++;
//if (TEST_OPT_PROT) { PrintS("-"); mflush(); }
if ((f!=NULL)
&& (count>20)
&& (nSize(pGetCoeff(pp))>old_size)
)
{
p_SimpleContent(pp,1,currRing);
//p_Content(pp,currRing);
count=0;
// old_size=nSize(pGetCoeff(pp));
}
}
done=TRUE;
}
else
temp=temp->next;
}
if (done) p_ContentForGB(p->root,currRing);
//if (done) p_SimpleContent(p->root,-1,currRing);
pTest(p->root);
}
void NFL(Poly *p, TreeM *F)
{
Poly *f;
// int g1,f1,gg;
if ((f=is_div_(F,p->lead))==NULL) return;
int pX=pow_(p->lead);
int phX=pow_(p->history);
if (pX!=phX)
{
int phF=pow_(f->history);
if (pX >= (phX+phF))
{
pDelete(&p->root);
//p->root=NULL;
return;
}
/* poly p2=pInit();
pLcm(p->history,f->history,p2);
pSetm(p2);
if (pLmCmp(p->root,p2) > 0)
{
pLmDelete(&p2);
pDelete(&p->root);
//p->root=NULL;
return;
}
pLmDelete(&p2);
*/
/* for(int i=0, gg=0 ; i<currRing->N;i++)
if ((g1=pGetExp(p->history,i+1)) > (f1=pGetExp(f->history,i+1)))
gg+=g1;
else gg+=f1;
if (pX > gg)
{
pDelete(&p->root);
//x->root=NULL;
return;
}
*/
int pF=pow_(f->lead);
if ((pX == pF) && (pF == phF))
{
pLmFree(&f->history);
if (p->history!=NULL)
f->history=p_Copy_noCheck(p->history,currRing); /* cf of p->history is NULL */
}
}
//if (TEST_OPT_PROT) { PrintS("R"); mflush(); }
int /*old_size, */count;
count=0;
while(f && p->root)
{
// PrintS("R");
// if (TEST_OPT_PROT) { PrintS("R"); mflush(); }
#if 0
old_size=nSize(pGetCoeff(p->root));
#endif
if (ReducePolyLead(p,f) == 0) break;
if (p->root!=NULL)
{
count++;
#if 0
if ((count>4) && (3<nSize(pGetCoeff(p->root)))
&& (nSize(pGetCoeff(p->root))>old_size))
{
p_SimpleContent(p->root,old_size,currRing);
count=0;
}
#else
if (count>50)
{
kBucketClear(p->root_b,&p->root,&p->root_l);
p_SimpleContent(p->root,2,currRing);
kBucketInit(p->root_b,p->root,p->root_l);
count=0;
//PrintS(".");
}
#endif
f=is_div_(F,p->root);
}
}
#if 1
if (p->root_b!=NULL)
{
kBucketClear(p->root_b,&p->root,&p->root_l);
kBucketDestroy(&p->root_b);
p->root_b=NULL;
}
#endif
if (!p->root)
return;
InitHistory(p);
InitProl(p);
InitLead(p);
p->changed=1;
p_ContentForGB(p->root,currRing);
//p_SimpleContent(p->root,-1i,currRing);
pTest(p->root);
}
int ValidatePoly(Poly *x, TreeM */*F*/)
{
Poly /*f,*/*g;
// int g1,f1;
if (x->root) return 1;
g=is_present(T,x->history); //it's a prolongation - do we have a parent ?
if (!g) return 0; //if not - kill him !
poly lmX=pMDivide(x->lead,g->root);
pSetCoeff0(lmX,nInit(1));
/* if ((f=is_div_(F,lmX)) != NULL)
{
int pX=pow_(lmX);
int phX=pow_(x->history);
if (pX!=phX)
{
int phF=pow_(f->history);
if (pX >= (phX+phF))
{
pLmDelete(&lmX);
//x->root=NULL;
return 0;
}
for(int i=0, gg=0 ; i<currRing->N;i++)
if ((g1=pGetExp(x->history,i+1)) > (f1=pGetExp(f->history,i+1)))
gg+=g1;
else
gg+=f1;
if (pX > gg)
{
pLmDelete(&lmX);
return 0;
}
int pF=pow_(f->root);
if ((pX == pF) && (pF == phF))
f->history=x->history;
}
}
pLmDelete(&lmX);
*/
x->root=pCopy(g->root);
x->root_l=g->root_l;
x->root=pMult(x->root,lmX);
pTest(x->root);
x->prolonged=-1;
return 1;
}
Poly *NewPoly(poly p)
{
Poly *beg=(Poly *)GCM(sizeof(Poly));
beg->root=p;//(p == NULL ? pInit() : p);
beg->root_b=NULL;
beg->root_l=0;
beg->history=NULL;//pInit();
beg->lead=NULL;
beg->mult=(char *)GCMA(sizeof(char)*2*offset);
for (int i=0; i < currRing->N; i++)
{
ClearMult(beg,i);
ClearProl(beg,i);
};
beg->prolonged=-1;
return beg;
}
void DestroyPoly(Poly *x)
{
pDelete(&x->root);
pLmFree(&x->history);
if (x->lead!=NULL) pLmFree(&x->lead);
GCF(x->mult);
GCF(x);
}
void ControlProlong(Poly *x)
{
for (int i = 0; i< offset; i++)
{
(x->mult+offset)[i]&=~((x->mult)[i]);
// if (!GetMult(x,i) && !GetProl(x,i))
// ProlVar(x,i);
}
}
void InitHistory(Poly *p)
{
if (p->history) pLmFree(&p->history);
p->history=pLmInit(p->root);
p->changed=0;
}
void InitLead(Poly *p)
{
if (p->lead!=NULL) pLmFree(&p->lead);
p->lead=pLmInit(p->root);
p->prolonged=-1;
}
void InitProl(Poly *p)
{
memset(p->mult+offset,0,sizeof(char)*offset);
}
int GetMult(Poly *x,int i)
{
return x->mult[i/8] & Mask[i%8];
}
void SetMult(Poly *x,int i)
{
x->mult[i/8] |= Mask[i%8];
}
void ClearMult(Poly *x,int i)
{
x->mult[i/8] &= ~Mask[i%8];
}
int GetProl(Poly *x, int i)
{
return (x->mult+offset)[i/8] & Mask[i%8];
}
void SetProl(Poly *x, int i)
{
(x->mult+offset)[i/8] |= Mask[i%8];
}
void ClearProl(Poly *x, int i)
{
(x->mult+offset)[i/8] &= ~Mask[i%8];
}
int LengthCompare(poly p1,poly p2)
{
do
{
if (p1 == NULL) return 1;
if (p2 == NULL) return 0;
pIter(p1);
pIter(p2);
}while(p1 && p2);
return 1;
}
int ProlCompare(Poly *item1, Poly *item2)
{
switch(pLmCmp(item1->lead,item2->lead))
{
case -1:
return 1;
case 1:
return 0;
default:
if ((item1->root_l<=0)||(item2->root_l<=0))
return LengthCompare(item1->root,item2->root);
return item1->root_l<=item2->root_l;
}
}
void ProlVar(Poly *temp,int i)
{
Poly *Pr;
if (!GetProl(temp,i) && !GetMult(temp,i))
{
Pr=NewPoly();
SetProl(temp,i);
Pr->prolonged=i;
Pr->history=pLmInit(temp->history);
Pr->lead=pLmInit(temp->lead);
pIncrExp(Pr->lead,i+1);
pSetm(Pr->lead);
InitProl(temp);
Pr->changed=0;
// pTest(Pr->root);
InsertInCount(Q,Pr);
}
}
void DestroyListNode(ListNode *x)
{
DestroyPoly(x->info);
GCF(x);
}
ListNode* CreateListNode(Poly *x)
{
ListNode* ret=(ListNode *)GCM(sizeof(ListNode));
ret->info=x;
ret->next=NULL;
return ret;
}
Poly *FindMinList(jList *L)
{
LI min=&(L->root);
LI l;
LCI xl;
Poly *x;
if (degree_compatible)
{
while ((*min) && ((*min)->info->root == NULL))
min=&((*min)->next);
}
if (!(*min)) return NULL;
l=&((*min)->next);
while (*l)
{
if ((*l)->info->root != NULL)
{
if (ProlCompare((*l)->info,(*min)->info))
min=l;
}
l=&((*l)->next);
}
x=(*min)->info;
xl=*min;
*min=(*min)->next;
GCF(xl);
return x;
}
void InsertInList(jList *x,Poly *y)
{
ListNode *ins;
LI ix=&(x->root);
while (*ix)
{
if (pLmCmp(y->lead,(*ix)->info->lead) == -1)
ix=(ListNode **)&((*ix)->next);
else
break;
}
ins=CreateListNode(y);
ins->next=(ListNode *)(*ix);
*ix=ins;
return;
}
void InsertInCount(jList *x,Poly *y)
{
ListNode *ins;
LI ix=&(x->root);
ins=CreateListNode(y);
ins->next=(ListNode *)(*ix);
*ix=ins;
return;
}
int ListGreatMoveOrder(jList *A,jList *B,poly x)
{
LCI y=A->root;
if (!y || pLmCmp(y->info->lead,x) < 0) return 0;
while(y && pLmCmp(y->info->lead,x) >= 0)
{
InsertInCount(B,y->info);
A->root=y->next;
GCF(y);
y=A->root;
}
return 1;
}
int ListGreatMoveDegree(jList *A,jList *B,poly x)
{
LCI y=A->root;
int pow_x=pow_(x);
if (!y || pow_(y->info->lead) <= pow_x) return 0;
while(y && pow_(y->info->lead) > pow_x)
{
InsertInCount(B,y->info);
A->root=y->next;
GCF(y);
y=A->root;
}
return 1;
}
int CountList(jList *Q)
{
int i=0;
LCI y=Q->root;
while(y)
{
i++;
y=y->next;
}
return i;
}
void NFListQ()
{
LCI ll;
int p,p1;
LI l;
do
{
if (!Q->root) break;
ll=Q->root;
p=pow_(Q->root->info->lead);
while (ll)
{
int ploc=pow_(ll->info->lead);
if (ploc < p) p=ploc;
ll=ll->next;
}
p1=1;
l=&(Q->root);
while (*l)
{
// PrintS("*");
int ploc=pow_((*l)->info->lead);
if (ploc == p)
{
if (!ValidatePoly((*l)->info,G))
{
ll=(*l);
*l=(*l)->next;
DestroyListNode(ll);
continue;
};
(*l)->info->changed=0;
// PrintS("!");
NFL((*l)->info,G);
// PrintS("$");
if (!(*l)->info->root)
{
ll=(*l);
*l=(*l)->next;
DestroyListNode(ll);
continue;
};
p1=0;
}
l=&((*l)->next);
}
}while(p1);
// PrintLn();
}
void ForEachPNF(jList *x,int i)
{
LCI y=x->root;
while(y)
{
if (pow_(y->info->root) == i) PNF(y->info,G);
y=y->next;
}
}
void ForEachControlProlong(jList *x)
{
LCI y=x->root;
while(y)
{
ControlProlong(y->info);
y=y->next;
}
}
void DestroyList(jList *x)
{
LCI y=x->root,z;
while(y)
{
z=y->next;
DestroyPoly(y->info);
GCF(y);
y=z;
}
GCF(x);
}
Poly* is_present(jList *F,poly x)
{
LCI iF=F->root;
while(iF)
if (pLmCmp(iF->info->root,x) == 0)
return iF->info;
else iF=iF->next;
return NULL;
}
int GB_length()
{
LCI iT=T->root;
int l=0;
while(iT)
{
if (pow_(iT->info->lead) == pow_(iT->info->history))
++l;
iT=iT->next;
}
return l;
}
STATIC_VAR Poly *temp_l;
NodeM* create()
{
NodeM *y;
if (FreeNodes == NULL)
{
y=(NodeM *)GCM(sizeof(NodeM));
}
else
{
y=FreeNodes;
FreeNodes=FreeNodes->left;
}
y->left=y->right=NULL;
y->ended=NULL;
return y;
}
void DestroyFreeNodes()
{
NodeM *y;
while((y=FreeNodes)!=NULL)
{
FreeNodes=FreeNodes->left;
GCF(y);
}
}
#if 0
static void go_right(NodeM *current,poly_function disp)
{
if (current)
{
go_right(current->left,disp);
if (current->ended) disp(current->ended);
go_right(current->right,disp);
}
}
void ForEach(TreeM *t,poly_function disp)
{
go_right(t->root,disp);
}
#endif
void DestroyTree(NodeM *G)
{
if (G)
{
DestroyTree(G->left);
DestroyTree(G->right);
G->left=FreeNodes;
FreeNodes=G;
}
}
void Define(TreeM **G)
{
*G=(TreeM *)GCM(sizeof(TreeM));
(*G)->root=create();
}
int sp_div(poly m1,poly m2,int from)
{
if (pow_(m2) == 0 && pow_(m1)) return 0;
for(int k=from; k < currRing->N; k++)
if (pGetExp(m1,k+1) < pGetExp(m2,k+1)) return 0;
return 1;
}
void div_l(poly item, NodeM *x,int from)
{
if (x && !temp_l)
{
div_l(item,x->left,from);
if ((x->ended) && sp_div(item,x->ended->root,from))
{
temp_l=x->ended;
return;
};
div_l(item,x->right,from);
}
}
Poly* is_div_upper(poly item, NodeM *x,int from)
{
temp_l=NULL;
div_l(item,x,from);
return temp_l;
}
Poly* is_div_(TreeM *tree, poly item)
{
int power_tmp,i,i_con=currRing->N-1;
NodeM *curr=tree->root;
if (!curr) return NULL;
if (pow_(item) == 0) return NULL;
for ( ; i_con>=0 && !pGetExp(item,i_con+1) ; i_con--)
;
for (i=0; i <= i_con ; i++)
{
power_tmp=pGetExp(item,i+1);
while (power_tmp)
{
if (curr->ended) return curr->ended;
if (!curr->left)
{
if (curr->right)
return is_div_upper(item,curr->right,i); //??????
return NULL;
}
curr=curr->left;
power_tmp--;
}
if (curr->ended) return curr->ended;
if (!curr->right) return NULL;
curr=curr->right;
}
if (curr->ended) return curr->ended;
else return NULL;
}
static void ClearMultiplicative(NodeM *xx,int i)
{
if (!xx) return;
while (xx->left)
{
ClearMultiplicative(xx->right, i);
xx = xx->left;
}
if ((xx->ended) && (GetMult(xx->ended,i)))
{
ClearMult(xx->ended,i);
ProlVar(xx->ended,i);
}
else
ClearMultiplicative(xx->right,i);
}
//======================================================
void insert_(TreeM **tree, Poly *item)
{
int power_tmp,i,i_con=currRing->N-1;
NodeM *curr=(*tree)->root;
for ( ; (i_con>=0) && !pGetExp(item->root,i_con+1) ; i_con--)
SetMult(item,i_con);
for (i = 0; i<= i_con; i++)
//<=
{
power_tmp=pGetExp(item->root,i+1);
ClearMult(item,i);
while (power_tmp)
{
if (!curr->left)
{
SetMult(item,i);
ClearMultiplicative(curr->right,i);
curr->left=create();
};
curr=curr->left;
power_tmp--;
};
if (i<i_con)
{
if (!curr->left) SetMult(item,i);
if (!curr->right) curr->right=create();
curr=curr->right;
ProlVar(item,i);
}
}
curr->ended=item;
}
void Initialization(char *Ord)
{
offset=(currRing->N % 8 == 0) ? (currRing->N/8)*8 : (currRing->N/8+1)*8;
if (strstr(Ord,"dp\0") || strstr(Ord,"Dp\0"))
{
degree_compatible=1;
jDeg=p_Deg;
ListGreatMove=ListGreatMoveDegree;
}
else
{
degree_compatible=0;
jDeg=p_Totaldegree;
ListGreatMove=ListGreatMoveOrder;
}
Define(&G);
}
STATIC_VAR Poly *h/*,*f*/;
#if 0
void insert_in_G(Poly *x)
{
insert_(&G,x);
}
#endif
void T2G();
#if 0
void Q2TG()
{
LCI t;
Poly *x;
while (Q->root)
{
t=Q->root;
x=t->info;
insert_(&G,x);
InsertInList(T,x);
Q->root=t->next;
GCF(t);
}
}
#endif
int ComputeBasis(jList *_lT,jList *_lQ)
{
// int gb_l,i,ret_value=1;
T=_lT; Q=_lQ;
// Debug();
while((h=FindMinList(Q))!=NULL)
{
// PrintS("New element\n");
// Debug();
if (!degree_compatible)
{
if (!ValidatePoly(h,G))
{
DestroyPoly(h);
continue;
}
h->changed=0;
NFL(h,G);
if (!h->root)
{
DestroyPoly(h);
continue;
}
}
if (h->root)
{
if (pIsConstant(h->root))
{
WarnS("Constant in basis\n");
return 0;
}
if (h->changed && ListGreatMove(T,Q,h->root))
{
// PrintS("<-\n");
DestroyTree(G->root);
G->root=create();
T2G();
}
}
// PrintS("PNF\n");
PNF(h,G);
// Print("{%d}\n",pow_(h->root));
insert_(&G,h);
InsertInList(T,h);
// PrintS("For each PNF\n");
if (degree_compatible)
ForEachPNF(T,pow_(h->root));
// PrintS("Control of prolongations\n");
if (h->changed)
ForEachControlProlong(T);
else
ControlProlong(h);
// Debug();
// PrintS("NFListQ\n");
if (degree_compatible)
NFListQ();
//Debug();
}
// gb_l=GB_length();
Print("Length of Janet basis: %d\n",CountList(T));
// Print("Length of Groebner basis: %d\n",gb_l);
DestroyTree(G->root);
GCF(G);
DestroyFreeNodes();
return 1;
}
void T2G()
{
LCI i=T->root;
while (i)
{
insert_(&G,i->info);
i=i->next;
}
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
pp
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f ).
Definition cf_gcd.cc:676
l
int l
Definition cfEzgcd.cc:100
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
x
Variable x
Definition cfModGcd.cc:4090
p
int p
Definition cfModGcd.cc:4086
g
g
Definition cfModGcd.cc:4098
f
FILE * f
Definition checklibs.c:9
Print
#define Print
Definition emacs.cc:80
WarnS
#define WarnS
Definition emacs.cc:78
y
const CanonicalForm int const CFList const Variable & y
Definition facAbsFact.cc:53
B
b *CanonicalForm B
Definition facBivar.cc:52
min
static int min(int a, int b)
Definition fast_mult.cc:268
STATIC_VAR
#define STATIC_VAR
Definition globaldefs.h:7
VAR
#define VAR
Definition globaldefs.h:5
ideals.h
create
NodeM * create()
Definition janet.cc:757
InitLead
void InitLead(Poly *p)
Definition janet.cc:409
Mask
STATIC_VAR int Mask[8]
Definition janet.cc:36
offset
STATIC_VAR int offset
Definition janet.cc:29
T
STATIC_VAR jList * T
Definition janet.cc:30
InitHistory
void InitHistory(Poly *p)
Definition janet.cc:402
CreateListNode
ListNode * CreateListNode(Poly *x)
Definition janet.cc:508
ReducePolyLead
int ReducePolyLead(Poly *x, Poly *y)
Definition janet.cc:74
ComputeBasis
int ComputeBasis(jList *_lT, jList *_lQ)
Definition janet.cc:1000
jDeg
VAR pFDegProc jDeg
Definition janet.cc:42
is_div_upper
Poly * is_div_upper(poly item, NodeM *x, int from)
Definition janet.cc:846
ListGreatMoveOrder
int ListGreatMoveOrder(jList *A, jList *B, poly x)
Definition janet.cc:582
G
STATIC_VAR TreeM * G
Definition janet.cc:31
DestroyList
void DestroyList(jList *x)
Definition janet.cc:714
ForEachControlProlong
void ForEachControlProlong(jList *x)
Definition janet.cc:703
pow_
#define pow_(x)
Definition janet.cc:43
T2G
void T2G()
Definition janet.cc:1085
DestroyTree
void DestroyTree(NodeM *G)
Definition janet.cc:804
ClearMultiplicative
static void ClearMultiplicative(NodeM *xx, int i)
Definition janet.cc:894
sp_div
int sp_div(poly m1, poly m2, int from)
Definition janet.cc:821
ValidatePoly
int ValidatePoly(Poly *x, TreeM *)
Definition janet.cc:299
CountList
int CountList(jList *Q)
Definition janet.cc:617
GetProl
int GetProl(Poly *x, int i)
Definition janet.cc:436
ClearMult
void ClearMult(Poly *x, int i)
Definition janet.cc:431
ControlProlong
void ControlProlong(Poly *x)
Definition janet.cc:392
InitProl
void InitProl(Poly *p)
Definition janet.cc:416
InsertInList
void InsertInList(jList *x, Poly *y)
Definition janet.cc:552
DestroyListNode
void DestroyListNode(ListNode *x)
Definition janet.cc:502
DestroyFreeNodes
void DestroyFreeNodes()
Definition janet.cc:776
div_l
void div_l(poly item, NodeM *x, int from)
Definition janet.cc:832
h
STATIC_VAR Poly * h
Definition janet.cc:971
ClearProl
void ClearProl(Poly *x, int i)
Definition janet.cc:446
Define
void Define(TreeM **G)
Definition janet.cc:815
ReducePoly
int ReducePoly(Poly *x, poly from, Poly *y)
Definition janet.cc:119
InsertInCount
void InsertInCount(jList *x, Poly *y)
Definition janet.cc:571
ForEachPNF
void ForEachPNF(jList *x, int i)
Definition janet.cc:692
NewPoly
Poly * NewPoly(poly p)
Definition janet.cc:361
FindMinList
Poly * FindMinList(jList *L)
Definition janet.cc:517
NFL
void NFL(Poly *p, TreeM *F)
Definition janet.cc:187
SetMult
void SetMult(Poly *x, int i)
Definition janet.cc:426
FreeNodes
STATIC_VAR NodeM * FreeNodes
Definition janet.cc:33
degree_compatible
STATIC_VAR int degree_compatible
Definition janet.cc:34
Initialization
void Initialization(char *Ord)
Definition janet.cc:952
is_present
Poly * is_present(jList *F, poly x)
Definition janet.cc:729
SetProl
void SetProl(Poly *x, int i)
Definition janet.cc:441
is_div_
Poly * is_div_(TreeM *tree, poly item)
Definition janet.cc:853
ListGreatMoveDegree
int ListGreatMoveDegree(jList *A, jList *B, poly x)
Definition janet.cc:599
PNF
void PNF(Poly *p, TreeM *F)
Definition janet.cc:143
ProlVar
void ProlVar(Poly *temp, int i)
Definition janet.cc:480
GB_length
int GB_length()
Definition janet.cc:740
NFListQ
void NFListQ()
Definition janet.cc:631
LengthCompare
int LengthCompare(poly p1, poly p2)
Definition janet.cc:451
ListGreatMove
STATIC_VAR int(* ListGreatMove)(jList *, jList *, poly)
Definition janet.cc:35
ProlCompare
int ProlCompare(Poly *item1, Poly *item2)
Definition janet.cc:463
GetMult
int GetMult(Poly *x, int i)
Definition janet.cc:421
temp_l
STATIC_VAR Poly * temp_l
Definition janet.cc:755
insert_
void insert_(TreeM **tree, Poly *item)
Definition janet.cc:912
janet.h
ListNode
#define ListNode
Definition janet.h:10
NodeM
#define NodeM
Definition janet.h:12
TreeM
#define TreeM
Definition janet.h:11
jList::root
ListNode * root
Definition janet.h:36
GCF
#define GCF(x)
Definition janet.h:8
LI
ListNode ** LI
Definition janet.h:51
LCI
ListNode * LCI
Definition janet.h:50
GCMA
#define GCMA(sz)
Definition janet.h:7
GCM
#define GCM(sz)
Definition janet.h:6
poly_function
void(* poly_function)(Poly *)
Definition janet.h:26
DestroyPoly
void DestroyPoly()
jList
Definition janet.h:35
ksOldSpolyTail
void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether, ring r)
Definition kInline.h:1204
ksOldSpolyRed
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition kInline.h:1174
kBucketClear
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition kbuckets.cc:521
kBucketDestroy
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition kbuckets.cc:216
kBucketInit
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition kbuckets.cc:493
kBucketCreate
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition kbuckets.cc:209
kBucketPolyRed
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition kbuckets.cc:1071
kBucketGetLm
const poly kBucketGetLm(kBucket_pt bucket)
Definition kbuckets.cc:506
kbuckets.h
kutil.h
mod2.h
pIter
#define pIter(p)
Definition monomials.h:37
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
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:44
numbers.h
nDelete
#define nDelete(n)
Definition numbers.h:16
nSize
#define nSize(n)
Definition numbers.h:39
nInit
#define nInit(i)
Definition numbers.h:24
NULL
#define NULL
Definition omList.c:12
p_SimpleContent
void p_SimpleContent(poly ph, int smax, const ring r)
Definition p_polys.cc:2612
p_Deg
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586
p_ContentForGB
void p_ContentForGB(poly ph, const ring r)
Definition p_polys.cc:2403
p_polys.h
pLength
static int pLength(poly a)
Definition p_polys.h:190
p_Copy_noCheck
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
Definition p_polys.h:838
p_Totaldegree
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1528
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
polys.h
Compatibility layer for legacy polynomial operations (over currRing).
pTest
#define pTest(p)
Definition polys.h:415
pDelete
#define pDelete(p_ptr)
Definition polys.h:187
pSetm
#define pSetm(p)
Definition polys.h:272
pIsConstant
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239
pLmInit
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition polys.h:65
pIncrExp
#define pIncrExp(p, i)
Definition polys.h:44
pMult
#define pMult(p, q)
Definition polys.h:208
pLmFree
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition polys.h:71
pWrite
void pWrite(poly p)
Definition polys.h:309
pGetExp
#define pGetExp(p, i)
Exponent.
Definition polys.h:42
pLmCmp
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition polys.h:106
pMDivide
#define pMDivide(a, b)
Definition polys.h:294
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
ring.h
pFDegProc
long(* pFDegProc)(poly p, ring r)
Definition ring.h:39
count
int status int void size_t count
Definition si_signals.h:69
A
#define A
Definition sirandom.c:24
Q
#define Q
Definition sirandom.c:26
Poly
Definition janet.h:15
Poly::mult
char * mult
Definition janet.h:21
Poly::history
poly history
Definition janet.h:19
Poly::root_b
kBucket_pt root_b
Definition janet.h:17
Poly::root_l
int root_l
Definition janet.h:18
Poly::lead
poly lead
Definition janet.h:20
Poly::changed
int changed
Definition janet.h:22
Poly::root
poly root
Definition janet.h:16
Poly::prolonged
int prolonged
Definition janet.h:23