Loading...
Searching...
No Matches
janet.h File Reference
`#include "kernel/structs.h"`

Go to the source code of this file.

## Data Structures

class | Poly
struct | jList

## Macros

#define | GCM(sz)
#define | GCMA(sz)
#define | GCF(x)
#define | ListNode struct LISTNODE
#define | TreeM struct TREEM
#define | NodeM struct NODEM

## Typedefs

typedef void(* | poly_function) (Poly *)
typedef ListNode * | LCI
typedef ListNode ** | LI

## Functions

Poly * | FindMinList (jList *)
void | DestroyTree (NodeM *)
NodeM * | create ()
void | ControlProlong (Poly *)
Poly * | is_div_ (TreeM *root, poly item)
void | insert_ (TreeM **tree, Poly *item)
Poly * | NewPoly (poly p=NULL)
void | DestroyPoly ()
void | NFL (Poly *, TreeM *)
void | PNF (Poly *, TreeM *)
void | ClearProl (Poly *x, int i)
void | InitProl (Poly *p)
void | InitHistory (Poly *p)
Poly * | is_present (jList *, poly)
int | GetMult (Poly *, int)
int | GB_length ()
void | InsertInList (jList *, Poly *)
void | ForEachPNF (jList *, int)
void | ClearMult (Poly *, int)
void | ProlVar (Poly *, int)
void | SetMult (Poly *, int)
void | InitLead (Poly *)
void | InsertInCount (jList *, Poly *)
int | GetProl (Poly *, int)
void | SetProl (Poly *, int)
int | ProlCompare (Poly *, Poly *)
int | ValidatePoly (Poly *, TreeM *)
int | ListGreatMoveDegree (jList *, jList *, poly)
int | ListGreatMoveOrder (jList *, jList *, poly)
void | ForEachControlProlong (jList *)
void | NFListQ ()
int | CountList (jList *)
void | DestroyList (jList *)
int | ReducePoly (Poly *x, Poly *y)
int | ReducePolyLead (Poly *x, Poly *y)
void | Define (TreeM **G)
ListNode * | CreateListNode (Poly *x)
void | DestroyListNode (ListNode *x)
void | DestroyFreeNodes ()
int | ComputeBasis (jList *, jList *)
void | Initialization (char *)

## Variables

| ListNode
ListNode * | next
| NodeM
Poly * | ended
| TreeM

## Data Structure Documentation

## jList

struct jList

Definition at line 34 of file janet.h.

Data Fields
ListNode * | root |

## Macro Definition Documentation

## GCF

#define GCF | ( |  | x | ) |

Value:
omFree((x))
x
Variable x
Definition cfModGcd.cc:4090
omFree
#define omFree(addr)
Definition omAllocDecl.h:261

Definition at line 8 of file janet.h.

## GCM

#define GCM | ( |  | sz | ) |

Value:
omAlloc((sz))
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210

Definition at line 6 of file janet.h.

## GCMA

#define GCMA | ( |  | sz | ) |

Value:
omAlloc((sz))

Definition at line 7 of file janet.h.

## ListNode

#define ListNode struct LISTNODE

Definition at line 10 of file janet.h.

## NodeM

#define NodeM struct NODEM

Definition at line 12 of file janet.h.

## TreeM

#define TreeM struct TREEM

Definition at line 11 of file janet.h.

## Typedef Documentation

## LCI

typedef ListNode* LCI

Definition at line 50 of file janet.h.

## LI

typedef ListNode** LI

Definition at line 51 of file janet.h.

## poly_function

typedef void(* poly_function) (Poly *)

Definition at line 26 of file janet.h.

## Function Documentation

## ClearMult()

void ClearMult | ( | Poly * | x,
|  | int | i )

Definition at line 431 of file janet.cc.

{
x->mult[i/8] &= ~Mask[i%8];
}
i
int i
Definition cfEzgcd.cc:132
Mask
STATIC_VAR int Mask[8]
Definition janet.cc:36

## ClearProl()

void ClearProl | ( | Poly * | x,
|  | int | i )

Definition at line 446 of file janet.cc.

{
(x->mult+offset)[i/8] &= ~Mask[i%8];
}
offset
STATIC_VAR int offset
Definition janet.cc:29

## ComputeBasis()

int ComputeBasis | ( | jList * | _lT,
|  | jList * | _lQ )

Definition at line 1000 of file janet.cc.

