Macros | Functions | Variables
janet.cc File Reference
#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>

Go to the source code of this file.

Macros

#define pow_(x)   jDeg((x),currRing)
 

Functions

int ReducePolyLead (Poly *x, Poly *y)
 
int ReducePoly (Poly *x, poly from, Poly *y)
 
void PNF (Poly *p, TreeM *F)
 
void NFL (Poly *p, TreeM *F)
 
int ValidatePoly (Poly *x, TreeM *)
 
PolyNewPoly (poly p)
 
void DestroyPoly (Poly *x)
 
void ControlProlong (Poly *x)
 
void InitHistory (Poly *p)
 
void InitLead (Poly *p)
 
void InitProl (Poly *p)
 
int GetMult (Poly *x, int i)
 
void SetMult (Poly *x, int i)
 
void ClearMult (Poly *x, int i)
 
int GetProl (Poly *x, int i)
 
void SetProl (Poly *x, int i)
 
void ClearProl (Poly *x, int i)
 
int LengthCompare (poly p1, poly p2)
 
int ProlCompare (Poly *item1, Poly *item2)
 
void ProlVar (Poly *temp, int i)
 
void DestroyListNode (ListNode *x)
 
ListNodeCreateListNode (Poly *x)
 
PolyFindMinList (jList *L)
 
void InsertInList (jList *x, Poly *y)
 
void InsertInCount (jList *x, Poly *y)
 
int ListGreatMoveOrder (jList *A, jList *B, poly x)
 
int ListGreatMoveDegree (jList *A, jList *B, poly x)
 
int CountList (jList *Q)
 
void NFListQ ()
 
void ForEachPNF (jList *x, int i)
 
void ForEachControlProlong (jList *x)
 
void DestroyList (jList *x)
 
Polyis_present (jList *F, poly x)
 
int GB_length ()
 
NodeMcreate ()
 
void DestroyFreeNodes ()
 
void DestroyTree (NodeM *G)
 
void Define (TreeM **G)
 
int sp_div (poly m1, poly m2, int from)
 
void div_l (poly item, NodeM *x, int from)
 
Polyis_div_upper (poly item, NodeM *x, int from)
 
Polyis_div_ (TreeM *tree, poly item)
 
static void ClearMultiplicative (NodeM *xx, int i)
 
void insert_ (TreeM **tree, Poly *item)
 
void Initialization (char *Ord)
 
void T2G ()
 
int ComputeBasis (jList *_lT, jList *_lQ)
 

Variables

STATIC_VAR int offset
 
STATIC_VAR jListT
 
STATIC_VAR jListQ
 
STATIC_VAR TreeMG
 
STATIC_VAR NodeMFreeNodes
 
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}
 
VAR pFDegProc jDeg
 
STATIC_VAR Polytemp_l
 
STATIC_VAR Polyh
 

Macro Definition Documentation

◆ pow_

#define pow_ (   x)    jDeg((x),currRing)

Definition at line 43 of file janet.cc.

Function Documentation

◆ ClearMult()

void ClearMult ( Poly x,
int  i 
)

Definition at line 431 of file janet.cc.

432 {
433  x->mult[i/8] &= ~Mask[i%8];
434 }
STATIC_VAR int Mask[8]
Definition: janet.cc:36
int i
Definition: cfEzgcd.cc:125
char * mult
Definition: janet.h:21

◆ ClearMultiplicative()

static void ClearMultiplicative ( NodeM xx,
int  i 
)
static

Definition at line 894 of file janet.cc.

895 {
896  if (!xx) return;
897 
898  while (xx->left)
899  {
900  ClearMultiplicative(xx->right, i);
901  xx = xx->left;
902  }
903  if ((xx->ended) && (GetMult(xx->ended,i)))
904  {
905  ClearMult(xx->ended,i);
906  ProlVar(xx->ended,i);
907  }
908  else
909  ClearMultiplicative(xx->right,i);
910 }
static void ClearMultiplicative(NodeM *xx, int i)
Definition: janet.cc:894
void ClearMult(Poly *x, int i)
Definition: janet.cc:431
void ProlVar(Poly *temp, int i)
Definition: janet.cc:480
int GetMult(Poly *x, int i)
Definition: janet.cc:421
int i
Definition: cfEzgcd.cc:125

◆ ClearProl()

void ClearProl ( Poly x,
int  i 
)

Definition at line 446 of file janet.cc.

447 {
448  (x->mult+offset)[i/8] &= ~Mask[i%8];
449 }
STATIC_VAR int Mask[8]
Definition: janet.cc:36
int i
Definition: cfEzgcd.cc:125
char * mult
Definition: janet.h:21
STATIC_VAR int offset
Definition: janet.cc:29

◆ ComputeBasis()

int ComputeBasis ( jList _lT,
jList _lQ 
)

Definition at line 1000 of file janet.cc.

