My Project
Loading...
Searching...
No Matches
Functions | Variables
customstd.cc File Reference
#include "Singular/libsingular.h"
#include "libpolys/polys/prCopy.h"

Go to the source code of this file.

Functions

static BOOLEAN satstd (leftv res, leftv args)
 
static BOOLEAN abort_if_monomial_sp (kStrategy strat)
 
static BOOLEAN print_spoly (kStrategy strat)
 
static BOOLEAN print_syz (kStrategy strat)
 
static BOOLEAN std_print_spoly (leftv res, leftv args)
 
static ideal idGroebner_print (ideal temp, int syzComp, intvec *w=NULL, tHomog hom=testHomog)
 
static ideal idPrepare_print (ideal h1, ideal h11, tHomog hom, int syzcomp, intvec **w)
 
static BOOLEAN monomialabortstd (leftv res, leftv args)
 
int SI_MOD_INIT() customstd (SModulFunctions *p)
 

Variables

STATIC_VAR charsi_filename
 
STATIC_VAR int si_filenr
 

Function Documentation

◆ abort_if_monomial_sp()

static BOOLEAN abort_if_monomial_sp ( kStrategy  strat)
static

Definition at line 92 of file customstd.cc.

93{
94 BOOLEAN b = FALSE; // set b to TRUE, if spoly was changed,
95 // let it remain FALSE otherwise
96 if (strat->P.t_p==NULL)
97 {
98 poly p=strat->P.p;
99 if (pNext(p)==NULL)
100 {
101 while ((strat->Ll >= 0))
102 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
103 return FALSE;
104 }
105 }
106 else
107 {
108 poly p=strat->P.t_p;
109 if (pNext(p)==NULL)
110 {
111 while ((strat->Ll >= 0))
112 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
113 return FALSE;
114 }
115 }
116 return b; // return TRUE if sp was changed, FALSE if not
117}
int BOOLEAN
Definition auxiliary.h:87
#define FALSE
Definition auxiliary.h:96
int p
Definition cfModGcd.cc:4078
CanonicalForm b
Definition cfModGcd.cc:4103
int Ll
Definition kutil.h:351
LObject P
Definition kutil.h:302
LSet L
Definition kutil.h:327
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition kutil.cc:1214
#define pNext(p)
Definition monomials.h:36
#define NULL
Definition omList.c:12

◆ customstd()

int SI_MOD_INIT() customstd ( SModulFunctions p)

Definition at line 657 of file customstd.cc.

658{
659 // p->iiAddCproc("std_demo","std_with_display",FALSE,std_with_display);
660 p->iiAddCproc("customstd.lib","satstd",FALSE,satstd);
661 // p->iiAddCproc("std_demo","satstdWithInitialCheck",FALSE,satstdWithInitialCheck);
662 p->iiAddCproc("customstd.lib","monomialabortstd",FALSE,monomialabortstd);
663 // PrintS("init of std_demo - type `listvar(Std_demo);` to its contents\n");
664 p->iiAddCproc("customstd.lib","std_print_spoly",FALSE,std_print_spoly);
665 p->iiAddCproc("customstd.lib","syz_print_spoly",FALSE,std_print_spoly);
666
667 return (MAX_TOK);
668}
static BOOLEAN satstd(leftv res, leftv args)
Definition customstd.cc:40
static BOOLEAN std_print_spoly(leftv res, leftv args)
Definition customstd.cc:169
static BOOLEAN monomialabortstd(leftv res, leftv args)
Definition customstd.cc:459
@ MAX_TOK
Definition tok.h:218

◆ idGroebner_print()

static ideal idGroebner_print ( ideal  temp,
int  syzComp,
intvec w = NULL,
tHomog  hom = testHomog 
)
static

Definition at line 189 of file customstd.cc.

190{
191 ideal temp1;
192 if (w==NULL)
193 {
194 if (hom==testHomog)
195 hom=(tHomog)idHomModule(temp,currRing->qideal,&w); //sets w to weight vector or NULL
196 }
197 else
198 {
199 w=ivCopy(w);
200 hom=isHomog;
201 }
202 temp1 = kStd(temp,currRing->qideal,hom,&w,NULL,syzComp,0,NULL,print_syz);
203 idDelete(&temp);
204 if (w!=NULL) delete w;
205 return temp1;
206}
static BOOLEAN print_syz(kStrategy strat)
Definition customstd.cc:141
const CanonicalForm & w
Definition facAbsFact.cc:51
#define idDelete(H)
delete an ideal
Definition ideals.h:29
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition ideals.h:96
intvec * ivCopy(const intvec *o)
Definition intvec.h:145
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition kstd1.cc:2449
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
tHomog
Definition structs.h:35
@ isHomog
Definition structs.h:37
@ testHomog
Definition structs.h:38