{
// 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;
}
Print
#define Print
Definition emacs.cc:80
WarnS
#define WarnS
Definition emacs.cc:78
create
NodeM * create()
Definition janet.cc:757
T
STATIC_VAR jList * T
Definition janet.cc:30
G
STATIC_VAR TreeM * G
Definition janet.cc:31
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
ValidatePoly
int ValidatePoly(Poly *x, TreeM *)
Definition janet.cc:299
CountList
int CountList(jList *Q)
Definition janet.cc:617
ControlProlong
void ControlProlong(Poly *x)
Definition janet.cc:392
InsertInList
void InsertInList(jList *x, Poly *y)
Definition janet.cc:552
DestroyFreeNodes
void DestroyFreeNodes()
Definition janet.cc:776
h
STATIC_VAR Poly * h
Definition janet.cc:971
ForEachPNF
void ForEachPNF(jList *x, int i)
Definition janet.cc:692
FindMinList
Poly * FindMinList(jList *L)
Definition janet.cc:517
NFL
void NFL(Poly *p, TreeM *F)
Definition janet.cc:187
degree_compatible
STATIC_VAR int degree_compatible
Definition janet.cc:34
PNF
void PNF(Poly *p, TreeM *F)
Definition janet.cc:143
NFListQ
void NFListQ()
Definition janet.cc:631
ListGreatMove
STATIC_VAR int(* ListGreatMove)(jList *, jList *, poly)
Definition janet.cc:35
insert_
void insert_(TreeM **tree, Poly *item)
Definition janet.cc:912
GCF
#define GCF(x)
Definition janet.h:8
DestroyPoly
void DestroyPoly()
NULL
#define NULL
Definition omList.c:12
pIsConstant
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239
Q
#define Q
Definition sirandom.c:26

## ControlProlong()

void ControlProlong | ( | Poly * | x | ) |

Definition at line 392 of file janet.cc.

{
for (int i = 0; i< offset; i++)
{
(x->mult+offset)[i]&=~((x->mult)[i]);
// if (!GetMult(x,i) && !GetProl(x,i))
// ProlVar(x,i);
}
}

## CountList()

int CountList | ( | jList * | Q | ) |

Definition at line 617 of file janet.cc.

{
int i=0;
LCI y=Q->root;
while(y)
{
i++;
y=y->next;
}
return i;
}
y
const CanonicalForm int const CFList const Variable & y
Definition facAbsFact.cc:53
LCI
ListNode * LCI
Definition janet.h:50

## create()

NodeM * create | ( |  | ) |

Definition at line 757 of file janet.cc.

{
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;
}
FreeNodes
STATIC_VAR NodeM * FreeNodes
Definition janet.cc:33
NodeM
#define NodeM
Definition janet.h:12
GCM
#define GCM(sz)
Definition janet.h:6

## CreateListNode()

ListNode * CreateListNode | ( | Poly * | x | ) |

Definition at line 508 of file janet.cc.

{
ListNode* ret=(ListNode *)GCM(sizeof(ListNode));
ret->info=x;
ret->next=NULL;
return ret;
}
ListNode
#define ListNode
Definition janet.h:10

## Define()

void Define | ( | TreeM ** | G | ) |

Definition at line 815 of file janet.cc.

{
*G=(TreeM *)GCM(sizeof(TreeM));
(*G)->root=create();
}
TreeM
#define TreeM
Definition janet.h:11

## DestroyFreeNodes()

void DestroyFreeNodes | ( |  | ) |

Definition at line 776 of file janet.cc.

{
NodeM *y;
while((y=FreeNodes)!=NULL)
{
FreeNodes=FreeNodes->left;
GCF(y);
}
}

## DestroyList()

void DestroyList | ( | jList * | x | ) |

Definition at line 714 of file janet.cc.

{
LCI y=x->root,z;
while(y)
{
z=y->next;
DestroyPoly(y->info);
GCF(y);
y=z;
}
GCF(x);
}

## DestroyListNode()

void DestroyListNode | ( | ListNode * | x | ) |

Definition at line 502 of file janet.cc.

{
DestroyPoly(x->info);
GCF(x);
}

## DestroyPoly()

void DestroyPoly | ( |  | ) |

## DestroyTree()

void DestroyTree | ( | NodeM * | G | ) |

Definition at line 804 of file janet.cc.

{
if (G)
{
DestroyTree(G->left);
DestroyTree(G->right);
G->left=FreeNodes;
FreeNodes=G;
}
}

## FindMinList()

Poly * FindMinList | ( | jList * | L | ) |

Definition at line 517 of file janet.cc.

{
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;
}
l
int l
Definition cfEzgcd.cc:100
min
static int min(int a, int b)
Definition fast_mult.cc:268
ProlCompare
int ProlCompare(Poly *item1, Poly *item2)
Definition janet.cc:463
jList::root
ListNode * root
Definition janet.h:36
LI
ListNode ** LI
Definition janet.h:51
Poly
Definition janet.h:15

## ForEachControlProlong()

void ForEachControlProlong | ( | jList * | x | ) |

Definition at line 703 of file janet.cc.