1001 {
1002  // int gb_l,i,ret_value=1;
1003 
1004  T=_lT; Q=_lQ;
1005 
1006 // Debug();
1007 
1008  while((h=FindMinList(Q))!=NULL)
1009  {
1010 // PrintS("New element\n");
1011 // Debug();
1012 
1013  if (!degree_compatible)
1014  {
1015  if (!ValidatePoly(h,G))
1016  {
1017  DestroyPoly(h);
1018  continue;
1019  }
1020 
1021  h->changed=0;
1022 
1023  NFL(h,G);
1024 
1025  if (!h->root)
1026  {
1027  DestroyPoly(h);
1028  continue;
1029  }
1030  }
1031 
1032  if (h->root)
1033  {
1034  if (pIsConstant(h->root))
1035  {
1036  WarnS("Constant in basis\n");
1037  return 0;
1038  }
1039 
1040  if (h->changed && ListGreatMove(T,Q,h->root))
1041  {
1042 // PrintS("<-\n");
1043  DestroyTree(G->root);
1044  G->root=create();
1045  T2G();
1046  }
1047  }
1048 
1049 // PrintS("PNF\n");
1050  PNF(h,G);
1051 // Print("{%d}\n",pow_(h->root));
1052  insert_(&G,h);
1053  InsertInList(T,h);
1054 
1055 // PrintS("For each PNF\n");
1056  if (degree_compatible)
1057  ForEachPNF(T,pow_(h->root));
1058 
1059 // PrintS("Control of prolongations\n");
1060  if (h->changed)
1062  else
1063  ControlProlong(h);
1064 
1065 // Debug();
1066 
1067 // PrintS("NFListQ\n");
1068  if (degree_compatible)
1069  NFListQ();
1070 //Debug();
1071  }
1072 
1073 // gb_l=GB_length();
1074 
1075  Print("Length of Janet basis: %d\n",CountList(T));
1076 // Print("Length of Groebner basis: %d\n",gb_l);
1077 
1078  DestroyTree(G->root);
1079  GCF(G);
1080  DestroyFreeNodes();
1081 
1082  return 1;
1083 }
STATIC_VAR jList * Q
Definition: janet.cc:30
#define pow_(x)
Definition: janet.cc:43
STATIC_VAR int degree_compatible
Definition: janet.cc:34
#define Print
Definition: emacs.cc:80
void insert_(TreeM **tree, Poly *item)
Definition: janet.cc:912
int changed
Definition: janet.h:22
Poly * FindMinList(jList *L)
Definition: janet.cc:517
#define WarnS
Definition: emacs.cc:78
void ControlProlong(Poly *x)
Definition: janet.cc:392
int ValidatePoly(Poly *x, TreeM *)
Definition: janet.cc:299
int CountList(jList *Q)
Definition: janet.cc:617
void T2G()
Definition: janet.cc:1085
void DestroyPoly(Poly *x)
Definition: janet.cc:383
void NFListQ()
Definition: janet.cc:631
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:234
void InsertInList(jList *x, Poly *y)
Definition: janet.cc:552
void ForEachPNF(jList *x, int i)
Definition: janet.cc:692
void DestroyFreeNodes()
Definition: janet.cc:776
STATIC_VAR Poly * h
Definition: janet.cc:971
#define NULL
Definition: omList.c:12
NodeM * create()
Definition: janet.cc:757
#define GCF(x)
Definition: janet.h:8
poly root
Definition: janet.h:16
void ForEachControlProlong(jList *x)
Definition: janet.cc:703
void DestroyTree(NodeM *G)
Definition: janet.cc:804
STATIC_VAR int(* ListGreatMove)(jList *, jList *, poly)
Definition: janet.cc:35
STATIC_VAR TreeM * G
Definition: janet.cc:31
void PNF(Poly *p, TreeM *F)
Definition: janet.cc:143
STATIC_VAR jList * T
Definition: janet.cc:30
void NFL(Poly *p, TreeM *F)
Definition: janet.cc:187

◆ ControlProlong()

void ControlProlong ( Poly x)

Definition at line 392 of file janet.cc.

393 {
394  for (int i = 0; i< offset; i++)
395  {
396  (x->mult+offset)[i]&=~((x->mult)[i]);
397 // if (!GetMult(x,i) && !GetProl(x,i))
398 // ProlVar(x,i);
399  }
400 }
int i
Definition: cfEzgcd.cc:125
char * mult
Definition: janet.h:21
STATIC_VAR int offset
Definition: janet.cc:29

◆ CountList()

int CountList ( jList Q)

Definition at line 617 of file janet.cc.

618 {
619  int i=0;
620  LCI y=Q->root;
621 
622  while(y)
623  {
624  i++;
625  y=y->next;
626  }
627 
628  return i;
629 }
ListNode * root
Definition: janet.h:36
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
ListNode * LCI
Definition: janet.h:48
int i
Definition: cfEzgcd.cc:125

◆ create()

NodeM* create ( )

Definition at line 757 of file janet.cc.

