Loading...
Searching...
No Matches
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

## Function Documentation

## jInitBasis()

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

static

Definition at line 13 of file wrapper.cc.

{
if (rHasLocalOrMixedOrdering(currRing))
{
WerrorS("janet only for well-orderings");
return TRUE;
}
Initialization(rOrdStr(currRing));
jList *Q=(jList *)GCM(sizeof(jList));
Q->root=NULL;
jList *T=(jList *)GCM(sizeof(jList));
T->root=NULL;
for (int i=0; i < IDELEMS(v); i++)
{
if (v->m[i]!=NULL)
{
Poly *beg=NewPoly(pCopy(v->m[i]));
InitHistory(beg);
InitProl(beg);
InitLead(beg);
InsertInCount(Q,beg);
}
}
BOOLEAN r= !(ComputeBasis(T,Q));
*TT=T;
*QQ=Q;
return r;
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
i
int i
Definition cfEzgcd.cc:132
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
InitLead
void InitLead(Poly *p)
Definition janet.cc:409
T
STATIC_VAR jList * T
Definition janet.cc:30
InitHistory
void InitHistory(Poly *p)
Definition janet.cc:402
ComputeBasis
int ComputeBasis(jList *_lT, jList *_lQ)
Definition janet.cc:1000
InitProl
void InitProl(Poly *p)
Definition janet.cc:416
InsertInCount
void InsertInCount(jList *x, Poly *y)
Definition janet.cc:571
NewPoly
Poly * NewPoly(poly p)
Definition janet.cc:361
Initialization
void Initialization(char *Ord)
Definition janet.cc:952
GCM
#define GCM(sz)
Definition janet.h:6
jList
Definition janet.h:35
NULL
#define NULL
Definition omList.c:12
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
rOrdStr
char * rOrdStr(ring r)
Definition ring.cc:526
rHasLocalOrMixedOrdering
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:769
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
Q
#define Q
Definition sirandom.c:26
Poly
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.

{
ideal result;
jList *T;
jList *Q;
ideal I=(ideal)v->Data();
BOOLEAN is_zero=TRUE;
for (int i=0; i < IDELEMS(I); i++)
{
if ((I->m[i]!=NULL)&& (pIsConstant(I->m[i])))
{
goto zero;
}
else
is_zero=FALSE;
}
if (is_zero)
goto zero;
if (!jInitBasis(I,&T,&Q))
{
int dpO=(strstr(rOrdStr(currRing),"dp")!=NULL);
int ideal_length;
if (flag==1)
ideal_length= dpO ? GB_length() : CountList(T);
else
ideal_length=CountList(T);
result=idInit(ideal_length,1);
int ideal_index=0;
LCI iT=T->root;
while(iT)
{
pTest(iT->info->root);
if ((flag==1) && dpO)
{
//if (pTotaldegree(iT->info->lead) == pTotaldegree(iT->info->history))
if (p_Deg(iT->info->lead,currRing) == p_Deg(iT->info->history,currRing))
{
result->m[ideal_length-ideal_index-1]=pCopy(iT->info->root);
if (!nGreaterZero(pGetCoeff(iT->info->root)))
result->m[ideal_length-ideal_index-1]
=pNeg(result->m[ideal_length-ideal_index-1]);
ideal_index++;
}
}
else
{
result->m[ideal_length-ideal_index-1]=pCopy(iT->info->root);
if (!nGreaterZero(pGetCoeff(iT->info->root)))
result->m[ideal_length-ideal_index-1]
=pNeg(result->m[ideal_length-ideal_index-1]);
ideal_index++;
}
iT=iT->next;
}
if ((flag==1) && (dpO==0))
{
//Print ("interred\n");
result=kInterRedOld(result);
idSkipZeroes(result);
}
res->data = (char *)result;
res->rtyp = IDEAL_CMD;
DestroyList(Q);
DestroyList(T);
return FALSE;
}
else
return TRUE;
zero:
result=idInit(1,1);
if (!is_zero) result->m[0]=pOne();
res->data = (char *)result;
res->rtyp = IDEAL_CMD;
return FALSE;
}
FALSE
#define FALSE
Definition auxiliary.h:97
result
return result
Definition facAbsBiFact.cc:76
res
CanonicalForm res
Definition facAbsFact.cc:60
IDEAL_CMD
@ IDEAL_CMD
Definition grammar.cc:285
DestroyList
void DestroyList(jList *x)
Definition janet.cc:714
CountList
int CountList(jList *Q)
Definition janet.cc:617
GB_length
int GB_length()
Definition janet.cc:740
LCI
ListNode * LCI
Definition janet.h:50
kInterRedOld
ideal kInterRedOld(ideal F, const ideal Q)
Definition kstd1.cc:3456
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
nGreaterZero
#define nGreaterZero(n)
Definition numbers.h:27
p_Deg
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586
pTest
#define pTest(p)
Definition polys.h:415
pIsConstant
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239
pNeg
#define pNeg(p)
Definition polys.h:199
pOne
#define pOne()
Definition polys.h:316
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition simpleideals.cc:201
jInitBasis
static BOOLEAN jInitBasis(ideal v, jList **TT, jList **QQ)
Definition wrapper.cc:13