{
LCI y=x->root;
while(y)
{
ControlProlong(y->info);
y=y->next;
}
}

## ForEachPNF()

void ForEachPNF | ( | jList * | x,
|  | int | i )

Definition at line 692 of file janet.cc.

{
LCI y=x->root;
while(y)
{
if (pow_(y->info->root) == i) PNF(y->info,G);
y=y->next;
}
}

## GB_length()

int GB_length | ( |  | ) |

Definition at line 740 of file janet.cc.

{
LCI iT=T->root;
int l=0;
while(iT)
{
if (pow_(iT->info->lead) == pow_(iT->info->history))
++l;
iT=iT->next;
}
return l;
}

## GetMult()

int GetMult | ( | Poly * | x,
|  | int | i )

Definition at line 421 of file janet.cc.

{
return x->mult[i/8] & Mask[i%8];
}

## GetProl()

int GetProl | ( | Poly * | x,
|  | int | i )

Definition at line 436 of file janet.cc.

{
return (x->mult+offset)[i/8] & Mask[i%8];
}

## InitHistory()

void InitHistory | ( | Poly * | p | ) |

Definition at line 402 of file janet.cc.

{
if (p->history) pLmFree(&p->history);
p->history=pLmInit(p->root);
p->changed=0;
}
p
int p
Definition cfModGcd.cc:4086
pLmInit
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition polys.h:65
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

## Initialization()

void Initialization | ( | char * | Ord | ) |

Definition at line 952 of file janet.cc.

{
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);
}
jDeg
VAR pFDegProc jDeg
Definition janet.cc:42
ListGreatMoveOrder
int ListGreatMoveOrder(jList *A, jList *B, poly x)
Definition janet.cc:582
Define
void Define(TreeM **G)
Definition janet.cc:815
ListGreatMoveDegree
int ListGreatMoveDegree(jList *A, jList *B, poly x)
Definition janet.cc:599
p_Deg
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586
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

## InitLead()

void InitLead | ( | Poly * | p | ) |

Definition at line 409 of file janet.cc.

{
if (p->lead!=NULL) pLmFree(&p->lead);
p->lead=pLmInit(p->root);
p->prolonged=-1;
}

## InitProl()

void InitProl | ( | Poly * | p | ) |

Definition at line 416 of file janet.cc.

{
memset(p->mult+offset,0,sizeof(char)*offset);
}

## insert_()

void insert_ | ( | TreeM ** | tree,
|  | Poly * | item )

Definition at line 912 of file janet.cc.

{
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;
}
ClearMultiplicative
static void ClearMultiplicative(NodeM *xx, int i)
Definition janet.cc:894
ClearMult
void ClearMult(Poly *x, int i)
Definition janet.cc:431
SetMult
void SetMult(Poly *x, int i)
Definition janet.cc:426
ProlVar
void ProlVar(Poly *temp, int i)
Definition janet.cc:480
pGetExp
#define pGetExp(p, i)
Exponent.
Definition polys.h:42
Poly::root
poly root
Definition janet.h:16

## InsertInCount()

void InsertInCount | ( | jList * | x,
|  | Poly * | y )

Definition at line 571 of file janet.cc.

{
ListNode *ins;
LI ix=&(x->root);
ins=CreateListNode(y);
ins->next=(ListNode *)(*ix);
*ix=ins;
return;
}
CreateListNode
ListNode * CreateListNode(Poly *x)
Definition janet.cc:508

## InsertInList()

void InsertInList | ( | jList * | x,
|  | Poly * | y )

Definition at line 552 of file janet.cc.

{
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;
}
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

## is_div_()

Poly * is_div_ | ( | TreeM * | root,
|  | poly | item )

Definition at line 853 of file janet.cc.

{
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;
}
is_div_upper
Poly * is_div_upper(poly item, NodeM *x, int from)
Definition janet.cc:846

## is_present()

Poly * is_present | ( | jList * | F,
|  | poly | x )

Definition at line 729 of file janet.cc.

{
LCI iF=F->root;
while(iF)
if (pLmCmp(iF->info->root,x) == 0)
return iF->info;
else iF=iF->next;
return NULL;
}

## ListGreatMoveDegree()

int ListGreatMoveDegree | ( | jList * | A,
|  | jList * | B,
|  | poly | x )

Definition at line 599 of file janet.cc.

{
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;
}
B
b *CanonicalForm B
Definition facBivar.cc:52
InsertInCount
void InsertInCount(jList *x, Poly *y)
Definition janet.cc:571
A
#define A
Definition sirandom.c:24

## ListGreatMoveOrder()

int ListGreatMoveOrder | ( | jList * | A,
|  | jList * | B,
|  | poly | x )

Definition at line 582 of file janet.cc.

{
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;
}