758 {
759  NodeM *y;
760 
761  if (FreeNodes == NULL)
762  {
763  y=(NodeM *)GCM(sizeof(NodeM));
764  }
765  else
766  {
767  y=FreeNodes;
768  FreeNodes=FreeNodes->left;
769  }
770 
771  y->left=y->right=NULL;
772  y->ended=NULL;
773  return y;
774 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
STATIC_VAR NodeM * FreeNodes
Definition: janet.cc:33
NodeM
Definition: janet.h:40
#define GCM(sz)
Definition: janet.h:6
#define NULL
Definition: omList.c:12

◆ CreateListNode()

ListNode* CreateListNode ( Poly x)

Definition at line 508 of file janet.cc.

509 {
510  ListNode* ret=(ListNode *)GCM(sizeof(ListNode));
511  ret->info=x;
512  ret->next=NULL;
513  return ret;
514 }
ListNode
Definition: janet.h:29
#define GCM(sz)
Definition: janet.h:6
Variable next() const
Definition: factory.h:137
#define NULL
Definition: omList.c:12
Variable x
Definition: cfModGcd.cc:4023

◆ Define()

void Define ( TreeM **  G)

Definition at line 815 of file janet.cc.

816 {
817  *G=(TreeM *)GCM(sizeof(TreeM));
818  (*G)->root=create();
819 }
#define GCM(sz)
Definition: janet.h:6
TreeM
Definition: janet.h:46
NodeM * create()
Definition: janet.cc:757
STATIC_VAR TreeM * G
Definition: janet.cc:31

◆ DestroyFreeNodes()

void DestroyFreeNodes ( )

Definition at line 776 of file janet.cc.

777 {
778  NodeM *y;
779 
780  while((y=FreeNodes)!=NULL)
781  {
782  FreeNodes=FreeNodes->left;
783  GCF(y);
784  }
785 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
STATIC_VAR NodeM * FreeNodes
Definition: janet.cc:33
NodeM
Definition: janet.h:40
#define NULL
Definition: omList.c:12
#define GCF(x)
Definition: janet.h:8

◆ DestroyList()

void DestroyList ( jList x)

Definition at line 714 of file janet.cc.

715 {
716  LCI y=x->root,z;
717 
718  while(y)
719  {
720  z=y->next;
721  DestroyPoly(y->info);
722  GCF(y);
723  y=z;
724  }
725 
726  GCF(x);
727 }
ListNode * root
Definition: janet.h:36
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
ListNode * LCI
Definition: janet.h:48
void DestroyPoly(Poly *x)
Definition: janet.cc:383
#define GCF(x)
Definition: janet.h:8

◆ DestroyListNode()

void DestroyListNode ( ListNode x)

Definition at line 502 of file janet.cc.

503 {
504  DestroyPoly(x->info);
505  GCF(x);
506 }
void DestroyPoly(Poly *x)
Definition: janet.cc:383
#define GCF(x)
Definition: janet.h:8
Variable x
Definition: cfModGcd.cc:4023

◆ DestroyPoly()

void DestroyPoly ( Poly x)

Definition at line 383 of file janet.cc.

384 {
385  pDelete(&x->root);
386  pLmFree(&x->history);
387  if (x->lead!=NULL) pLmFree(&x->lead);
388  GCF(x->mult);
389  GCF(x);
390 }
poly history
Definition: janet.h:19
char * mult
Definition: janet.h:21
#define NULL
Definition: omList.c:12
#define GCF(x)
Definition: janet.h:8
#define pDelete(p_ptr)
Definition: polys.h:182
poly lead
Definition: janet.h:20
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:70
poly root
Definition: janet.h:16

◆ DestroyTree()

void DestroyTree ( NodeM G)

Definition at line 804 of file janet.cc.

805 {
806  if (G)
807  {
808  DestroyTree(G->left);
809  DestroyTree(G->right);
810  G->left=FreeNodes;
811  FreeNodes=G;
812  }
813 }
STATIC_VAR NodeM * FreeNodes
Definition: janet.cc:33
void DestroyTree(NodeM *G)
Definition: janet.cc:804
STATIC_VAR TreeM * G
Definition: janet.cc:31

◆ div_l()

void div_l ( poly  item,
NodeM x,
int  from 
)

Definition at line 832 of file janet.cc.

833 {
834  if (x && !temp_l)
835  {
836  div_l(item,x->left,from);
837  if ((x->ended) && sp_div(item,x->ended->root,from))
838  {
839  temp_l=x->ended;
840  return;
841  };
842  div_l(item,x->right,from);
843  }
844 }
STATIC_VAR Poly * temp_l
Definition: janet.cc:755
void div_l(poly item, NodeM *x, int from)
Definition: janet.cc:832
int sp_div(poly m1, poly m2, int from)
Definition: janet.cc:821
Variable x
Definition: cfModGcd.cc:4023

◆ FindMinList()

Poly* FindMinList ( jList L)

Definition at line 517 of file janet.cc.

518 {
519  LI min=&(L->root);
520  LI l;
521  LCI xl;
522  Poly *x;
523 
524  if (degree_compatible)
525  {
526  while ((*min) && ((*min)->info->root == NULL))
527  min=&((*min)->next);
528  }
529 
530  if (!(*min)) return NULL;
531 
532  l=&((*min)->next);
533 
534  while (*l)
535  {
536  if ((*l)->info->root != NULL)
537  {
538  if (ProlCompare((*l)->info,(*min)->info))
539  min=l;
540  }
541 
542  l=&((*l)->next);
543  }
544  x=(*min)->info;
545  xl=*min;
546  *min=(*min)->next;
547  GCF(xl);
548 
549  return x;
550 }
ListNode * root
Definition: janet.h:36
STATIC_VAR int degree_compatible
Definition: janet.cc:34
Definition: janet.h:14
ListNode * LCI
Definition: janet.h:48
static int min(int a, int b)
Definition: fast_mult.cc:268
int ProlCompare(Poly *item1, Poly *item2)
Definition: janet.cc:463
#define NULL
Definition: omList.c:12
#define GCF(x)
Definition: janet.h:8
ListNode ** LI
Definition: janet.h:51
Variable x
Definition: cfModGcd.cc:4023
int l
Definition: cfEzgcd.cc:93

◆ ForEachControlProlong()

void ForEachControlProlong ( jList x)

Definition at line 703 of file janet.cc.

704 {
705  LCI y=x->root;
706 
707  while(y)
708  {
709  ControlProlong(y->info);
710  y=y->next;
711  }
712 }
ListNode * root
Definition: janet.h:36
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
ListNode * LCI
Definition: janet.h:48
void ControlProlong(Poly *x)
Definition: janet.cc:392

◆ ForEachPNF()

void ForEachPNF ( jList x,
int  i 
)

Definition at line 692 of file janet.cc.

693 {
694  LCI y=x->root;
695 
696  while(y)
697  {
698  if (pow_(y->info->root) == i) PNF(y->info,G);
699  y=y->next;
700  }
701 }
ListNode * root
Definition: janet.h:36
#define pow_(x)
Definition: janet.cc:43
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
ListNode * LCI
Definition: janet.h:48
int i
Definition: cfEzgcd.cc:125
STATIC_VAR TreeM * G
Definition: janet.cc:31
void PNF(Poly *p, TreeM *F)
Definition: janet.cc:143

◆ GB_length()

int GB_length ( )

Definition at line 740 of file janet.cc.

741 {
742  LCI iT=T->root;
743  int l=0;
744 
745  while(iT)
746  {
747  if (pow_(iT->info->lead) == pow_(iT->info->history))
748  ++l;
749  iT=iT->next;
750  }
751 
752  return l;
753 }
ListNode * root
Definition: janet.h:36
#define pow_(x)
Definition: janet.cc:43
ListNode * LCI
Definition: janet.h:48
int l
Definition: cfEzgcd.cc:93
STATIC_VAR jList * T
Definition: janet.cc:30

◆ GetMult()

int GetMult ( Poly x,
int  i 
)

Definition at line 421 of file janet.cc.

422 {
423  return x->mult[i/8] & Mask[i%8];
424 }
STATIC_VAR int Mask[8]
Definition: janet.cc:36
int i
Definition: cfEzgcd.cc:125
char * mult
Definition: janet.h:21

◆ GetProl()

int GetProl ( Poly x,
int  i 
)

Definition at line 436 of file janet.cc.

437 {
438  return (x->mult+offset)[i/8] & Mask[i%8];
439 }
STATIC_VAR int Mask[8]
Definition: janet.cc:36
int i
Definition: cfEzgcd.cc:125
char * mult
Definition: janet.h:21
STATIC_VAR int offset
Definition: janet.cc:29

◆ InitHistory()

void InitHistory ( Poly p)

Definition at line 402 of file janet.cc.

403 {
404  if (p->history) pLmFree(&p->history);
405  p->history=pLmInit(p->root);
406  p->changed=0;
407 }
poly history
Definition: janet.h:19
int changed
Definition: janet.h:22
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
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:70
poly root
Definition: janet.h:16

◆ Initialization()

void Initialization ( char *  Ord)

Definition at line 952 of file janet.cc.

953 {
954  offset=(currRing->N % 8 == 0) ? (currRing->N/8)*8 : (currRing->N/8+1)*8;
955  if (strstr(Ord,"dp\0") || strstr(Ord,"Dp\0"))
956  {
958  jDeg=p_Deg;
960  }
961  else
962  {
966  }
967 
968  Define(&G);
969 }
STATIC_VAR int degree_compatible
Definition: janet.cc:34
int ListGreatMoveDegree(jList *A, jList *B, poly x)
Definition: janet.cc:599
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1446
void Define(TreeM **G)
Definition: janet.cc:815
int ListGreatMoveOrder(jList *A, jList *B, poly x)
Definition: janet.cc:582
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
VAR pFDegProc jDeg
Definition: janet.cc:42
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
STATIC_VAR int offset
Definition: janet.cc:29
STATIC_VAR int(* ListGreatMove)(jList *, jList *, poly)
Definition: janet.cc:35
STATIC_VAR TreeM * G
Definition: janet.cc:31

◆ InitLead()

void InitLead ( Poly p)

Definition at line 409 of file janet.cc.

410 {
411  if (p->lead!=NULL) pLmFree(&p->lead);
412  p->lead=pLmInit(p->root);
413  p->prolonged=-1;
414 }
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
#define NULL
Definition: omList.c:12
poly lead
Definition: janet.h:20
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:70
poly root
Definition: janet.h:16
int prolonged
Definition: janet.h:23

◆ InitProl()

void InitProl ( Poly p)

Definition at line 416 of file janet.cc.

417 {
418  memset(p->mult+offset,0,sizeof(char)*offset);
419 }
char * mult
Definition: janet.h:21
STATIC_VAR int offset
Definition: janet.cc:29

◆ insert_()

void insert_ ( TreeM **  tree,
Poly item 
)

Definition at line 912 of file janet.cc.

913 {
914  int power_tmp,i,i_con=currRing->N-1;
915  NodeM *curr=(*tree)->root;
916 
917  for ( ; (i_con>=0) && !pGetExp(item->root,i_con+1) ; i_con--)
918  SetMult(item,i_con);
919 
920  for (i = 0; i<= i_con; i++)
921  //<=
922  {
923  power_tmp=pGetExp(item->root,i+1);
924 
925  ClearMult(item,i);
926 
927  while (power_tmp)
928  {
929  if (!curr->left)
930  {
931  SetMult(item,i);
932  ClearMultiplicative(curr->right,i);
933  curr->left=create();
934  };
935  curr=curr->left;
936  power_tmp--;
937  };
938 
939  if (i<i_con)
940  {
941  if (!curr->left) SetMult(item,i);
942  if (!curr->right) curr->right=create();
943  curr=curr->right;
944 
945  ProlVar(item,i);
946  }
947  }
948 
949  curr->ended=item;
950 }
static void ClearMultiplicative(NodeM *xx, int i)
Definition: janet.cc:894
void ClearMult(Poly *x, int i)
Definition: janet.cc:431
void ProlVar(Poly *temp, int i)
Definition: janet.cc:480
NodeM
Definition: janet.h:40
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int i
Definition: cfEzgcd.cc:125
NodeM * create()
Definition: janet.cc:757
void SetMult(Poly *x, int i)
Definition: janet.cc:426
poly root
Definition: janet.h:16

◆ InsertInCount()

void InsertInCount ( jList x,
Poly y 
)

Definition at line 571 of file janet.cc.

572 {
573  ListNode *ins;
574  LI ix=&(x->root);
575 
576  ins=CreateListNode(y);
577  ins->next=(ListNode *)(*ix);
578  *ix=ins;
579  return;
580 }
ListNode * root
Definition: janet.h:36
ListNode
Definition: janet.h:29
ListNode * CreateListNode(Poly *x)
Definition: janet.cc:508
ListNode ** LI
Definition: janet.h:51

◆ InsertInList()

void InsertInList ( jList x,
Poly y 
)

Definition at line 552 of file janet.cc.

553 {
554  ListNode *ins;
555  LI ix=&(x->root);
556 
557  while (*ix)
558  {
559  if (pLmCmp(y->lead,(*ix)->info->lead) == -1)
560  ix=(ListNode **)&((*ix)->next);
561  else
562  break;
563  }
564 
565  ins=CreateListNode(y);
566  ins->next=(ListNode *)(*ix);
567  *ix=ins;
568  return;
569 }
ListNode * root
Definition: janet.h:36
ListNode
Definition: janet.h:29
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ListNode * CreateListNode(Poly *x)
Definition: janet.cc:508
ListNode ** LI
Definition: janet.h:51
poly lead
Definition: janet.h:20

◆ is_div_()

Poly* is_div_ ( TreeM tree,
poly  item 
)

Definition at line 853 of file janet.cc.

854 {
855  int power_tmp,i,i_con=currRing->N-1;
856  NodeM *curr=tree->root;
857 
858  if (!curr) return NULL;
859  if (pow_(item) == 0) return NULL;
860 
861  for ( ; i_con>=0 && !pGetExp(item,i_con+1) ; i_con--)
862  ;
863 
864  for (i=0; i <= i_con ; i++)
865  {
866  power_tmp=pGetExp(item,i+1);
867 
868  while (power_tmp)
869  {
870  if (curr->ended) return curr->ended;
871 
872  if (!curr->left)
873  {
874  if (curr->right)
875  return is_div_upper(item,curr->right,i); //??????
876  return NULL;
877  }
878 
879  curr=curr->left;
880  power_tmp--;
881  }
882 
883  if (curr->ended) return curr->ended;
884 
885  if (!curr->right) return NULL;
886 
887  curr=curr->right;
888  }
889 
890  if (curr->ended) return curr->ended;
891  else return NULL;
892 }
#define pow_(x)
Definition: janet.cc:43
NodeM
Definition: janet.h:40
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
Poly * is_div_upper(poly item, NodeM *x, int from)
Definition: janet.cc:846

◆ is_div_upper()

Poly* is_div_upper ( poly  item,
NodeM x,
int  from 
)

Definition at line 846 of file janet.cc.

847 {
848  temp_l=NULL;
849  div_l(item,x,from);
850  return temp_l;
851 }
STATIC_VAR Poly * temp_l
Definition: janet.cc:755
void div_l(poly item, NodeM *x, int from)
Definition: janet.cc:832
#define NULL
Definition: omList.c:12
Variable x
Definition: cfModGcd.cc:4023

◆ is_present()

Poly* is_present ( jList F,
poly  x 
)

Definition at line 729 of file janet.cc.

730 {
731  LCI iF=F->root;
732  while(iF)
733  if (pLmCmp(iF->info->root,x) == 0)
734  return iF->info;
735  else iF=iF->next;
736 
737  return NULL;
738 }
ListNode * root
Definition: janet.h:36
ListNode * LCI
Definition: janet.h:48
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define NULL
Definition: omList.c:12
Variable x
Definition: cfModGcd.cc:4023

◆ LengthCompare()

int LengthCompare ( poly  p1,
poly  p2 
)

Definition at line 451 of file janet.cc.

452 {
453  do
454  {
455  if (p1 == NULL) return 1;
456  if (p2 == NULL) return 0;
457  pIter(p1);
458  pIter(p2);
459  }while(p1 && p2);
460  return 1;
461 }
#define pIter(p)
Definition: monomials.h:37
#define NULL
Definition: omList.c:12

◆ ListGreatMoveDegree()

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

Definition at line 599 of file janet.cc.

600 {
601  LCI y=A->root;
602  int pow_x=pow_(x);
603 
604  if (!y || pow_(y->info->lead) <= pow_x) return 0;
605 
606  while(y && pow_(y->info->lead) > pow_x)
607  {
608  InsertInCount(B,y->info);
609  A->root=y->next;
610  GCF(y);
611  y=A->root;
612  }
613 
614  return 1;
615 }
ListNode * root
Definition: janet.h:36
#define pow_(x)
Definition: janet.cc:43
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
ListNode * LCI
Definition: janet.h:48
void InsertInCount(jList *x, Poly *y)
Definition: janet.cc:571
#define GCF(x)
Definition: janet.h:8
Variable x
Definition: cfModGcd.cc:4023

◆ ListGreatMoveOrder()

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

Definition at line 582 of file janet.cc.

583 {
584  LCI y=A->root;
585 
586  if (!y || pLmCmp(y->info->lead,x) < 0) return 0;
587 
588  while(y && pLmCmp(y->info->lead,x) >= 0)
589  {
590  InsertInCount(B,y->info);
591  A->root=y->next;
592  GCF(y);
593  y=A->root;
594  }
595 
596  return 1;
597 }
ListNode * root
Definition: janet.h:36
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
ListNode * LCI
Definition: janet.h:48
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
void InsertInCount(jList *x, Poly *y)
Definition: janet.cc:571
#define GCF(x)
Definition: janet.h:8
Variable x
Definition: cfModGcd.cc:4023

◆ NewPoly()

Poly* NewPoly ( poly  p)

Definition at line 361 of file janet.cc.

362 {
363  Poly *beg=(Poly *)GCM(sizeof(Poly));
364 
365  beg->root=p;//(p == NULL ? pInit() : p);
366  beg->root_b=NULL;
367  beg->root_l=0;
368  beg->history=NULL;//pInit();
369  beg->lead=NULL;
370  beg->mult=(char *)GCMA(sizeof(char)*2*offset);
371 
372  for (int i=0; i < currRing->N; i++)
373  {
374  ClearMult(beg,i);
375  ClearProl(beg,i);
376  };
377 
378  beg->prolonged=-1;
379 
380  return beg;
381 }
Definition: janet.h:14
void ClearMult(Poly *x, int i)
Definition: janet.cc:431
poly history
Definition: janet.h:19
kBucket_pt root_b
Definition: janet.h:17
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void ClearProl(Poly *x, int i)
Definition: janet.cc:446
int i
Definition: cfEzgcd.cc:125
#define GCM(sz)
Definition: janet.h:6
char * mult
Definition: janet.h:21
STATIC_VAR int offset
Definition: janet.cc:29
#define NULL
Definition: omList.c:12
#define GCMA(sz)
Definition: janet.h:7
poly lead
Definition: janet.h:20
poly root
Definition: janet.h:16
int p
Definition: cfModGcd.cc:4019
int root_l
Definition: janet.h:18
int prolonged
Definition: janet.h:23

◆ NFL()

void NFL ( Poly p,
TreeM F 
)

Definition at line 187 of file janet.cc.

188 {
189  Poly *f;
190  // int g1,f1,gg;
191 
192  if ((f=is_div_(F,p->lead))==NULL) return;
193 
194  int pX=pow_(p->lead);
195  int phX=pow_(p->history);
196 
197  if (pX!=phX)
198  {
199  int phF=pow_(f->history);
200  if (pX >= (phX+phF))
201  {
202  pDelete(&p->root);
203  //p->root=NULL;
204  return;
205  }
206 
207 /* poly p2=pInit();
208  pLcm(p->history,f->history,p2);
209  pSetm(p2);
210 
211  if (pLmCmp(p->root,p2) > 0)
212  {
213  pLmDelete(&p2);
214  pDelete(&p->root);
215  //p->root=NULL;
216  return;
217  }
218 
219  pLmDelete(&p2);
220 */
221 /* for(int i=0, gg=0 ; i<currRing->N;i++)
222  if ((g1=pGetExp(p->history,i+1)) > (f1=pGetExp(f->history,i+1)))
223  gg+=g1;
224  else gg+=f1;
225 
226  if (pX > gg)
227  {
228  pDelete(&p->root);
229  //x->root=NULL;
230  return;
231  }
232 */
233  int pF=pow_(f->lead);
234 
235  if ((pX == pF) && (pF == phF))
236  {
237  pLmFree(&f->history);
238  if (p->history!=NULL)
239  f->history=p_Copy_noCheck(p->history,currRing); /* cf of p->history is NULL */
240  }
241  }
242 
243  //if (TEST_OPT_PROT) { PrintS("R"); mflush(); }
244  int /*old_size, */count;
245  count=0;
246  while(f && p->root)
247  {
248 // PrintS("R");
249 // if (TEST_OPT_PROT) { PrintS("R"); mflush(); }
250 #if 0
251  old_size=nSize(pGetCoeff(p->root));
252 #endif
253  if (ReducePolyLead(p,f) == 0) break;
254  if (p->root!=NULL)
255  {
256  count++;
257 #if 0
258  if ((count>4) && (3<nSize(pGetCoeff(p->root)))
259  && (nSize(pGetCoeff(p->root))>old_size))
260  {
261  p_SimpleContent(p->root,old_size,currRing);
262  count=0;
263  }
264 #else
265  if (count>50)
266  {
267  kBucketClear(p->root_b,&p->root,&p->root_l);
269  kBucketInit(p->root_b,p->root,p->root_l);
270  count=0;
271  //PrintS(".");
272  }
273 #endif
274  f=is_div_(F,p->root);
275  }
276  }
277 #if 1
278  if (p->root_b!=NULL)
279  {
280  kBucketClear(p->root_b,&p->root,&p->root_l);
281  kBucketDestroy(&p->root_b);
282  p->root_b=NULL;
283  }
284 #endif
285 
286  if (!p->root)
287  return;
288 
289  InitHistory(p);
290  InitProl(p);
291  InitLead(p);
292  p->changed=1;
293 
295  //p_SimpleContent(p->root,-1i,currRing);
296  pTest(p->root);
297 }
int status int void size_t count
Definition: si_signals.h:59
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:521
#define pow_(x)
Definition: janet.cc:43
Definition: janet.h:14
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:493
void InitProl(Poly *p)
Definition: janet.cc:416
#define pTest(p)
Definition: polys.h:411
poly history
Definition: janet.h:19
int changed
Definition: janet.h:22
void p_ContentForGB(poly ph, const ring r)
Definition: p_polys.cc:2315
int ReducePolyLead(Poly *x, Poly *y)
Definition: janet.cc:74
kBucket_pt root_b
Definition: janet.h:17
void p_SimpleContent(poly ph, int smax, const ring r)
Definition: p_polys.cc:2524
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
Poly * is_div_(TreeM *tree, poly item)
Definition: janet.cc:853
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
Definition: p_polys.h:801
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:216
FILE * f
Definition: checklibs.c:9
void InitLead(Poly *p)
Definition: janet.cc:409
#define NULL
Definition: omList.c:12
#define pDelete(p_ptr)
Definition: polys.h:182
#define nSize(n)
Definition: numbers.h:39
poly lead
Definition: janet.h:20
void InitHistory(Poly *p)
Definition: janet.cc:402
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:70
poly root
Definition: janet.h:16
int root_l
Definition: janet.h:18

◆ NFListQ()

void NFListQ ( )

Definition at line 631 of file janet.cc.

632 {
633  LCI ll;
634  int p,p1;
635  LI l;
636 
637  do
638  {
639  if (!Q->root) break;
640 
641  ll=Q->root;
642 
643  p=pow_(Q->root->info->lead);
644 
645  while (ll)
646  {
647  int ploc=pow_(ll->info->lead);
648  if (ploc < p) p=ploc;
649  ll=ll->next;
650  }
651 
652  p1=1;
653 
654  l=&(Q->root);
655 
656  while (*l)
657  {
658 // PrintS("*");
659  int ploc=pow_((*l)->info->lead);
660 
661  if (ploc == p)
662  {
663  if (!ValidatePoly((*l)->info,G))
664  {
665  ll=(*l);
666  *l=(*l)->next;
667  DestroyListNode(ll);
668  continue;
669  };
670 
671  (*l)->info->changed=0;
672 // PrintS("!");
673  NFL((*l)->info,G);
674 // PrintS("$");
675  if (!(*l)->info->root)
676  {
677  ll=(*l);
678  *l=(*l)->next;
679  DestroyListNode(ll);
680  continue;
681  };
682  p1=0;
683  }
684 
685  l=&((*l)->next);
686  }
687  }while(p1);
688 // PrintLn();
689 }
ListNode * root
Definition: janet.h:36
STATIC_VAR jList * Q
Definition: janet.cc:30
#define pow_(x)
Definition: janet.cc:43
ListNode * LCI
Definition: janet.h:48
void DestroyListNode(ListNode *x)
Definition: janet.cc:502
int ValidatePoly(Poly *x, TreeM *)
Definition: janet.cc:299
ListNode ** LI
Definition: janet.h:51
int p
Definition: cfModGcd.cc:4019
STATIC_VAR TreeM * G
Definition: janet.cc:31
int l
Definition: cfEzgcd.cc:93
void NFL(Poly *p, TreeM *F)
Definition: janet.cc:187

◆ PNF()

void PNF ( Poly p,
TreeM F 
)

Definition at line 143 of file janet.cc.

144 {
145  if (p->root==NULL) return;
146 
147  Poly *f;
148  BOOLEAN done=FALSE;
149  poly temp=p->root;
150 
151 // if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
152  int count=0;
153  poly pp=p->root;
154  int old_size=nSize(pGetCoeff(pp));
155  p->root_l=0;
156  while(temp->next)
157  {
158  f=is_div_(F,temp->next);
159  if (f)
160  {
161  if (ReducePoly(p,temp,f)) //temp->next
162  {
163  count++;
164  //if (TEST_OPT_PROT) { PrintS("-"); mflush(); }
165  if ((f!=NULL)
166  && (count>20)
167  && (nSize(pGetCoeff(pp))>old_size)
168  )
169  {
171  //p_Content(pp,currRing);
172  count=0;
173  // old_size=nSize(pGetCoeff(pp));
174  }
175  }
176  done=TRUE;
177  }
178  else
179  temp=temp->next;
180  }
181 
182  if (done) p_ContentForGB(p->root,currRing);
183  //if (done) p_SimpleContent(p->root,-1,currRing);
184  pTest(p->root);
185 }
int status int void size_t count
Definition: si_signals.h:59
Definition: janet.h:14
#define FALSE
Definition: auxiliary.h:96
#define pTest(p)
Definition: polys.h:411
#define TRUE
Definition: auxiliary.h:100
void p_ContentForGB(poly ph, const ring r)
Definition: p_polys.cc:2315
void p_SimpleContent(poly ph, int smax, const ring r)
Definition: p_polys.cc:2524
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
Poly * is_div_(TreeM *tree, poly item)
Definition: janet.cc:853
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int ReducePoly(Poly *x, poly from, Poly *y)
Definition: janet.cc:119
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
FILE * f
Definition: checklibs.c:9
#define NULL
Definition: omList.c:12
#define nSize(n)
Definition: numbers.h:39
poly root
Definition: janet.h:16
int root_l
Definition: janet.h:18
int BOOLEAN
Definition: auxiliary.h:87

◆ ProlCompare()

int ProlCompare ( Poly item1,
Poly item2 
)

Definition at line 463 of file janet.cc.

464 {
465  switch(pLmCmp(item1->lead,item2->lead))
466  {
467  case -1:
468  return 1;
469 
470  case 1:
471  return 0;
472 
473  default:
474  if ((item1->root_l<=0)||(item2->root_l<=0))
475  return LengthCompare(item1->root,item2->root);
476  return item1->root_l<=item2->root_l;
477  }
478 }
int LengthCompare(poly p1, poly p2)
Definition: janet.cc:451
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
poly lead
Definition: janet.h:20
poly root
Definition: janet.h:16
int root_l
Definition: janet.h:18

◆ ProlVar()

void ProlVar ( Poly temp,
int  i 
)

Definition at line 480 of file janet.cc.

481 {
482  Poly *Pr;
483 
484  if (!GetProl(temp,i) && !GetMult(temp,i))
485  {
486  Pr=NewPoly();
487  SetProl(temp,i);
488 
489  Pr->prolonged=i;
490  Pr->history=pLmInit(temp->history);
491  Pr->lead=pLmInit(temp->lead);
492  pIncrExp(Pr->lead,i+1);
493  pSetm(Pr->lead);
494  InitProl(temp);
495 
496  Pr->changed=0;
497 // pTest(Pr->root);
498  InsertInCount(Q,Pr);
499  }
500 }
STATIC_VAR jList * Q
Definition: janet.cc:30
void SetProl(Poly *x, int i)
Definition: janet.cc:441
Definition: janet.h:14
#define pSetm(p)
Definition: polys.h:267
void InitProl(Poly *p)
Definition: janet.cc:416
poly history
Definition: janet.h:19
int changed
Definition: janet.h:22
int GetMult(Poly *x, int i)
Definition: janet.cc:421
#define pIncrExp(p, i)
Definition: polys.h:43
Poly * NewPoly(poly p)
Definition: janet.cc:361
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
int i
Definition: cfEzgcd.cc:125
void InsertInCount(jList *x, Poly *y)
Definition: janet.cc:571
poly lead
Definition: janet.h:20
int GetProl(Poly *x, int i)
Definition: janet.cc:436
int prolonged
Definition: janet.h:23

◆ ReducePoly()

int ReducePoly ( Poly x,
poly  from,
Poly y 
)

Definition at line 119 of file janet.cc.

120 {
121  if (!x->root || !y->root)
122  return 0;
123 
124 /* poly b1=pMDivide(from,y->root);
125 
126  number gcd=n_Gcd(pGetCoeff(from),pGetCoeff(y->root),currRing->cf);
127 
128  number a1=nDiv(pGetCoeff(y->root),gcd);
129  pGetCoeff(b1)=nDiv(pGetCoeff(from),gcd);
130 
131  x->root=pMult_nn(x->root,a1);
132  nDelete(&a1);*/
133 
134 // x->root=pMinus_mm_Mult_qq(x->root,b1,y->root);
135 // pDelete(&b1);
136 
137  ksOldSpolyTail(y->root,x->root,from,NULL,currRing);
138  y->root_l=0;
139 
140  return 1;
141 }
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether, ring r)
Definition: kInline.h:1150
#define NULL
Definition: omList.c:12
poly root
Definition: janet.h:16
int root_l
Definition: janet.h:18

◆ ReducePolyLead()

int ReducePolyLead ( Poly x,
Poly y 
)

Definition at line 74 of file janet.cc.

75 {
76  if (!x->root || !y->root)
77  return 0;
78 
79 /* poly b1=pMDivide(x->root,y->root);
80 
81  number gcd=n_Gcd(pGetCoeff(x->root),pGetCoeff(y->root),currRing->cf);
82 
83  number a1=nDiv(pGetCoeff(y->root),gcd);
84  pGetCoeff(b1)=nDiv(pGetCoeff(x->root),gcd);
85 
86  x->root=pMult_nn(x->root,a1);
87  nDelete(&a1);
88 
89  x->root=pMinus_mm_Mult_qq(x->root,b1,y->root);
90 
91  pDelete(&b1);
92 */
93 #if 1
94  if (x->root_b==NULL)
95  {
96  if (x->root_l<=0) x->root_l=pLength(x->root);
98  kBucketInit(x->root_b,x->root,x->root_l);
99  }
100  number coef;
101  if (y->root_l<=0) y->root_l=pLength(y->root);
102  coef=kBucketPolyRed(x->root_b,y->root,y->root_l,NULL);
103  nDelete(&coef);
104  x->root=kBucketGetLm(x->root_b);
105  if (x->root==NULL)
106  {
107  kBucketDestroy(&x->root_b);
108  x->root_b=NULL;
109  x->root_l=0;
110  }
111 #else
112  x->root=ksOldSpolyRed(y->root,x->root,NULL);
113 #endif
114 // if (x->root) p_SimpleContent(x->root,5,currRing);
115 
116  return 1;
117 }
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:493
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1079
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:506
kBucket_pt root_b
Definition: janet.h:17
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:216
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define nDelete(n)
Definition: numbers.h:16
#define NULL
Definition: omList.c:12
poly root
Definition: janet.h:16
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1120
int root_l
Definition: janet.h:18
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:209

◆ SetMult()

void SetMult ( Poly x,
int  i 
)

Definition at line 426 of file janet.cc.

427 {
428  x->mult[i/8] |= Mask[i%8];
429 }
STATIC_VAR int Mask[8]
Definition: janet.cc:36
int i
Definition: cfEzgcd.cc:125
char * mult
Definition: janet.h:21

◆ SetProl()

void SetProl ( Poly x,
int  i 
)

Definition at line 441 of file janet.cc.

442 {
443  (x->mult+offset)[i/8] |= Mask[i%8];
444 }
STATIC_VAR int Mask[8]
Definition: janet.cc:36
int i
Definition: cfEzgcd.cc:125
char * mult
Definition: janet.h:21
STATIC_VAR int offset
Definition: janet.cc:29

◆ sp_div()

int sp_div ( poly  m1,
poly  m2,
int  from 
)

Definition at line 821 of file janet.cc.

822 {
823 
824  if (pow_(m2) == 0 && pow_(m1)) return 0;
825 
826  for(int k=from; k < currRing->N; k++)
827  if (pGetExp(m1,k+1) < pGetExp(m2,k+1)) return 0;
828 
829  return 1;
830 }
#define pow_(x)
Definition: janet.cc:43
int k
Definition: cfEzgcd.cc:92
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41

◆ T2G()

void T2G ( )

Definition at line 1085 of file janet.cc.

1086 {
1087  LCI i=T->root;
1088  while (i)
1089  {
1090  insert_(&G,i->info);
1091  i=i->next;
1092  }
1093 }
ListNode * root
Definition: janet.h:36
ListNode * LCI
Definition: janet.h:48
void insert_(TreeM **tree, Poly *item)
Definition: janet.cc:912
int i
Definition: cfEzgcd.cc:125
STATIC_VAR TreeM * G
Definition: janet.cc:31
STATIC_VAR jList * T
Definition: janet.cc:30

◆ ValidatePoly()

int ValidatePoly ( Poly x,
TreeM  
)

Definition at line 299 of file janet.cc.

300 {
301  Poly /*f,*/*g;
302  // int g1,f1;
303 
304  if (x->root) return 1;
305 
306  g=is_present(T,x->history); //it's a prolongation - do we have a parent ?
307 
308  if (!g) return 0; //if not - kill him !
309 
310  poly lmX=pMDivide(x->lead,g->root);
311  pSetCoeff0(lmX,nInit(1));
312 
313 /* if ((f=is_div_(F,lmX)) != NULL)
314  {
315  int pX=pow_(lmX);
316  int phX=pow_(x->history);
317 
318  if (pX!=phX)
319  {
320  int phF=pow_(f->history);
321  if (pX >= (phX+phF))
322  {
323  pLmDelete(&lmX);
324  //x->root=NULL;
325  return 0;
326  }
327 
328  for(int i=0, gg=0 ; i<currRing->N;i++)
329  if ((g1=pGetExp(x->history,i+1)) > (f1=pGetExp(f->history,i+1)))
330  gg+=g1;
331  else
332  gg+=f1;
333 
334  if (pX > gg)
335  {
336  pLmDelete(&lmX);
337  return 0;
338  }
339  int pF=pow_(f->root);
340 
341  if ((pX == pF) && (pF == phF))
342  f->history=x->history;
343  }
344  }
345 
346  pLmDelete(&lmX);
347 
348 */
349  x->root=pCopy(g->root);
350  x->root_l=g->root_l;
351 
352  x->root=pMult(x->root,lmX);
353 
354  pTest(x->root);
355 
356  x->prolonged=-1;
357 
358  return 1;
359 }
Definition: janet.h:14
#define pTest(p)
Definition: polys.h:411
poly history
Definition: janet.h:19
g
Definition: cfModGcd.cc:4031
#define pMDivide(a, b)
Definition: polys.h:289
Poly * is_present(jList *F, poly x)
Definition: janet.cc:729
#define pMult(p, q)
Definition: polys.h:203
poly lead
Definition: janet.h:20
poly root
Definition: janet.h:16
#define pSetCoeff0(p, n)
Definition: monomials.h:59
int root_l
Definition: janet.h:18
#define nInit(i)
Definition: numbers.h:24
int prolonged
Definition: janet.h:23
STATIC_VAR jList * T
Definition: janet.cc:30
#define pCopy(p)
return a copy of the poly
Definition: polys.h:181

Variable Documentation

◆ degree_compatible

STATIC_VAR int degree_compatible

Definition at line 34 of file janet.cc.

◆ FreeNodes

STATIC_VAR NodeM* FreeNodes

Definition at line 33 of file janet.cc.

◆ G

Definition at line 31 of file janet.cc.

◆ h

Definition at line 971 of file janet.cc.

◆ jDeg

VAR pFDegProc jDeg

Definition at line 42 of file janet.cc.

◆ ListGreatMove

STATIC_VAR int(* ListGreatMove) (jList *, jList *, poly)

Definition at line 35 of file janet.cc.

◆ Mask

STATIC_VAR int Mask[8] ={0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1}

Definition at line 36 of file janet.cc.

◆ offset

STATIC_VAR int offset

Definition at line 29 of file janet.cc.

◆ Q

Definition at line 30 of file janet.cc.

◆ T

Definition at line 30 of file janet.cc.

◆ temp_l

STATIC_VAR Poly* temp_l

Definition at line 755 of file janet.cc.