◆ idPrepare_print()

static ideal idPrepare_print ( ideal  h1,
ideal  h11,
tHomog  hom,
int  syzcomp,
intvec **  w 
)
static

Definition at line 208 of file customstd.cc.

209{
210 ideal h2,h22;
211 int j,k;
212 poly p,q;
213
214 assume(!idIs0(h1));
216 if (h11!=NULL)
217 {
219 h22=idCopy(h11);
220 }
221 h2=idCopy(h1);
222 int i = IDELEMS(h2);
223 if (h11!=NULL) i+=IDELEMS(h22);
224 if (k == 0)
225 {
227 if (h11!=NULL) id_Shift(h22,1,currRing);
228 k = 1;
229 }
230 if (syzcomp<k)
231 {
232 Warn("syzcomp too low, should be %d instead of %d",k,syzcomp);
233 syzcomp = k;
235 }
236 h2->rank = syzcomp+i;
237
238 for (j=0; j<IDELEMS(h2); j++)
239 {
240 p = h2->m[j];
241 q = pOne();
242 pSetComp(q,syzcomp+1+j);
243 pSetmComp(q);
244 if (p!=NULL)
245 {
246 {
247 while (pNext(p)) pIter(p);
248 p->next = q;
249 }
250 }
251 else
252 h2->m[j]=q;
253 }
254 if (h11!=NULL)
255 {
259 h2=h;
260 }
261
262 idTest(h2);
263 #if 0
265 PrintS(" --------------before std------------------------\n");
266 ipPrint_MA0(TT,"T");
267 PrintLn();
268 idDelete((ideal*)&TT);
269 #endif
270
271 ideal h3;
272 if (w!=NULL) h3=idGroebner_print(h2,syzcomp,*w,hom);
273 else h3=idGroebner_print(h2,syzcomp,NULL,hom);
274 return h3;
275}
static int si_max(const int a, const int b)
Definition auxiliary.h:124
int i
Definition cfEzgcd.cc:132
int k
Definition cfEzgcd.cc:99
static ideal idGroebner_print(ideal temp, int syzComp, intvec *w=NULL, tHomog hom=testHomog)
Definition customstd.cc:189
#define Warn
Definition emacs.cc:77
int j
Definition facHensel.cc:110
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define idTest(id)
Definition ideals.h:47
ideal idCopy(ideal A)
Definition ideals.h:60
void ipPrint_MA0(matrix m, const char *name)
Definition ipprint.cc:57
STATIC_VAR Poly * h
Definition janet.cc:971
#define assume(x)
Definition mod2.h:389
#define pIter(p)
Definition monomials.h:37
#define pSetComp(p, v)
Definition polys.h:38
#define pSetmComp(p)
TODO:
Definition polys.h:273
#define pOne()
Definition polys.h:315
void PrintS(const char *s)
Definition reporter.cc:284
void PrintLn()
Definition reporter.cc:310
void rSetSyzComp(int k, const ring r)
Definition ring.cc:5147
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
matrix id_Module2Matrix(ideal mod, const ring R)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
concat the lists h1 and h2 without zeros
void id_Shift(ideal M, int s, const ring r)
#define IDELEMS(i)

◆ monomialabortstd()

static BOOLEAN monomialabortstd ( leftv  res,
leftv  args 
)
static

Definition at line 459 of file customstd.cc.

460{
461 if (args!=NULL)
462 {
463 if ((args->Typ()==IDEAL_CMD) && (args->next==NULL))
464 {
465 ideal I=(ideal)args->Data();
468 res->rtyp=IDEAL_CMD;
469 res->data=(char*)I;
470 return FALSE;
471 }
472 }
473 WerrorS("monomialabortstd: unexpected parameters");
474 return TRUE;
475}
#define TRUE
Definition auxiliary.h:100
int Typ()
Definition subexpr.cc:1030
void * Data()
Definition subexpr.cc:1173
leftv next
Definition subexpr.h:86
static BOOLEAN abort_if_monomial_sp(kStrategy strat)
Definition customstd.cc:92
CanonicalForm res
Definition facAbsFact.cc:60
void WerrorS(const char *s)
Definition feFopen.cc:24
@ IDEAL_CMD
Definition grammar.cc:284
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size

◆ print_spoly()

static BOOLEAN print_spoly ( kStrategy  strat)
static

Definition at line 120 of file customstd.cc.

