My Project
Loading...
Searching...
No Matches
Functions
freealgebra.cc File Reference
#include "Singular/libsingular.h"
#include "kernel/combinatorics/stairc.h"
#include <vector>

Go to the source code of this file.

Functions

static BOOLEAN freeAlgebra (leftv res, leftv args)
 
static BOOLEAN stest (leftv res, leftv args)
 
static BOOLEAN btest (leftv res, leftv h)
 
static BOOLEAN lpLmDivides (leftv res, leftv h)
 
static BOOLEAN lpVarAt (leftv res, leftv h)
 
static BOOLEAN lpUfnarovskiGraph (leftv res, leftv h)
 
int SI_MOD_INIT() freealgebra (SModulFunctions *p)
 

Function Documentation

◆ btest()

static BOOLEAN btest ( leftv  res,
leftv  h 
)
static

Definition at line 81 of file freealgebra.cc.

82{
83 const short t[]={1,POLY_CMD};
84 if (iiCheckTypes(h,t,1))
85 {
86 poly p=(poly)h->Data();
87 res->rtyp = INT_CMD;
88 res->data = (void*)(long)pLastVblock(p);
89 return FALSE;
90 }
91 else return TRUE;
92}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4078
CanonicalForm res
Definition: facAbsFact.cc:60
@ POLY_CMD
Definition: grammar.cc:289
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6572
STATIC_VAR Poly * h
Definition: janet.cc:971
#define pLastVblock(p)
Definition: shiftop.h:32
@ INT_CMD
Definition: tok.h:96

◆ freeAlgebra()

static BOOLEAN freeAlgebra ( leftv  res,
leftv  args 
)
static

Definition at line 12 of file freealgebra.cc.

