My Project
Loading...
Searching...
No Matches
Functions
wrapper.cc File Reference
#include "kernel/mod2.h"
#include "polys/monomials/ring.h"
#include "kernel/polys.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/ideals.h"
#include "kernel/GBEngine/janet.h"
#include "Singular/subexpr.h"

Go to the source code of this file.

Functions

static BOOLEAN jInitBasis (ideal v, jList **TT, jList **QQ)
 
BOOLEAN jjStdJanetBasis (leftv res, leftv v, int flag)
 flag: 0: JB, 1: SB More...
 

Function Documentation

◆ jInitBasis()

static BOOLEAN jInitBasis ( ideal  v,
jList **  TT,
jList **  QQ 
)
static

Definition at line 13 of file wrapper.cc.

14{
16 {
17 WerrorS("janet only for well-orderings");
18 return TRUE;
19 }
20
22
23 jList *Q=(jList *)GCM(sizeof(jList));
24 Q->root=NULL;
25
26 jList *T=(jList *)GCM(sizeof(jList));
27 T->root=NULL;
28
29 for (int i=0; i < IDELEMS(v); i++)
30 {
31 if (v->m[i]!=NULL)
32 {
33 Poly *beg=NewPoly(pCopy(v->m[i]));
34
35 InitHistory(beg);
36 InitProl(beg);
37 InitLead(beg);
38
39 InsertInCount(Q,beg);
40 }
41 }
42
43 BOOLEAN r= !(ComputeBasis(T,Q));
44 *TT=T;
45 *QQ=Q;
46 return r;
47}
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
int i
Definition: cfEzgcd.cc:132
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
void WerrorS(const char *s)
Definition: feFopen.cc:24
void InitLead(Poly *p)
Definition: janet.cc:409
STATIC_VAR jList * T
Definition: janet.cc:30
void InitHistory(Poly *p)
Definition: janet.cc:402
int ComputeBasis(jList *_lT, jList *_lQ)
Definition: janet.cc:1000
void InitProl(Poly *p)
Definition: janet.cc:416
void InsertInCount(jList *x, Poly *y)
Definition: janet.cc:571
Poly * NewPoly(poly p)
Definition: janet.cc:361
void Initialization(char *Ord)
Definition: janet.cc:952
ListNode * root
Definition: janet.h:36
#define GCM(sz)
Definition: janet.h:6
Definition: janet.h:35
#define NULL
Definition: omList.c:12
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185
char * rOrdStr(ring r)
Definition: ring.cc:521
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:760
#define IDELEMS(i)
Definition: simpleideals.h:23
#define Q
Definition: sirandom.c:26
Definition: janet.h:15

◆ jjStdJanetBasis()

BOOLEAN jjStdJanetBasis ( leftv  res,
leftv  v,
int  flag 
)

flag: 0: JB, 1: SB

Definition at line 50 of file wrapper.cc.

51{
52 ideal result;
53
54 jList *T;
55 jList *Q;
56 ideal I=(ideal)v->Data();
57 BOOLEAN is_zero=TRUE;
58 for (int i=0; i < IDELEMS(I); i++)
59 {
60 if ((I->m[i]!=NULL)&& (pIsConstant(I->m[i])))
61 {
62 goto zero;
63 }
64 else
65 is_zero=FALSE;
66 }
67 if (is_zero)
68 goto zero;
69 if (!jInitBasis(I,&T,&Q))
70 {
71 int dpO=(strstr(rOrdStr(currRing),"dp")!=NULL);
72 int ideal_length;
73 if (flag==1)
74 ideal_length= dpO ? GB_length() : CountList(T);
75 else
76 ideal_length=CountList(T);
77
78 result=idInit(ideal_length,1);
79
80 int ideal_index=0;
81
82 LCI iT=T->root;
83
84 while(iT)
85 {
86 pTest(iT->info->root);
87 if ((flag==1) && dpO)
88 {
89 //if (pTotaldegree(iT->info->lead) == pTotaldegree(iT->info->history))
90 if (p_Deg(iT->info->lead,currRing) == p_Deg(iT->info->history,currRing))
91 {
92 result->m[ideal_length-ideal_index-1]=pCopy(iT->info->root);
93 if (!nGreaterZero(pGetCoeff(iT->info->root)))
94 result->m[ideal_length-ideal_index-1]
95 =pNeg(result->m[ideal_length-ideal_index-1]);
96
97 ideal_index++;
98 }
99 }
100 else
101 {
102 result->m[ideal_length-ideal_index-1]=pCopy(iT->info->root);
103 if (!nGreaterZero(pGetCoeff(iT->info->root)))
104 result->m[ideal_length-ideal_index-1]
105 =pNeg(result->m[ideal_length-ideal_index-1]);
106
107 ideal_index++;
108 }
109 iT=iT->next;
110 }
111
112 if ((flag==1) && (dpO==0))
113 {
114 //Print ("interred\n");
117 }
118 res->data = (char *)result;
119 res->rtyp = IDEAL_CMD;
120 DestroyList(Q);
121 DestroyList(T);
122 return FALSE;
123 }
124 else
125 return TRUE;
126
127zero:
128 result=idInit(1,1);
129 if (!is_zero) result->m[0]=pOne();
130 res->data = (char *)result;
131 res->rtyp = IDEAL_CMD;
132 return FALSE;
133}
#define FALSE
Definition: auxiliary.h:96
return result
Definition: facAbsBiFact.cc:75
CanonicalForm res
Definition: facAbsFact.cc:60
@ IDEAL_CMD
Definition: grammar.cc:284
void DestroyList(jList *x)
Definition: janet.cc:714
int CountList(jList *Q)
Definition: janet.cc:617
int GB_length()
Definition: janet.cc:740
ListNode * LCI
Definition: janet.h:50
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:3409
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
#define nGreaterZero(n)
Definition: numbers.h:27
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:587
#define pTest(p)
Definition: polys.h:414
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:238
#define pNeg(p)
Definition: polys.h:198
#define pOne()
Definition: polys.h:315
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static BOOLEAN jInitBasis(ideal v, jList **TT, jList **QQ)
Definition: wrapper.cc:13