121{
122 char *s;
123 if (strat->P.t_p==NULL)
124 {
125 s=pString(strat->P.p);
126 }
127 else
128 {
129 poly p=strat->P.t_p;
130 s=p_String(p,strat->tailRing);
131 }
132 FILE *f=fopen(si_filename,"a");
133 fwrite(s,strlen(s),1,f);
134 fwrite("\n",1,1,f);
135 fflush(f);
136 fclose(f);
137 return FALSE; // return TRUE if sp was changed, FALSE if not
138}
FILE * f
Definition checklibs.c:9
ring tailRing
Definition kutil.h:343
STATIC_VAR char * si_filename
Definition customstd.cc:119
const CanonicalForm int s
Definition facAbsFact.cc:51
char * p_String(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:322
char * pString(poly p)
Definition polys.h:306

◆ print_syz()

static BOOLEAN print_syz ( kStrategy  strat)
static

Definition at line 141 of file customstd.cc.

142{
143 char *s=NULL;
144 if (strat->P.t_p==NULL)
145 {
146 if (pGetComp(strat->P.p)>=strat->syzComp)
147 s=pString(strat->P.p);
148 }
149 else
150 {
151 if (p_GetComp(strat->P.t_p,strat->tailRing)>=strat->syzComp)
152 s=p_String(strat->P.t_p,strat->tailRing);
153 }
154 if (s!=NULL)
155 {
156 size_t len=strlen(si_filename)+12;
157 char *fn=(char*)malloc(len);
158 snprintf(fn,len, "%s.%d",si_filename,si_filenr);
159 si_filenr++;
160 FILE *f=fopen(fn,"w");
161 fwrite(s,strlen(s),1,f);
162 fwrite("\n",1,1,f);
163 fclose(f);
164 free(fn);
165 }
166 return FALSE; // return TRUE if sp was changed, FALSE if not
167}
int syzComp
Definition kutil.h:354
STATIC_VAR int si_filenr
Definition customstd.cc:140
#define p_GetComp(p, r)
Definition monomials.h:64
#define free
Definition omAllocFunc.c:14
#define malloc
Definition omAllocFunc.c:12
#define pGetComp(p)
Component.
Definition polys.h:37

◆ satstd()

static BOOLEAN satstd ( leftv  res,
leftv  args 
)
static

Definition at line 40 of file customstd.cc.

41{
42 leftv u = args;
43 if ((u!=NULL)
44 && ((u->Typ()==IDEAL_CMD)||(u->Typ()==MODUL_CMD)))
45 {
46 ideal I=(ideal)u->Data();
47 leftv v = u->next;
48
49 res->rtyp=IDEAL_CMD;
50 ideal J;
51 if (v==NULL)
52 {
54 }
55 else
56 {
57 if (v->Typ()==IDEAL_CMD)
58 {
59 J = (ideal) v->Data();
60 }
61 else
62 {
63 args->CleanUp();
64 WerrorS("satstd: unexpected parameters");
65 return TRUE;
66 }
67 }
69
70#if 0 /* unused */
71 if (idealCache)
72 {
74 res->data = (char*) idealCache;
76 }
77 else
78#endif
79 {
81 res->data=(char*)I;
82 }
83 if (v==NULL) id_Delete(&J,currRing);
84 args->CleanUp();
86 return (res->data==NULL);
87 }
88 WerrorS("satstd: unexpected parameters");
89 return TRUE;
90}
Class used for (list of) interpreter objects.
Definition subexpr.h:83
void CleanUp(ring r=currRing)
Definition subexpr.cc:348
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
@ MODUL_CMD
Definition grammar.cc:287
ideal id_Satstd(const ideal I, ideal J, const ring r)
Definition ideals.cc:3116
#define setFlag(A, F)
Definition ipid.h:113
#define FLAG_STD
Definition ipid.h:106
ideal id_MaxIdeal(const ring r)
initialise the maximal ideal (at 0)

◆ std_print_spoly()

static BOOLEAN std_print_spoly ( leftv  res,
leftv  args 
)
static

Definition at line 169 of file customstd.cc.

170{
171 if (args!=NULL)
172 {
173 if ((args->Typ()==IDEAL_CMD) && (args->next!=NULL)
174 && (args->next->Typ()==STRING_CMD))
175 {
176 si_filename=(char*)args->next->Data();
177 ideal I=(ideal)args->Data();
180 res->rtyp=IDEAL_CMD;
181 res->data=(char*)I;
182 return FALSE;
183 }
184 }
185 WerrorS("std_print_spoly: unexpected parameters");
186 return TRUE;
187}
static BOOLEAN print_spoly(kStrategy strat)
Definition customstd.cc:120
@ STRING_CMD
Definition tok.h:185

Variable Documentation

◆ si_filename

STATIC_VAR char* si_filename

Definition at line 119 of file customstd.cc.

◆ si_filenr

STATIC_VAR int si_filenr

Definition at line 140 of file customstd.cc.