13{
14 const short t1[]={2,RING_CMD,INT_CMD};
15 const short t2[]={3,RING_CMD,INT_CMD,INT_CMD};
16 if (iiCheckTypes(args, t2, 0) || iiCheckTypes(args, t1, 1))
17 {
18 ring r=(ring)args->Data();
19 int d=(int)(long)args->next->Data();
20 if (d<2)
21 {
22 WerrorS("degree must be >=2");
23 return TRUE;
24 }
25 int i=0;
26 while(r->order[i]!=0)
27 {
28 if ((r->order[i]==ringorder_c) ||(r->order[i]==ringorder_C)) i++;
29 else if ((r->block0[i]==1)&&(r->block1[i]==r->N)) i++;
30 else
31 {
32 WerrorS("only for rings with a global ordering of one block");
33 return TRUE;
34 }
35 }
36 if ((r->order[i]!=0)
38 {
39 WerrorS("only for rings with a global ordering of one block");
40 //Werror("only for rings with a global ordering of one block,i=%d, o=%d",i,r->order[i]);
41 return TRUE;
42 }
43 int ncGenCount = 0;
44 if (iiCheckTypes(args,t2,0))
45 ncGenCount = (int)(long) args->next->next->Data();
46 ring R=freeAlgebra(r,d,ncGenCount);
47 res->rtyp=RING_CMD;
48 res->data=R;
49 return R==NULL;
50 }
51 return TRUE;
52}
int i
Definition: cfEzgcd.cc:132
void * Data()
Definition: subexpr.cc:1162
leftv next
Definition: subexpr.h:86
void WerrorS(const char *s)
Definition: feFopen.cc:24
static BOOLEAN freeAlgebra(leftv res, leftv args)
Definition: freealgebra.cc:12
@ RING_CMD
Definition: grammar.cc:281
#define NULL
Definition: omList.c:12
@ ringorder_C
Definition: ring.h:73
@ ringorder_c
Definition: ring.h:72
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:760
#define R
Definition: sirandom.c:27

◆ freealgebra()

int SI_MOD_INIT() freealgebra ( SModulFunctions p)

Definition at line 160 of file freealgebra.cc.

161{
162#ifdef HAVE_SHIFTBBA
163 p->iiAddCproc("freealgebra.so","freeAlgebra",FALSE,freeAlgebra);
164 p->iiAddCproc("freealgebra.so","lpLmDivides",FALSE,lpLmDivides);
165 p->iiAddCproc("freealgebra.so","lpVarAt",FALSE,lpVarAt);
166 p->iiAddCproc("freealgebra.so","lpUfnarovskiGraph",FALSE,lpUfnarovskiGraph);
167
168 p->iiAddCproc("freealgebra.so","stest",TRUE,stest);
169 p->iiAddCproc("freealgebra.so","btest",TRUE,btest);
170#endif
171 return (MAX_TOK);
172}
static BOOLEAN lpUfnarovskiGraph(leftv res, leftv h)
Definition: freealgebra.cc:131
static BOOLEAN lpVarAt(leftv res, leftv h)
Definition: freealgebra.cc:117
static BOOLEAN btest(leftv res, leftv h)
Definition: freealgebra.cc:81
static BOOLEAN lpLmDivides(leftv res, leftv h)
Definition: freealgebra.cc:94
static BOOLEAN stest(leftv res, leftv args)
Definition: freealgebra.cc:54
@ MAX_TOK
Definition: tok.h:218

◆ lpLmDivides()

static BOOLEAN lpLmDivides ( leftv  res,
leftv  h 
)
static

Definition at line 94 of file freealgebra.cc.

95{
96 const short t1[]={2,POLY_CMD,POLY_CMD};
97 const short t2[]={2,IDEAL_CMD,POLY_CMD};
98 if (iiCheckTypes(h,t1,0))
99 {
100 poly p=(poly)h->Data();
101 poly q=(poly)h->next->Data();
102 res->rtyp = INT_CMD;
103 res->data = (void*)(long)p_LPDivisibleBy(p, q, currRing);
104 return FALSE;
105 }
106 else if (iiCheckTypes(h,t2,1))
107 {
108 ideal I=(ideal)h->Data();
109 poly q=(poly)h->next->Data();
110 res->rtyp = INT_CMD;
111 res->data=(void*)(long) p_LPDivisibleBy(I, q, currRing);
112 return FALSE;
113 }
114 else return TRUE;
115}
@ IDEAL_CMD
Definition: grammar.cc:284
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
BOOLEAN p_LPDivisibleBy(poly a, poly b, const ring r)
Definition: shiftop.cc:776

◆ lpUfnarovskiGraph()

static BOOLEAN lpUfnarovskiGraph ( leftv  res,
leftv  h 
)
static

Definition at line 131 of file freealgebra.cc.

132{
133 const short t[]={1,IDEAL_CMD};
134 if (iiCheckTypes(h,t,1))
135 {
136 ideal I = (ideal) h->Data();
137 res->rtyp = LIST_CMD;
138
139 ideal standardWords;
140 intvec* graph = lp_ufnarovskiGraph(I, standardWords);
141
143 li->Init(2);
144 li->m[0].rtyp=INTMAT_CMD;
145 li->m[1].rtyp=IDEAL_CMD;
146 li->m[0].data=graph;
147 li->m[1].data=standardWords;
148
149 res->data = li;
150
151 if (errorreported) return TRUE;
152 return FALSE;
153 }
154 else return TRUE;
155}
Definition: intvec.h:23
int rtyp
Definition: subexpr.h:91
void * data
Definition: subexpr.h:88
Definition: lists.h:24
sleftv * m
Definition: lists.h:46
INLINE_THIS void Init(int l=0)
VAR short errorreported
Definition: feFopen.cc:23
@ INTMAT_CMD
Definition: grammar.cc:279
intvec * lp_ufnarovskiGraph(ideal G, ideal &standardWords)
Definition: hdegree.cc:1801
VAR omBin slists_bin
Definition: lists.cc:23
slists * lists
Definition: mpr_numeric.h:146
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
@ LIST_CMD
Definition: tok.h:118

◆ lpVarAt()

static BOOLEAN lpVarAt ( leftv  res,
leftv  h 
)
static

Definition at line 117 of file freealgebra.cc.

118{
119 const short t[]={2,POLY_CMD,INT_CMD};
120 if (iiCheckTypes(h,t,1))
121 {
122 poly p=(poly)h->Data();
123 int pos=(int)((long)(h->next->Data()));
124 res->rtyp = POLY_CMD;
125 res->data = p_LPVarAt(p, pos, currRing);
126 return FALSE;
127 }
128 else return TRUE;
129}
poly p_LPVarAt(poly p, int pos, const ring r)
Definition: shiftop.cc:845

◆ stest()

static BOOLEAN stest ( leftv  res,
leftv  args 
)
static

Definition at line 54 of file freealgebra.cc.

55{
56 const short t[]={2,POLY_CMD,INT_CMD};
57 if (iiCheckTypes(args,t,1))
58 {
59 poly p=(poly)args->CopyD();
60 args=args->next;
61 int sh=(int)((long)(args->Data()));
62 if (sh<0)
63 {
64 WerrorS("negative shift for pLPshift");
65 return TRUE;
66 }
67 int L = pLastVblock(p);
68 if (L+sh > currRing->N/currRing->isLPring)
69 {
70 WerrorS("pLPshift: too big shift requested\n");
71 return TRUE;
72 }
74 res->data = p;
75 res->rtyp = POLY_CMD;
76 return FALSE;
77 }
78 else return TRUE;
79}
void * CopyD(int t)
Definition: subexpr.cc:710
void p_LPshift(poly p, int sh, const ring ri)
Definition: shiftop.cc:392