## NewPoly()

Poly * NewPoly | ( | poly | p = NULL | ) |

Definition at line 361 of file janet.cc.

{
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;
}
ClearProl
void ClearProl(Poly *x, int i)
Definition janet.cc:446
GCMA
#define GCMA(sz)
Definition janet.h:7
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::prolonged
int prolonged
Definition janet.h:23

## NFL()

void NFL | ( | Poly * | p,
|  | TreeM * | F )

Definition at line 187 of file janet.cc.

{
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);
}
f
FILE * f
Definition checklibs.c:9
InitLead
void InitLead(Poly *p)
Definition janet.cc:409
InitHistory
void InitHistory(Poly *p)
Definition janet.cc:402
ReducePolyLead
int ReducePolyLead(Poly *x, Poly *y)
Definition janet.cc:74
InitProl
void InitProl(Poly *p)
Definition janet.cc:416
is_div_
Poly * is_div_(TreeM *tree, poly item)
Definition janet.cc:853
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
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
nSize
#define nSize(n)
Definition numbers.h:39
p_SimpleContent
void p_SimpleContent(poly ph, int smax, const ring r)
Definition p_polys.cc:2612
p_ContentForGB
void p_ContentForGB(poly ph, const ring r)
Definition p_polys.cc:2403
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
pTest
#define pTest(p)
Definition polys.h:415
pDelete
#define pDelete(p_ptr)
Definition polys.h:187
count
int status int void size_t count
Definition si_signals.h:69

## NFListQ()

void NFListQ | ( |  | ) |

Definition at line 631 of file janet.cc.

{
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();
}
DestroyListNode
void DestroyListNode(ListNode *x)
Definition janet.cc:502

## PNF()

void PNF | ( | Poly * | p,
|  | TreeM * | F )

Definition at line 143 of file janet.cc.

{
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);
}
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
ReducePoly
int ReducePoly(Poly *x, poly from, Poly *y)
Definition janet.cc:119

## ProlCompare()

int ProlCompare | ( | Poly * | item1,
|  | Poly * | item2 )

Definition at line 463 of file janet.cc.

{
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;
}
}
LengthCompare
int LengthCompare(poly p1, poly p2)
Definition janet.cc:451

## ProlVar()

void ProlVar | ( | Poly * | temp,
|  | int | i )

Definition at line 480 of file janet.cc.

{
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);
}
}
GetProl
int GetProl(Poly *x, int i)
Definition janet.cc:436
NewPoly
Poly * NewPoly(poly p)
Definition janet.cc:361
SetProl
void SetProl(Poly *x, int i)
Definition janet.cc:441
GetMult
int GetMult(Poly *x, int i)
Definition janet.cc:421
pSetm
#define pSetm(p)
Definition polys.h:272
pIncrExp
#define pIncrExp(p, i)
Definition polys.h:44
Poly::changed
int changed
Definition janet.h:22

## ReducePoly()

int ReducePoly | ( | Poly * | x,
|  | Poly * | y )

## ReducePolyLead()

int ReducePolyLead | ( | Poly * | x,
|  | Poly * | y )

Definition at line 74 of file janet.cc.

{
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;
}
ksOldSpolyRed
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition kInline.h:1174
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
nDelete
#define nDelete(n)
Definition numbers.h:16
pLength
static int pLength(poly a)
Definition p_polys.h:190

## SetMult()

void SetMult | ( | Poly * | x,
|  | int | i )

Definition at line 426 of file janet.cc.

{
x->mult[i/8] |= Mask[i%8];
}

## SetProl()

void SetProl | ( | Poly * | x,
|  | int | i )

Definition at line 441 of file janet.cc.

{
(x->mult+offset)[i/8] |= Mask[i%8];
}

## ValidatePoly()

int ValidatePoly | ( | Poly * | x,
|  | TreeM * | )

Definition at line 299 of file janet.cc.

{
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;
}
g
g
Definition cfModGcd.cc:4098
is_present
Poly * is_present(jList *F, poly x)
Definition janet.cc:729
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
nInit
#define nInit(i)
Definition numbers.h:24
pMult
#define pMult(p, q)
Definition polys.h:208
pMDivide
#define pMDivide(a, b)
Definition polys.h:294
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186

## Variable Documentation

## ended

Poly* ended

Definition at line 42 of file janet.h.

## ListNode

ListNode

Initial value:
{
Poly *info
info
#define info
Definition libparse.cc:1256

Definition at line 28 of file janet.h.

## next

ListNode* next

Definition at line 31 of file janet.h.

## NodeM

NodeM

Initial value:
{
NodeM *left,*right

Definition at line 39 of file janet.h.

## TreeM

TreeM

Initial value:
{
NodeM *root

Definition at line 45 of file janet.h.