Macros | Functions | Variables
walk.cc File Reference
#include <kernel/mod2.h>
#include <misc/intvec.h>
#include <Singular/cntrlc.h>
#include <misc/options.h>
#include <omalloc/omalloc.h>
#include <Singular/ipshell.h>
#include <Singular/ipconv.h>
#include <coeffs/coeffs.h>
#include <Singular/subexpr.h>
#include <polys/monomials/maps.h>
#include <kernel/combinatorics/stairc.h>
#include <kernel/GBEngine/kutil.h>
#include <kernel/GBEngine/khstd.h>
#include <Singular/walk.h>
#include <kernel/polys.h>
#include <kernel/ideals.h>
#include <Singular/ipid.h>
#include <Singular/tok.h>
#include <coeffs/numbers.h>
#include <polys/monomials/ring.h>
#include <kernel/GBEngine/kstd1.h>
#include <polys/matpol.h>
#include <polys/weight.h>
#include <kernel/GBEngine/syz.h>
#include <Singular/lists.h>
#include <polys/prCopy.h>
#include <polys/clapsing.h>
#include <coeffs/mpr_complex.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <math.h>
#include <sys/stat.h>
#include <unistd.h>
#include <float.h>
#include <misc/mylimits.h>
#include <sys/types.h>

Go to the source code of this file.

Macros

#define BUCHBERGER_ALG
 
#define INVEPS_SMALL_IN_FRACTAL
 
#define INVEPS_SMALL_IN_MPERTVECTOR
 
#define INVEPS_SMALL_IN_TRAN
 
#define FIRST_STEP_FRACTAL
 

Functions

BOOLEAN ErrorCheck ()
 
void Set_Error (BOOLEAN f)
 
static intset initec (int maxnr)
 
static unsigned long * initsevS (int maxnr)
 
static int * initS_2_R (int maxnr)
 
static ideal kInterRedCC (ideal F, ideal Q)
 
static void ivString (intvec *iv, const char *ch)
 
static long gcd (const long a, const long b)
 
static void cancel (mpz_t zaehler, mpz_t nenner)
 
static int MLmWeightedDegree (const poly p, intvec *weight)
 
static int MwalkWeightDegree (poly p, intvec *weight_vector)
 
static void MLmWeightedDegree_gmp (mpz_t result, const poly p, intvec *weight)
 
static poly MpolyInitialForm (poly g, intvec *curr_weight)
 
ideal MwalkInitialForm (ideal G, intvec *ivw)
 
static int test_w_in_ConeCC (ideal G, intvec *iv)
 
static long Mlcm (long &i1, long &i2)
 
static long MivDotProduct (intvec *a, intvec *b)
 
static intvecMivSub (intvec *a, intvec *b)
 
static intvecMExpPol (poly f)
 
int MivSame (intvec *u, intvec *v)
 
int M3ivSame (intvec *temp, intvec *u, intvec *v)
 
static ideal MstdCC (ideal G)
 
static ideal MstdhomCC (ideal G)
 
intvecMivMatrixOrder (intvec *iv)
 
intvecMivMatrixOrderRefine (intvec *iv, intvec *iw)
 
intvecMivdp (int nR)
 
intvecMivlp (int nR)
 
intvecMPertVectors (ideal G, intvec *ivtarget, int pdeg)
 
intvecMPertVectorslp (ideal G, intvec *ivtarget, int pdeg)
 
intvecMivMatrixOrderlp (int nV)
 
intvecMivMatrixOrderdp (int nV)
 
intvecMivWeightOrderlp (intvec *ivstart)
 
intvecMivWeightOrderdp (intvec *ivstart)
 
intvecMivUnit (int nV)
 
intvecMfpertvector (ideal G, intvec *ivtarget)
 
static ideal MidMult (ideal A, ideal B)
 
static ideal MLifttwoIdeal (ideal Gw, ideal M, ideal G)
 
static int MivComp (intvec *iva, intvec *ivb)
 
static int MivAbsMax (intvec *vec)
 
static intvecMwalkNextWeightCC (intvec *curr_weight, intvec *target_weight, ideal G)
 
intvecMkInterRedNextWeight (intvec *iva, intvec *ivb, ideal G)
 
static ring VMrDefault (intvec *va)
 
static ring VMrDefault1 (intvec *va)
 
static ring VMrRefine (intvec *va, intvec *vb)
 
static ring VMatrDefault (intvec *va)
 
static ring VMatrRefine (intvec *va, intvec *vb)
 
static void VMrDefaultlp (void)
 
static void DefRingPar (intvec *va)
 
static void DefRingParlp (void)
 
static ideal LastGB (ideal G, intvec *curr_weight, int tp_deg)
 
static int lengthpoly (ideal G)
 
static int islengthpoly2 (ideal G)
 
static ideal idHeadCC (ideal h)
 
static int test_G_GB_walk (ideal H0, ideal H1)
 
static ideal Rec_LastGB (ideal G, intvec *curr_weight, intvec *orig_target_weight, int tp_deg, int npwinc)
 
ideal MAltwalk2 (ideal Go, intvec *curr_weight, intvec *target_weight)
 
static intvecNewVectorlp (ideal I)
 
static intvecMWalkRandomNextWeight (ideal G, intvec *curr_weight, intvec *target_weight, int weight_rad, int pert_deg)
 
static ideal REC_GB_Mwalk (ideal G, intvec *curr_weight, intvec *orig_target_weight, int tp_deg, int npwinc)
 
ideal MwalkAlt (ideal Go, intvec *curr_weight, intvec *target_weight)
 
ideal Mwalk (ideal Go, intvec *orig_M, intvec *target_M, ring baseRing)
 
ideal Mrwalk (ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int pert_deg, ring baseRing)
 
ideal Mpwalk (ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP)
 
intvecMMatrixone (int nV)
 
static ideal rec_fractal_call (ideal G, int nlev, intvec *omtmp)
 
static ideal rec_r_fractal_call (ideal G, int nlev, intvec *omtmp, int weight_rad)
 
ideal Mfwalk (ideal G, intvec *ivstart, intvec *ivtarget)
 
ideal Mfrwalk (ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad)
 
ideal TranMImprovwalk (ideal G, intvec *curr_weight, intvec *target_tmp, int nP)
 
static ideal Mpwalk_MAltwalk1 (ideal Go, intvec *curr_weight, int tp_deg)
 
ideal Mprwalk (ideal Go, intvec *curr_weight, intvec *target_weight, int weight_rad, int op_deg, int tp_deg, ring baseRing)
 
ideal MAltwalk1 (ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight)
 

Variables

int nstep
 kstd2.cc More...
 
BOOLEAN pSetm_error
 
BOOLEAN Overflow_Error = FALSE
 
clock_t xtif
 
clock_t xtstd
 
clock_t xtlift
 
clock_t xtred
 
clock_t xtnw
 
clock_t xftostd
 
clock_t xtextra
 
clock_t xftinput
 
clock_t to
 
int Xnlev
 
int ngleich
 
intvecXsigma
 
intvecXtau
 
int xn
 
intvecXivinput
 
intvecXivlp
 
intvecXivNull
 
int nnflow
 
int Xcall
 
int Xngleich
 

Macro Definition Documentation

#define BUCHBERGER_ALG

Definition at line 12 of file walk.cc.

#define FIRST_STEP_FRACTAL

Definition at line 28 of file walk.cc.

#define INVEPS_SMALL_IN_FRACTAL

Definition at line 24 of file walk.cc.

#define INVEPS_SMALL_IN_MPERTVECTOR

Definition at line 25 of file walk.cc.

#define INVEPS_SMALL_IN_TRAN

Definition at line 26 of file walk.cc.

Function Documentation

static void cancel ( mpz_t  zaehler,
mpz_t  nenner 
)
static

Definition at line 565 of file walk.cc.

566 {
567 // assume(zaehler >= 0 && nenner > 0);
568  mpz_t g;
569  mpz_init(g);
570  mpz_gcd(g, zaehler, nenner);
571 
572  mpz_div(zaehler , zaehler, g);
573  mpz_div(nenner , nenner, g);
574 
575  mpz_clear(g);
576 }
g
Definition: cfModGcd.cc:4031
static void DefRingPar ( intvec va)
static

Definition at line 2811 of file walk.cc.

2812 {
2813  int i, nv = currRing->N;
2814  int nb = rBlocks(currRing) + 1;
2815 
2816  ring res=(ring)omAllocBin(sip_sring_bin);
2817 
2818  memcpy(res,currRing,sizeof(ip_sring));
2819 
2820  res->VarOffset = NULL;
2821  res->ref=0;
2822 
2823  res->cf = currRing->cf; currRing->cf->ref++;
2824 
2825 
2826  /*weights: entries for 3 blocks: NULL Made:???*/
2827  res->wvhdl = (int **)omAlloc0(nb * sizeof(int_ptr));
2828  res->wvhdl[0] = (int*) omAlloc(nv*sizeof(int));
2829  for(i=0; i<nv; i++)
2830  res->wvhdl[0][i] = (*va)[i];
2831 
2832  /* order: a,lp,C,0 */
2833 
2834  res->order = (int *) omAlloc(nb * sizeof(int *));
2835  res->block0 = (int *)omAlloc0(nb * sizeof(int *));
2836  res->block1 = (int *)omAlloc0(nb * sizeof(int *));
2837 
2838  // ringorder a for the first block: var 1..nv
2839  res->order[0] = ringorder_a;
2840  res->block0[0] = 1;
2841  res->block1[0] = nv;
2842 
2843  // ringorder lp for the second block: var 1..nv
2844  res->order[1] = ringorder_lp;
2845  res->block0[1] = 1;
2846  res->block1[1] = nv;
2847 
2848  // ringorder C for the third block
2849  // it is very important within "idLift",
2850  // especially, by ring syz_ring=rCurrRingAssure_SyzComp();
2851  // therefore, nb must be (nBlocks(currRing) + 1)
2852  res->order[2] = ringorder_C;
2853 
2854  // the last block: everything is 0
2855  res->order[3] = 0;
2856 
2857  // polynomial ring
2858  res->OrdSgn = 1;
2859 
2860 
2861  res->names = (char **)omAlloc0(nv * sizeof(char_ptr));
2862  for (i=nv-1; i>=0; i--)
2863  {
2864  res->names[i] = omStrDup(currRing->names[i]);
2865  }
2866  // complete ring intializations
2867  rComplete(res);
2868 
2869  // clean up history
2871  {
2873  }
2874 
2875 
2876  // execute the created ring
2877  rChangeCurrRing(res);
2878 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Definition: ring.h:209
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char * char_ptr
Definition: structs.h:56
static int rBlocks(ring r)
Definition: ring.h:516
BOOLEAN RingDependend()
Definition: subexpr.cc:375
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
void rChangeCurrRing(ring r)
Definition: polys.cc:14
#define NULL
Definition: omList.c:10
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
int * int_ptr
Definition: structs.h:57
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263
static void DefRingParlp ( void  )
static

Definition at line 2881 of file walk.cc.

2882 {
2883  int i, nv = currRing->N;
2884 
2885  ring r=(ring)omAllocBin(sip_sring_bin);
2886 
2887  memcpy(r,currRing,sizeof(ip_sring));
2888 
2889  r->VarOffset = NULL;
2890  r->ref=0;
2891 
2892  r->cf = currRing->cf; currRing->cf->ref++;
2893 
2894 
2895  r->cf = currRing->cf;
2896  r->N = currRing->N;
2897  int nb = rBlocks(currRing) + 1;
2898 
2899  // names
2900  char* Q;
2901  r->names = (char **) omAlloc0(nv * sizeof(char_ptr));
2902  for(i=nv-1; i>=0; i--)
2903  {
2904  Q = currRing->names[i];
2905  r->names[i] = omStrDup(Q);
2906  }
2907 
2908  /*weights: entries for 3 blocks: NULL Made:???*/
2909 
2910  r->wvhdl = (int **)omAlloc0(nb * sizeof(int_ptr));
2911 
2912  /* order: lp,C,0 */
2913  r->order = (int *) omAlloc(nb * sizeof(int *));
2914  r->block0 = (int *)omAlloc0(nb * sizeof(int *));
2915  r->block1 = (int *)omAlloc0(nb * sizeof(int *));
2916 
2917  /* ringorder lp for the first block: var 1..nv */
2918  r->order[0] = ringorder_lp;
2919  r->block0[0] = 1;
2920  r->block1[0] = nv;
2921 
2922  /* ringorder C for the second block */
2923  r->order[1] = ringorder_C;
2924 
2925  /* the last block: everything is 0 */
2926  r->order[2] = 0;
2927 
2928  /*polynomial ring*/
2929  r->OrdSgn = 1;
2930 
2931 
2932 // if (rParameter(currRing)!=NULL)
2933 // {
2934 // r->cf->extRing->qideal->m[0]=p_Copy(currRing->cf->extRing->qideal->m[0], currRing->cf->extRing);
2935 // int l=rPar(currRing);
2936 // r->cf->extRing->names=(char **)omAlloc(l*sizeof(char_ptr));
2937 //
2938 // for(i=l-1;i>=0;i--)
2939 // {
2940 // rParameter(r)[i]=omStrDup(rParameter(currRing)[i]);
2941 // }
2942 // }
2943 
2944  // complete ring intializations
2945 
2946  rComplete(r);
2947 
2948  // clean up history
2950  {
2952  }
2953 
2954  // execute the created ring
2955  rChangeCurrRing(r);
2956 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Definition: ring.h:209
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char * char_ptr
Definition: structs.h:56
static int rBlocks(ring r)
Definition: ring.h:516
const ring r
Definition: syzextra.cc:208
BOOLEAN RingDependend()
Definition: subexpr.cc:375
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
void rChangeCurrRing(ring r)
Definition: polys.cc:14
#define NULL
Definition: omList.c:10
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
int * int_ptr
Definition: structs.h:57
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN ErrorCheck ( )
static long gcd ( const long  a,
const long  b 
)
inlinestatic

Definition at line 541 of file walk.cc.

542 {
543  long r, p0 = a, p1 = b;
544  //assume(p0 >= 0 && p1 >= 0);
545  if(p0 < 0)
546  {
547  p0 = -p0;
548  }
549  if(p1 < 0)
550  {
551  p1 = -p1;
552  }
553  while(p1 != 0)
554  {
555  r = p0 % p1;
556  p0 = p1;
557  p1 = r;
558  }
559  return p0;
560 }
const poly a
Definition: syzextra.cc:212
const ring r
Definition: syzextra.cc:208
const poly b
Definition: syzextra.cc:213
static ideal idHeadCC ( ideal  h)
static

Definition at line 3323 of file walk.cc.

3324 {
3325  int i, nH =IDELEMS(h);
3326 
3327  ideal m = idInit(nH,h->rank);
3328 
3329  for (i=nH-1;i>=0; i--)
3330  {
3331  if (h->m[i]!=NULL)
3332  {
3333  m->m[i]=pHead(h->m[i]);
3334  }
3335  }
3336  return m;
3337 }
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
static intset initec ( int  maxnr)
inlinestatic

Definition at line 104 of file walk.cc.

105 {
106  return (intset)omAlloc(maxnr*sizeof(int));
107 }
#define omAlloc(size)
Definition: omAllocDecl.h:210
int * intset
Definition: kutil.h:55
static int* initS_2_R ( int  maxnr)
inlinestatic

Definition at line 113 of file walk.cc.

114 {
115  return (int*)omAlloc0(maxnr*sizeof(int));
116 }
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static unsigned long* initsevS ( int  maxnr)
inlinestatic

Definition at line 109 of file walk.cc.

110 {
111  return (unsigned long*)omAlloc0(maxnr*sizeof(unsigned long));
112 }
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static int islengthpoly2 ( ideal  G)
static

Definition at line 3287 of file walk.cc.

3288 {
3289  int i;
3290  for(i=IDELEMS(G)-1; i>=0; i--)
3291  {
3292  if((G->m[i]!=NULL) /* len >=0 */
3293  && (G->m[i]->next!=NULL) /* len >=1 */
3294  && (G->m[i]->next->next!=NULL)) /* len >=2 */
3295  {
3296  return 1;
3297  }
3298  }
3299  return 0;
3300 }
static TreeM * G
Definition: janet.cc:38
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
static void ivString ( intvec iv,
const char *  ch 
)
static

Definition at line 500 of file walk.cc.

501 {
502  int nV = iv->length()-1;
503  Print("\n// intvec %s = ", ch);
504 
505  for(int i=0; i<nV; i++)
506  {
507  Print("%d, ", (*iv)[i]);
508  }
509  Print("%d;", (*iv)[nV]);
510 }
#define Print
Definition: emacs.cc:83
int length() const
Definition: intvec.h:86
int i
Definition: cfEzgcd.cc:123
static ideal kInterRedCC ( ideal  F,
ideal  Q 
)
static

Definition at line 275 of file walk.cc.

276 {
277  int j;
278  kStrategy strat = new skStrategy;
279 
280 // if (TEST_OPT_PROT)
281 // {
282 // writeTime("start InterRed:");
283 // mflush();
284 // }
285  //strat->syzComp = 0;
286  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
287  strat->kNoether=pCopy((currRing->ppNoether));
288  strat->ak = id_RankFreeModule(F, currRing);
289  initBuchMoraCrit(strat);
290  strat->NotUsedAxis = (BOOLEAN *)omAlloc((currRing->N+1)*sizeof(BOOLEAN));
291  for(j=currRing->N; j>0; j--)
292  {
293  strat->NotUsedAxis[j] = TRUE;
294  }
295  strat->enterS = enterSBba;
296  strat->posInT = posInT0;
297  strat->initEcart = initEcartNormal;
298  strat->sl = -1;
299  strat->tl = -1;
300  strat->tmax = setmaxT;
301  strat->T = initT();
302  strat->R = initR();
303  strat->sevT = initsevT();
305  {
306  strat->honey = TRUE;
307  }
308 
309  //initSCC(F,Q,strat);
310  initS(F,Q,strat);
311 
312  /*
313  timetmp=clock();//22.01.02
314  initSSpecialCC(F,Q,NULL,strat);
315  tininitS=tininitS+clock()-timetmp;//22.01.02
316  */
317  if(TEST_OPT_REDSB)
318  {
319  strat->noTailReduction=FALSE;
320  }
321  updateS(TRUE,strat);
322 
324  {
325  completeReduce(strat);
326  }
327  pDelete(&strat->kHEdge);
328  omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
329  omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
330  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
331  omFreeSize((ADDRESS)strat->NotUsedAxis,(currRing->N+1)*sizeof(BOOLEAN));
332  omfree(strat->sevT);
333  omfree(strat->S_2_R);
334  omfree(strat->R);
335 
336  if(strat->fromQ)
337  {
338  for(j=0; j<IDELEMS(strat->Shdl); j++)
339  {
340  if(strat->fromQ[j])
341  {
342  pDelete(&strat->Shdl->m[j]);
343  }
344  }
345  omFreeSize((ADDRESS)strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
346  strat->fromQ = NULL;
347  }
348 // if (TEST_OPT_PROT)
349 // {
350 // writeTime("end Interred:");
351 // mflush();
352 // }
353  ideal shdl=strat->Shdl;
354  idSkipZeroes(shdl);
355  delete(strat);
356 
357  return shdl;
358 }
KINLINE TObject ** initR()
Definition: kInline.h:92
BOOLEAN honey
Definition: kutil.h:367
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:325
KINLINE TSet initT()
Definition: kInline.h:81
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:368
int * S_2_R
Definition: kutil.h:340
BOOLEAN * NotUsedAxis
Definition: kutil.h:330
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:161
int ak
Definition: kutil.h:351
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:4306
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:6383
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define setmaxT
Definition: kutil.h:32
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:8092
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
int tmax
Definition: kutil.h:348
#define rHasLocalOrMixedOrdering_currRing()
Definition: ring.h:760
kStrategy strat
Definition: myNF.cc:319
BOOLEAN kHEdgeFound
Definition: kutil.h:366
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:7345
unsigned long * sevS
Definition: kutil.h:318
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:8801
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
void initEcartNormal(TObject *h)
Definition: kutil.cc:1139
ideal Shdl
Definition: kutil.h:299
int BOOLEAN
Definition: auxiliary.h:131
class sTObject TObject
Definition: kutil.h:59
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7577
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
static ideal LastGB ( ideal  G,
intvec curr_weight,
int  tp_deg 
)
static

Definition at line 2986 of file walk.cc.

2987 {
2988  BOOLEAN nError = Overflow_Error;
2990 
2991  int i, nV = currRing->N;
2992  int nwalk=0, endwalks=0, nnwinC=1;
2993  int nlast = 0;
2994  ideal Gomega, M, F, Gomega1, Gomega2, M1,F1,result,ssG;
2995  ring newRing, oldRing, TargetRing;
2996  intvec* iv_M_lp;
2997  intvec* target_weight;
2998  intvec* iv_lp = Mivlp(nV); //define (1,0,...,0)
2999  intvec* pert_target_vector;
3000  intvec* ivNull = new intvec(nV);
3001  intvec* extra_curr_weight = new intvec(nV);
3002  intvec* next_weight;
3003 
3004 #ifndef BUCHBERGER_ALG
3005  intvec* hilb_func;
3006 #endif
3007 
3008  // to avoid (1,0,...,0) as the target vector
3009  intvec* last_omega = new intvec(nV);
3010  for(i=nV-1; i>0; i--)
3011  {
3012  (*last_omega)[i] = 1;
3013  }
3014  (*last_omega)[0] = 10000;
3015 
3016  ring EXXRing = currRing;
3017 
3018  // compute a pertubed weight vector of the target weight vector
3019  if(tp_deg > 1 && tp_deg <= nV)
3020  {
3021  //..25.03.03 VMrDefaultlp();// VMrDefault(target_weight);
3022  if (rParameter (currRing) != NULL)
3023  {
3024  DefRingParlp();
3025  }
3026  else
3027  {
3028  VMrDefaultlp();
3029  }
3030  TargetRing = currRing;
3031  ssG = idrMoveR(G,EXXRing,currRing);
3032  iv_M_lp = MivMatrixOrderlp(nV);
3033  //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg);
3034  target_weight = MPertVectors(ssG, iv_M_lp, tp_deg);
3035  delete iv_M_lp;
3036  pert_target_vector = target_weight;
3037 
3038  rChangeCurrRing(EXXRing);
3039  G = idrMoveR(ssG, TargetRing,currRing);
3040  }
3041  else
3042  {
3043  target_weight = Mivlp(nV);
3044  }
3045  //Print("\n// ring r%d_%d = %s;\n", tp_deg, nwalk, rString(currRing));
3046 
3047  while(1)
3048  {
3049  nwalk++;
3050  nstep++;
3051  to=clock();
3052  // compute a next weight vector
3053  next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
3054  xtnw=xtnw+clock()-to;
3055 
3056 #ifdef PRINT_VECTORS
3057  MivString(curr_weight, target_weight, next_weight);
3058 #endif
3059 
3060  if(Overflow_Error == TRUE)
3061  {
3062  newRing = currRing;
3063  nnwinC = 0;
3064  if(tp_deg == 1)
3065  {
3066  nlast = 1;
3067  }
3068  delete next_weight;
3069 
3070  //idElements(G, "G");
3071  //Print("\n// ring r%d_%d = %s;\n", tp_deg, nwalk, rString(currRing));
3072 
3073  break;
3074  }
3075 
3076  if(MivComp(next_weight, ivNull) == 1)
3077  {
3078  //Print("\n// ring r%d_%d = %s;\n", tp_deg, nwalk, rString(currRing));
3079  newRing = currRing;
3080  delete next_weight;
3081  break;
3082  }
3083 
3084  if(MivComp(next_weight, target_weight) == 1)
3085  endwalks = 1;
3086 
3087  for(i=nV-1; i>=0; i--)
3088  {
3089  (*extra_curr_weight)[i] = (*curr_weight)[i];
3090  }
3091  /* 06.11.01 NOT Changed */
3092  for(i=nV-1; i>=0; i--)
3093  {
3094  (*curr_weight)[i] = (*next_weight)[i];
3095  }
3096  oldRing = currRing;
3097  to=clock();
3098  // compute an initial form ideal of <G> w.r.t. "curr_vector"
3099  Gomega = MwalkInitialForm(G, curr_weight);
3100  xtif=xtif+clock()-to;
3101 
3102 #ifdef ENDWALKS
3103  if(endwalks == 1)
3104  {
3105  Print("\n// ring r%d_%d = %s;\n", tp_deg, nwalk, rString(currRing));
3106  idElements(Gomega, "Gw");
3107  headidString(Gomega, "Gw");
3108  }
3109 #endif
3110 
3111 #ifndef BUCHBERGER_ALG
3112  if(isNolVector(curr_weight) == 0)
3113  {
3114  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
3115  }
3116  else
3117  {
3118  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
3119  }
3120 #endif // BUCHBERGER_ALG
3121 
3122  /* define a new ring that its ordering is "(a(curr_weight),lp) */
3123  //..25.03.03 VMrDefault(curr_weight);
3124  if (rParameter (currRing) != NULL)
3125  {
3126  DefRingPar(curr_weight);
3127  }
3128  else
3129  {
3130  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung
3131  }
3132  newRing = currRing;
3133  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
3134 
3135  to=clock();
3136  /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */
3137 #ifdef BUCHBERGER_ALG
3138  M = MstdhomCC(Gomega1);
3139 #else
3140  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
3141  delete hilb_func;
3142 #endif // BUCHBERGER_ALG
3143  xtstd=xtstd+clock()-to;
3144  /* change the ring to oldRing */
3145  rChangeCurrRing(oldRing);
3146  M1 = idrMoveR(M, newRing,currRing);
3147  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
3148 
3149  to=clock();
3150  /* compute a reduced Groebner basis of <G> w.r.t. "newRing" */
3151  F = MLifttwoIdeal(Gomega2, M1, G);
3152  xtlift=xtlift+clock()-to;
3153 
3154  idDelete(&M1);
3155  idDelete(&G);
3156 
3157  /* change the ring to newRing */
3158  rChangeCurrRing(newRing);
3159  F1 = idrMoveR(F, oldRing,currRing);
3160 
3161  to=clock();
3162  /* reduce the Groebner basis <G> w.r.t. new ring */
3163  G = kInterRedCC(F1, NULL);
3164  xtred=xtred+clock()-to;
3165  idDelete(&F1);
3166 
3167  if(endwalks == 1)
3168  {
3169  //Print("\n// ring r%d_%d = %s;\n", tp_deg, nwalk, rString(currRing));
3170  break;
3171  }
3172 
3173  delete next_weight;
3174  }//while
3175 
3176  delete ivNull;
3177 
3178  if(tp_deg != 1)
3179  {
3180  //..25.03.03 VMrDefaultlp();//define and execute the ring "lp"
3181  if (rParameter (currRing) != NULL)
3182  {
3183  DefRingParlp();
3184  }
3185  else
3186  {
3187  VMrDefaultlp();
3188  }
3189  F1 = idrMoveR(G, newRing,currRing);
3190 
3191  if(nnwinC == 0 || test_w_in_ConeCC(F1, pert_target_vector) != 1)
3192  {
3193  oldRing = currRing;
3194  rChangeCurrRing(newRing);
3195  G = idrMoveR(F1, oldRing,currRing);
3196  Print("\n// takes %d steps and calls the recursion of level %d:",
3197  nwalk, tp_deg-1);
3198 
3199  F1 = LastGB(G,curr_weight, tp_deg-1);
3200  }
3201 
3202  TargetRing = currRing;
3203  rChangeCurrRing(EXXRing);
3204  result = idrMoveR(F1, TargetRing,currRing);
3205  }
3206  else
3207  {
3208  if(nlast == 1)
3209  {
3210  //OMEGA_OVERFLOW_LASTGB:
3211  /*
3212  if(MivSame(curr_weight, iv_lp) == 1)
3213  if (rParameter(currRing) != NULL)
3214  DefRingParlp();
3215  else
3216  VMrDefaultlp();
3217  else
3218  if (rParameter(currRing) != NULL)
3219  DefRingPar(curr_weight);
3220  else
3221  VMrDefault(curr_weight);
3222  */
3223 
3224  //..25.03.03 VMrDefaultlp();//define and execute the ring "lp"
3225  if (rParameter (currRing) != NULL)
3226  {
3227  DefRingParlp();
3228  }
3229  else
3230  {
3231  VMrDefaultlp();
3232  }
3233 
3234  F1 = idrMoveR(G, newRing,currRing);
3235  //Print("\n// Apply \"std\" in ring r%d_%d = %s;\n", tp_deg, nwalk, rString(currRing));
3236 
3237  G = MstdCC(F1);
3238  idDelete(&F1);
3239  newRing = currRing;
3240  }
3241 
3242  rChangeCurrRing(EXXRing);
3243  result = idrMoveR(G, newRing,currRing);
3244  }
3245  delete target_weight;
3246  delete last_omega;
3247  delete iv_lp;
3248 
3249  if(Overflow_Error == FALSE)
3250  {
3251  Overflow_Error = nError;
3252  }
3253  return(result);
3254 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
char * rString(ring r)
Definition: ring.cc:644
static ideal LastGB(ideal G, intvec *curr_weight, int tp_deg)
Definition: walk.cc:2986
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
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:2221
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
static TreeM * G
Definition: janet.cc:38
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2748
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2881
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
int BOOLEAN
Definition: auxiliary.h:131
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
return result
Definition: facAbsBiFact.cc:76
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
static int lengthpoly ( ideal  G)
static

Definition at line 3259 of file walk.cc.

3260 {
3261  int i;
3262  for(i=IDELEMS(G)-1; i>=0; i--)
3263  {
3264 #if 0
3265  if(pLength(G->m[i])>2)
3266  {
3267  return 1;
3268  }
3269 #else
3270  if((G->m[i]!=NULL) /* len >=0 */
3271  && (G->m[i]->next!=NULL) /* len >=1 */
3272  && (G->m[i]->next->next!=NULL) /* len >=2 */
3273  && (G->m[i]->next->next->next!=NULL) /* len >=3 */
3274  //&& (G->m[i]->next->next->next->next!=NULL) /* len >=4 */
3275  )
3276  {
3277  return 1;
3278  }
3279 #endif
3280  }
3281  return 0;
3282 }
static TreeM * G
Definition: janet.cc:38
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
int M3ivSame ( intvec temp,
intvec u,
intvec v 
)

Definition at line 889 of file walk.cc.

890 {
891  assume(temp->length() == u->length() && u->length() == v->length());
892 
893  if((MivSame(temp, u)) == 1)
894  {
895  return 0;
896  }
897  if((MivSame(temp, v)) == 1)
898  {
899  return 1;
900  }
901  return 2;
902 }
int length() const
Definition: intvec.h:86
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
#define assume(x)
Definition: mod2.h:405
ideal MAltwalk1 ( ideal  Go,
int  op_deg,
int  tp_deg,
intvec curr_weight,
intvec target_weight 
)

Definition at line 8446 of file walk.cc.

8448 {
8449  Set_Error(FALSE );
8451 #ifdef TIME_TEST
8452  BOOLEAN nOverflow_Error = FALSE;
8453 #endif
8454  // Print("// pSetm_Error = (%d)", ErrorCheck());
8455 
8456  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
8457  xftinput = clock();
8458  clock_t tostd, tproc;
8459 
8460  nstep = 0;
8461  int i, nV = currRing->N;
8462  int nwalk=0, endwalks=0;
8463  int op_tmp = op_deg;
8464  ideal Gomega, M, F, G, Gomega1, Gomega2, M1, F1;
8465  ring newRing, oldRing;
8466  intvec* next_weight;
8467  intvec* iv_M_dp;
8468  intvec* ivNull = new intvec(nV);
8469  intvec* iv_dp = MivUnit(nV);// define (1,1,...,1)
8470  intvec* exivlp = Mivlp(nV);
8471  //intvec* extra_curr_weight = new intvec(nV);
8472 #ifndef BUCHBERGER_ALG
8473  intvec* hilb_func;
8474 #endif
8475  intvec* cw_tmp = curr_weight;
8476 
8477  // to avoid (1,0,...,0) as the target vector
8478  intvec* last_omega = new intvec(nV);
8479  for(i=nV-1; i>0; i--)
8480  {
8481  (*last_omega)[i] = 1;
8482  }
8483  (*last_omega)[0] = 10000;
8484 
8485  ring XXRing = currRing;
8486 
8487  to=clock();
8488  /* compute a pertubed weight vector of the original weight vector.
8489  The perturbation degree is recursive decrease until that vector
8490  stays inn the correct cone. */
8491  while(1)
8492  {
8493  if(Overflow_Error == FALSE)
8494  {
8495  if(MivComp(curr_weight, iv_dp) == 1)
8496  {
8497  //rOrdStr(currRing) = "dp"
8498  if(op_tmp == op_deg)
8499  {
8500  G = MstdCC(Go);
8501  if(op_deg != 1)
8502  {
8503  iv_M_dp = MivMatrixOrderdp(nV);
8504  }
8505  }
8506  }
8507  }
8508  else
8509  {
8510  if(op_tmp == op_deg)
8511  {
8512  //rOrdStr(currRing) = (a(...),lp,C)
8513  if (rParameter(currRing) != NULL)
8514  {
8515  DefRingPar(cw_tmp);
8516  }
8517  else
8518  {
8519  rChangeCurrRing(VMrDefault(cw_tmp)); // Aenderung 16
8520  }
8521  G = idrMoveR(Go, XXRing,currRing);
8522  G = MstdCC(G);
8523  if(op_deg != 1)
8524  iv_M_dp = MivMatrixOrder(cw_tmp);
8525  }
8526  }
8528  if(op_deg != 1)
8529  {
8530  curr_weight = MPertVectors(G, iv_M_dp, op_deg);
8531  }
8532  else
8533  {
8534  curr_weight = cw_tmp;
8535  break;
8536  }
8537  if(Overflow_Error == FALSE)
8538  {
8539  break;
8540  }
8541  Overflow_Error = TRUE;
8542  op_deg --;
8543  }
8544  tostd=clock()-to;
8545 
8546  if(op_tmp != 1 )
8547  delete iv_M_dp;
8548  delete iv_dp;
8549 
8550  if(currRing->order[0] == ringorder_a)
8551  goto NEXT_VECTOR;
8552 
8553  while(1)
8554  {
8555  nwalk ++;
8556  nstep ++;
8557 
8558  to = clock();
8559  // compute an initial form ideal of <G> w.r.t. "curr_vector"
8560  Gomega = MwalkInitialForm(G, curr_weight);
8561  xtif=xtif+clock()-to;
8562 #if 0
8563  if(Overflow_Error == TRUE)
8564  {
8565  for(i=nV-1; i>=0; i--)
8566  (*curr_weight)[i] = (*extra_curr_weight)[i];
8567  delete extra_curr_weight;
8568 
8569  newRing = currRing;
8570  goto MSTD_ALT1;
8571  }
8572 #endif
8573 #ifndef BUCHBERGER_ALG
8574  if(isNolVector(curr_weight) == 0)
8575  {
8576  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
8577  }
8578  else
8579  {
8580  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
8581  }
8582 #endif // BUCHBERGER_ALG
8583 
8584  oldRing = currRing;
8585 
8586  // define a new ring which ordering is "(a(curr_weight),lp)
8587  if (rParameter(currRing) != NULL)
8588  {
8589  DefRingPar(curr_weight);
8590  }
8591  else
8592  {
8593  rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 17
8594  }
8595  newRing = currRing;
8596  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
8597 
8598  to=clock();
8599  // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing"
8600 #ifdef BUCHBERGER_ALG
8601  M = MstdhomCC(Gomega1);
8602 #else
8603  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
8604  delete hilb_func;
8605 #endif // BUCHBERGER_ALG
8606  xtstd=xtstd+clock()-to;
8607 
8608  // change the ring to oldRing
8609  rChangeCurrRing(oldRing);
8610  M1 = idrMoveR(M, newRing,currRing);
8611  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
8612 
8613  to=clock();
8614  // compute a reduced Groebner basis of <G> w.r.t. "newRing" by the lifting process
8615  F = MLifttwoIdeal(Gomega2, M1, G);
8616  xtlift=xtlift+clock()-to;
8617 
8618  idDelete(&M1);
8619  idDelete(&Gomega2);
8620  idDelete(&G);
8621 
8622  // change the ring to newRing
8623  rChangeCurrRing(newRing);
8624  F1 = idrMoveR(F, oldRing,currRing);
8625 
8626  to=clock();
8627  // reduce the Groebner basis <G> w.r.t. new ring
8628  G = kInterRedCC(F1, NULL);
8629  xtred=xtred+clock()-to;
8630  idDelete(&F1);
8631 
8632  if(endwalks == 1)
8633  {
8634  break;
8635  }
8636  NEXT_VECTOR:
8637  to=clock();
8638  // compute a next weight vector
8639  next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
8640  xtnw=xtnw+clock()-to;
8641 #ifdef PRINT_VECTORS
8642  MivString(curr_weight, target_weight, next_weight);
8643 #endif
8644 
8645  if(Overflow_Error == TRUE)
8646  {
8647  newRing = currRing;
8648 
8649  if (rParameter(currRing) != NULL)
8650  {
8651  DefRingPar(target_weight);
8652  }
8653  else
8654  {
8655  rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 18
8656  }
8657  F1 = idrMoveR(G, newRing,currRing);
8658  G = MstdCC(F1);
8659  idDelete(&F1);
8660  newRing = currRing;
8661  break; //for while
8662  }
8663 
8664 
8665  /* G is the wanted Groebner basis if next_weight == curr_weight */
8666  if(MivComp(next_weight, ivNull) == 1)
8667  {
8668  newRing = currRing;
8669  delete next_weight;
8670  break; //for while
8671  }
8672 
8673  if(MivComp(next_weight, target_weight) == 1)
8674  {
8675  if(tp_deg == 1 || MivSame(target_weight, exivlp) == 0)
8676  endwalks = 1;
8677  else
8678  {
8679  // MSTD_ALT1:
8680 #ifdef TIME_TEST
8681  nOverflow_Error = Overflow_Error;
8682 #endif
8683  tproc = clock()-xftinput;
8684 
8685  //Print("\n// main routine takes %d steps and calls \"Mpwalk\" (1,%d):", nwalk, tp_deg);
8686 
8687  // compute the red. GB of <G> w.r.t. the lex order by the "recursive-modified" perturbation walk alg (1,tp_deg)
8688  G = Mpwalk_MAltwalk1(G, curr_weight, tp_deg);
8689  delete next_weight;
8690  break; // for while
8691  }
8692  }
8693 
8694  //NOT Changed, to free memory
8695  for(i=nV-1; i>=0; i--)
8696  {
8697  //(*extra_curr_weight)[i] = (*curr_weight)[i];
8698  (*curr_weight)[i] = (*next_weight)[i];
8699  }
8700  delete next_weight;
8701  }//while
8702 
8703  rChangeCurrRing(XXRing);
8704  ideal result = idrMoveR(G, newRing,currRing);
8705  id_Delete(&G, newRing);
8706 
8707  delete ivNull;
8708  if(op_deg != 1 )
8709  {
8710  delete curr_weight;
8711  }
8712  delete exivlp;
8713 #ifdef TIME_TEST
8714 
8715  Print("\n// \"Main procedure\" took %d steps, %.2f sec. and Overflow_Error(%d)",
8716  nwalk, ((double) tproc)/1000000, nOverflow_Error);
8717 
8718  TimeStringFractal(xftinput, tostd, xtif, xtstd,xtextra, xtlift, xtred, xtnw);
8719 
8720  Print("\n// pSetm_Error = (%d)", ErrorCheck());
8721  Print("\n// Overflow_Error? (%d)", Overflow_Error);
8722  Print("\n// Awalk1 took %d steps.\n", nstep);
8723 #endif
8724  return(result);
8725 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
BOOLEAN ErrorCheck()
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
#define Print
Definition: emacs.cc:83
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
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:2221
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
clock_t xftinput
Definition: walk.cc:99
static ideal Mpwalk_MAltwalk1(ideal Go, intvec *curr_weight, int tp_deg)
Definition: walk.cc:7990
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
clock_t xtlift
Definition: walk.cc:98
intvec * MivUnit(int nV)
Definition: walk.cc:1476
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
int BOOLEAN
Definition: auxiliary.h:131
clock_t xtextra
Definition: walk.cc:99
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
ideal MAltwalk2 ( ideal  Go,
intvec curr_weight,
intvec target_weight 
)

Definition at line 4077 of file walk.cc.

4078 {
4079  Set_Error(FALSE);
4081  //BOOLEAN nOverflow_Error = FALSE;
4082  //Print("// pSetm_Error = (%d)", ErrorCheck());
4083 
4084  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
4085  xftinput = clock();
4086  clock_t tostd, tproc;
4087 
4088  nstep = 0;
4089  int i, nV = currRing->N;
4090  int nwalk=0, endwalks=0;
4091  // int nhilb = 1;
4092  ideal Gomega, M, F, Gomega1, Gomega2, M1, F1, G;
4093  //ideal G1;
4094  //ring endRing;
4095  ring newRing, oldRing;
4096  intvec* ivNull = new intvec(nV);
4097  intvec* next_weight;
4098 #if 0
4099  intvec* extra_curr_weight = new intvec(nV);
4100 #endif
4101  //intvec* hilb_func;
4102  intvec* exivlp = Mivlp(nV);
4103 
4104  ring XXRing = currRing;
4105 
4106  //Print("\n// ring r_input = %s;", rString(currRing));
4107  to = clock();
4108  /* compute the reduced Groebner basis of the given ideal w.r.t.
4109  a "fast" monomial order, e.g. degree reverse lex. order (dp) */
4110  G = MstdCC(Go);
4111  tostd=clock()-to;
4112 
4113  /*
4114  Print("\n// Computation of the first std took = %.2f sec",
4115  ((double) tostd)/1000000);
4116  */
4117  if(currRing->order[0] == ringorder_a)
4118  {
4119  goto NEXT_VECTOR;
4120  }
4121  while(1)
4122  {
4123  nwalk ++;
4124  nstep ++;
4125  to = clock();
4126  /* compute an initial form ideal of <G> w.r.t. "curr_vector" */
4127  Gomega = MwalkInitialForm(G, curr_weight);
4128  xtif=xtif+clock()-to;
4129 #if 0
4130  if(Overflow_Error == TRUE)
4131  {
4132  for(i=nV-1; i>=0; i--)
4133  (*curr_weight)[i] = (*extra_curr_weight)[i];
4134  delete extra_curr_weight;
4135  goto LAST_GB_ALT2;
4136  }
4137 #endif
4138  oldRing = currRing;
4139 
4140  /* define a new ring that its ordering is "(a(curr_weight),lp) */
4141  if (rParameter(currRing) != NULL)
4142  {
4143  DefRingPar(curr_weight);
4144  }
4145  else
4146  {
4147  rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
4148  }
4149  newRing = currRing;
4150  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
4151  to = clock();
4152  /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */
4153  M = MstdhomCC(Gomega1);
4154  xtstd=xtstd+clock()-to;
4155  /* change the ring to oldRing */
4156  rChangeCurrRing(oldRing);
4157  M1 = idrMoveR(M, newRing,currRing);
4158  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
4159 
4160  to = clock();
4161  /* compute the reduced Groebner basis of <G> w.r.t. "newRing"
4162  by the liftig process */
4163  F = MLifttwoIdeal(Gomega2, M1, G);
4164  xtlift=xtlift+clock()-to;
4165  idDelete(&M1);
4166  idDelete(&Gomega2);
4167  idDelete(&G);
4168 
4169  /* change the ring to newRing */
4170  rChangeCurrRing(newRing);
4171  F1 = idrMoveR(F, oldRing,currRing);
4172 
4173  to = clock();
4174  /* reduce the Groebner basis <G> w.r.t. newRing */
4175  G = kInterRedCC(F1, NULL);
4176  xtred=xtred+clock()-to;
4177  idDelete(&F1);
4178 
4179  if(endwalks == 1)
4180  break;
4181 
4182  NEXT_VECTOR:
4183  to = clock();
4184  /* compute a next weight vector */
4185  next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
4186  xtnw=xtnw+clock()-to;
4187 #ifdef PRINT_VECTORS
4188  MivString(curr_weight, target_weight, next_weight);
4189 #endif
4190 
4191  if(Overflow_Error == TRUE)
4192  {
4193  /*
4194  ivString(next_weight, "omega");
4195  PrintS("\n// ** The weight vector does NOT stay in Cone!!\n");
4196  */
4197 #ifdef TEST_OVERFLOW
4198  goto TEST_OVERFLOW_OI;
4199 #endif
4200 
4201  newRing = currRing;
4202  if (rParameter(currRing) != NULL)
4203  {
4204  DefRingPar(target_weight);
4205  }
4206  else
4207  {
4208  rChangeCurrRing(VMrDefault(target_weight)); // Aenderung
4209  }
4210  F1 = idrMoveR(G, newRing,currRing);
4211  G = MstdCC(F1);
4212  idDelete(&F1);
4213  newRing = currRing;
4214  break;
4215  }
4216 
4217  if(MivComp(next_weight, ivNull) == 1)
4218  {
4219  newRing = currRing;
4220  delete next_weight;
4221  break;
4222  }
4223 
4224  if(MivComp(next_weight, target_weight) == 1)
4225  {
4226  if(MivSame(target_weight, exivlp)==1)
4227  {
4228  // LAST_GB_ALT2:
4229  //nOverflow_Error = Overflow_Error;
4230  tproc = clock()-xftinput;
4231  //Print("\n// takes %d steps and calls the recursion of level 2:", nwalk);
4232  /* call the changed perturbation walk algorithm with degree 2 */
4233  G = Rec_LastGB(G, curr_weight, target_weight, 2,1);
4234  newRing = currRing;
4235  delete next_weight;
4236  break;
4237  }
4238  endwalks = 1;
4239  }
4240 
4241  for(i=nV-1; i>=0; i--)
4242  {
4243  //(*extra_curr_weight)[i] = (*curr_weight)[i];
4244  (*curr_weight)[i] = (*next_weight)[i];
4245  }
4246  delete next_weight;
4247  }
4248 #ifdef TEST_OVERFLOW
4249  TEST_OVERFLOW_OI:
4250 #endif
4251  rChangeCurrRing(XXRing);
4252  G = idrMoveR(G, newRing,currRing);
4253  delete ivNull;
4254  delete exivlp;
4255 
4256 #ifdef TIME_TEST
4257  // Print("\n// \"Main procedure\" took %d steps dnd %.2f sec. Overflow_Error (%d)", nwalk, ((double) tproc)/1000000, nOverflow_Error);
4258 
4259  TimeStringFractal(xftinput, tostd, xtif, xtstd, xtextra,xtlift, xtred,xtnw);
4260 
4261  Print("\n// pSetm_Error = (%d)", ErrorCheck());
4262  //Print("\n// Overflow_Error? (%d)", nOverflow_Error);
4263  Print("\n// Awalk2 took %d steps!!", nstep);
4264 #endif
4265 
4266  return(G);
4267 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
BOOLEAN ErrorCheck()
#define Print
Definition: emacs.cc:83
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
clock_t xftinput
Definition: walk.cc:99
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
static ideal Rec_LastGB(ideal G, intvec *curr_weight, intvec *orig_target_weight, int tp_deg, int npwinc)
Definition: walk.cc:3761
clock_t xtnw
Definition: walk.cc:98
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
clock_t xtlift
Definition: walk.cc:98
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
static intvec* MExpPol ( poly  f)
static

Definition at line 852 of file walk.cc.

853 {
854  int i, nR = currRing->N;
855  intvec* result = new intvec(nR);
856 
857  for(i=nR-1; i>=0; i--)
858  {
859  (*result)[i] = pGetExp(f,i+1);
860  }
861  return result;
862 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
Definition: intvec.h:16
FILE * f
Definition: checklibs.c:7
int i
Definition: cfEzgcd.cc:123
return result
Definition: facAbsBiFact.cc:76
intvec* Mfpertvector ( ideal  G,
intvec ivtarget 
)

Definition at line 1492 of file walk.cc.

1493 {
1494  int i, j, nG = IDELEMS(G);
1495  int nV = currRing->N;
1496  int niv = nV*nV;
1497 
1498 
1499  // Calculate maxA = Max(A2) + Max(A3) + ... + Max(AnV),
1500  // where the Ai are the i-te rows of the matrix 'targer_ord'.
1501  int ntemp, maxAi, maxA=0;
1502  for(i=1; i<nV; i++)
1503  {
1504  maxAi = (*ivtarget)[i*nV];
1505  if(maxAi<0)
1506  {
1507  maxAi = -maxAi;
1508  }
1509  for(j=i*nV+1; j<(i+1)*nV; j++)
1510  {
1511  ntemp = (*ivtarget)[j];
1512  if(ntemp < 0)
1513  {
1514  ntemp = -ntemp;
1515  }
1516  if(ntemp > maxAi)
1517  {
1518  maxAi = ntemp;
1519  }
1520  }
1521  maxA = maxA + maxAi;
1522  }
1523  intvec* ivUnit = Mivdp(nV);
1524 
1525  // Calculate inveps = 1/eps, where 1/eps > deg(p)*maxA for all p in G.
1526  mpz_t tot_deg; mpz_init(tot_deg);
1527  mpz_t maxdeg; mpz_init(maxdeg);
1528  mpz_t inveps; mpz_init(inveps);
1529 
1530 
1531  for(i=nG-1; i>=0; i--)
1532  {
1533  mpz_set_ui(maxdeg, MwalkWeightDegree(G->m[i], ivUnit));
1534  if (mpz_cmp(maxdeg, tot_deg) > 0 )
1535  {
1536  mpz_set(tot_deg, maxdeg);
1537  }
1538  }
1539 
1540  delete ivUnit;
1541  //inveps = (tot_deg * maxA) + 1;
1542  mpz_mul_ui(inveps, tot_deg, maxA);
1543  mpz_add_ui(inveps, inveps, 1);
1544 
1545  // takes "small" inveps
1546 #ifdef INVEPS_SMALL_IN_FRACTAL
1547  if(mpz_cmp_ui(inveps, nV)>0 && nV > 3)
1548  {
1549  mpz_cdiv_q_ui(inveps, inveps, nV);
1550  }
1551  //PrintS("\n// choose the \"small\" inverse epsilon!");
1552 #endif
1553 
1554  // PrintLn(); mpz_out_str(stdout, 10, inveps);
1555 
1556  // Calculate the perturbed target orders:
1557  mpz_t *ivtemp=(mpz_t *)omAlloc(nV*sizeof(mpz_t));
1558  mpz_t *pert_vector=(mpz_t *)omAlloc(niv*sizeof(mpz_t));
1559 
1560  for(i=0; i < nV; i++)
1561  {
1562  mpz_init_set_si(ivtemp[i], (*ivtarget)[i]);
1563  mpz_init_set_si(pert_vector[i], (*ivtarget)[i]);
1564  }
1565 
1566  mpz_t ztmp; mpz_init(ztmp);
1567  // BOOLEAN isneg = FALSE;
1568 
1569  for(i=1; i<nV; i++)
1570  {
1571  for(j=0; j<nV; j++)
1572  {
1573  mpz_mul(ztmp, inveps, ivtemp[j]);
1574  if((*ivtarget)[i*nV+j]<0)
1575  {
1576  mpz_sub_ui(ivtemp[j], ztmp, -(*ivtarget)[i*nV+j]);
1577  }
1578  else
1579  {
1580  mpz_add_ui(ivtemp[j], ztmp,(*ivtarget)[i*nV+j]);
1581  }
1582  }
1583 
1584  for(j=0; j<nV; j++)
1585  {
1586  mpz_init_set(pert_vector[i*nV+j],ivtemp[j]);
1587  }
1588  }
1589 
1590  /* 2147483647 is max. integer representation in SINGULAR */
1591  mpz_t sing_int;
1592  mpz_init_set_ui(sing_int, 2147483647);
1593 
1594  intvec* result = new intvec(niv);
1595  intvec* result1 = new intvec(niv);
1596  BOOLEAN nflow = FALSE;
1597 
1598  // computes gcd
1599  mpz_set(ztmp, pert_vector[0]);
1600  for(i=0; i<niv; i++)
1601  {
1602  mpz_gcd(ztmp, ztmp, pert_vector[i]);
1603  if(mpz_cmp_si(ztmp, 1)==0)
1604  {
1605  break;
1606  }
1607  }
1608 
1609  for(i=0; i<niv; i++)
1610  {
1611  mpz_divexact(pert_vector[i], pert_vector[i], ztmp);
1612  (* result)[i] = mpz_get_si(pert_vector[i]);
1613  }
1614 
1615  j = 0;
1616  for(i=0; i<nV; i++)
1617  {
1618  (* result1)[i] = mpz_get_si(pert_vector[i]);
1619  (* result1)[i] = 0.1*(* result1)[i];
1620  (* result1)[i] = floor((* result1)[i] + 0.5);
1621  if((* result1)[i] == 0)
1622  {
1623  j++;
1624  }
1625  }
1626  if(j > nV - 1)
1627  {
1628  // Print("\n// MfPertwalk: geaenderter vector gleich Null! \n");
1629  delete result1;
1630  goto CHECK_OVERFLOW;
1631  }
1632 
1633 // check that the perturbed weight vector lies in the Groebner cone
1634  if(test_w_in_ConeCC(G,result1) != 0)
1635  {
1636  // Print("\n// MfPertwalk: geaenderter vector liegt in Groebnerkegel! \n");
1637  delete result;
1638  result = result1;
1639  for(i=0; i<nV; i++)
1640  {
1641  mpz_set_si(pert_vector[i], (*result1)[i]);
1642  }
1643  }
1644  else
1645  {
1646  delete result1;
1647  // Print("\n// Mfpertwalk: geaenderter vector liegt nicht in Groebnerkegel! \n");
1648  }
1649 
1650  CHECK_OVERFLOW:
1651 
1652  for(i=0; i<niv; i++)
1653  {
1654  if(mpz_cmp(pert_vector[i], sing_int)>0)
1655  {
1656  if(nflow == FALSE)
1657  {
1658  Xnlev = i / nV;
1659  nflow = TRUE;
1660  Overflow_Error = TRUE;
1661  Print("\n// Xlev = %d and the %d-th element is", Xnlev, i+1);
1662  PrintS("\n// ** OVERFLOW in \"Mfpertvector\": ");
1663  mpz_out_str( stdout, 10, pert_vector[i]);
1664  PrintS(" is greater than 2147483647 (max. integer representation)");
1665  Print("\n// So vector[%d] := %d is wrong!!", i+1, (*result)[i]);
1666  }
1667  }
1668  }
1669  if(Overflow_Error == TRUE)
1670  {
1671  ivString(result, "new_vector");
1672  }
1673  omFree(pert_vector);
1674  omFree(ivtemp);
1675  mpz_clear(ztmp);
1676  mpz_clear(tot_deg);
1677  mpz_clear(maxdeg);
1678  mpz_clear(inveps);
1679  mpz_clear(sing_int);
1680 
1682  for(j=0; j<IDELEMS(G); j++)
1683  {
1684  poly p=G->m[j];
1685  while(p!=NULL)
1686  {
1687  p_Setm(p,currRing); pIter(p);
1688  }
1689  }
1690  return result;
1691 }
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
int Xnlev
Definition: walk.cc:1491
static TreeM * G
Definition: janet.cc:38
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
intvec * Mivdp(int nR)
Definition: walk.cc:980
#define NULL
Definition: omList.c:10
static int MwalkWeightDegree(poly p, intvec *weight_vector)
Definition: walk.cc:645
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
polyrec * poly
Definition: hilb.h:10
static void ivString(intvec *iv, const char *ch)
Definition: walk.cc:500
int BOOLEAN
Definition: auxiliary.h:131
return result
Definition: facAbsBiFact.cc:76
ideal Mfrwalk ( ideal  G,
intvec ivstart,
intvec ivtarget,
int  weight_rad 
)

Definition at line 6940 of file walk.cc.

6941 {
6942  Set_Error(FALSE);
6944  //Print("// pSetm_Error = (%d)", ErrorCheck());
6945  //Print("\n// ring ro = %s;", rString(currRing));
6946 
6947  nnflow = 0;
6948  Xngleich = 0;
6949  Xcall = 0;
6950  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
6951  xftinput = clock();
6952 
6953  ring oldRing = currRing;
6954  int i, nV = currRing->N;
6955  XivNull = new intvec(nV);
6956  Xivinput = ivtarget;
6957  ngleich = 0;
6958  to=clock();
6959  ideal I = MstdCC(G);
6960  G = NULL;
6961  xftostd=clock()-to;
6962  Xsigma = ivstart;
6963 
6964  Xnlev=nV;
6965 
6966 #ifdef FIRST_STEP_FRACTAL
6967  ideal Gw = MwalkInitialForm(I, ivstart);
6968  for(i=IDELEMS(Gw)-1; i>=0; i--)
6969  {
6970  if((Gw->m[i]!=NULL) // len >=0
6971  && (Gw->m[i]->next!=NULL) // len >=1
6972  && (Gw->m[i]->next->next!=NULL)) // len >=2
6973  {
6974  intvec* iv_dp = MivUnit(nV); // define (1,1,...,1)
6975  intvec* Mdp;
6976 
6977  if(MivSame(ivstart, iv_dp) != 1)
6978  Mdp = MivWeightOrderdp(ivstart);
6979  else
6980  Mdp = MivMatrixOrderdp(nV);
6981 
6982  Xsigma = Mfpertvector(I, Mdp);
6984 
6985  delete Mdp;
6986  delete iv_dp;
6987  break;
6988  }
6989  }
6990  idDelete(&Gw);
6991 #endif
6992 
6993  ideal I1;
6994  intvec* Mlp;
6995  Xivlp = Mivlp(nV);
6996 
6997  if(MivComp(ivtarget, Xivlp) != 1)
6998  {
6999  if (rParameter(currRing) != NULL)
7000  DefRingPar(ivtarget);
7001  else
7002  rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1
7003 
7004  I1 = idrMoveR(I, oldRing,currRing);
7005  Mlp = MivWeightOrderlp(ivtarget);
7006  Xtau = Mfpertvector(I1, Mlp);
7007  }
7008  else
7009  {
7010  if (rParameter(currRing) != NULL)
7011  DefRingParlp();
7012  else
7013  VMrDefaultlp();
7014 
7015  I1 = idrMoveR(I, oldRing,currRing);
7016  Mlp = MivMatrixOrderlp(nV);
7017  Xtau = Mfpertvector(I1, Mlp);
7018  }
7019  delete Mlp;
7021 
7022  //ivString(Xsigma, "Xsigma");
7023  //ivString(Xtau, "Xtau");
7024 
7025  id_Delete(&I, oldRing);
7026  ring tRing = currRing;
7027 
7028  if (rParameter(currRing) != NULL)
7029  DefRingPar(ivstart);
7030  else
7031  rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2
7032 
7033  I = idrMoveR(I1,tRing,currRing);
7034  to=clock();
7035  ideal J = MstdCC(I);
7036  idDelete(&I);
7037  xftostd=xftostd+clock()-to;
7038 
7039  ideal resF;
7040  ring helpRing = currRing;
7041 //ideal G, int nlev, intvec* omtmp, int weight_rad)
7042  J = rec_r_fractal_call(J, 1, ivtarget,weight_rad);
7043 
7044  rChangeCurrRing(oldRing);
7045  resF = idrMoveR(J, helpRing,currRing);
7046  idSkipZeroes(resF);
7047 
7048  delete Xivlp;
7049  delete Xsigma;
7050  delete Xtau;
7051  delete XivNull;
7052 
7053 #ifdef TIME_TEST
7054  TimeStringFractal(xftinput, xftostd, xtif, xtstd, xtextra,
7055  xtlift, xtred, xtnw);
7056 
7057 
7058  Print("\n// pSetm_Error = (%d)", ErrorCheck());
7059  Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
7060  Print("\n// the numbers of Overflow_Error (%d)", nnflow);
7061 #endif
7062 
7063  return(resF);
7064 }
BOOLEAN ErrorCheck()
#define Print
Definition: emacs.cc:83
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1492
intvec * Xivlp
Definition: walk.cc:4287
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
intvec * Xivinput
Definition: walk.cc:4286
int nnflow
Definition: walk.cc:6105
static ring VMrDefault1(intvec *va)
Definition: walk.cc:2430
int ngleich
Definition: walk.cc:4282
int Xngleich
Definition: walk.cc:6107
#define FALSE
Definition: auxiliary.h:140
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1416
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
clock_t xtred
Definition: walk.cc:98
intvec * Xsigma
Definition: walk.cc:4283
int Xnlev
Definition: walk.cc:1491
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
intvec * MivWeightOrderdp(intvec *ivstart)
Definition: walk.cc:1436
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
intvec * Xtau
Definition: walk.cc:4284
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2748
int Xcall
Definition: walk.cc:6106
clock_t xftostd
Definition: walk.cc:99
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
clock_t xftinput
Definition: walk.cc:99
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2881
static ideal MstdCC(ideal G)
Definition: walk.cc:907
static ideal rec_r_fractal_call(ideal G, int nlev, intvec *omtmp, int weight_rad)
Definition: walk.cc:6458
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
clock_t xtlift
Definition: walk.cc:98
intvec * MivUnit(int nV)
Definition: walk.cc:1476
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
intvec * XivNull
Definition: walk.cc:6090
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
intvec * Mivlp(int nR)
Definition: walk.cc:995
clock_t xtif
Definition: walk.cc:98
ideal Mfwalk ( ideal  G,
intvec ivstart,
intvec ivtarget 
)

Definition at line 6814 of file walk.cc.

6815 {
6816  Set_Error(FALSE);
6818  //Print("// pSetm_Error = (%d)", ErrorCheck());
6819  //Print("\n// ring ro = %s;", rString(currRing));
6820 
6821  nnflow = 0;
6822  Xngleich = 0;
6823  Xcall = 0;
6824  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0;
6825  xftinput = clock();
6826 
6827  ring oldRing = currRing;
6828  int i, nV = currRing->N;
6829  XivNull = new intvec(nV);
6830  Xivinput = ivtarget;
6831  ngleich = 0;
6832  to=clock();
6833  ideal I = MstdCC(G);
6834  G = NULL;
6835  xftostd=clock()-to;
6836  Xsigma = ivstart;
6837 
6838  Xnlev=nV;
6839 
6840 #ifdef FIRST_STEP_FRACTAL
6841  ideal Gw = MwalkInitialForm(I, ivstart);
6842  for(i=IDELEMS(Gw)-1; i>=0; i--)
6843  {
6844  if((Gw->m[i]!=NULL) // len >=0
6845  && (Gw->m[i]->next!=NULL) // len >=1
6846  && (Gw->m[i]->next->next!=NULL)) // len >=2
6847  {
6848  intvec* iv_dp = MivUnit(nV); // define (1,1,...,1)
6849  intvec* Mdp;
6850 
6851  if(MivSame(ivstart, iv_dp) != 1)
6852  Mdp = MivWeightOrderdp(ivstart);
6853  else
6854  Mdp = MivMatrixOrderdp(nV);
6855 
6856  Xsigma = Mfpertvector(I, Mdp);
6858 
6859  delete Mdp;
6860  delete iv_dp;
6861  break;
6862  }
6863  }
6864  idDelete(&Gw);
6865 #endif
6866 
6867  ideal I1;
6868  intvec* Mlp;
6869  Xivlp = Mivlp(nV);
6870 
6871  if(MivComp(ivtarget, Xivlp) != 1)
6872  {
6873  if (rParameter(currRing) != NULL)
6874  DefRingPar(ivtarget);
6875  else
6876  rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1
6877 
6878  I1 = idrMoveR(I, oldRing,currRing);
6879  Mlp = MivWeightOrderlp(ivtarget);
6880  Xtau = Mfpertvector(I1, Mlp);
6881  }
6882  else
6883  {
6884  if (rParameter(currRing) != NULL)
6885  DefRingParlp();
6886  else
6887  VMrDefaultlp();
6888 
6889  I1 = idrMoveR(I, oldRing,currRing);
6890  Mlp = MivMatrixOrderlp(nV);
6891  Xtau = Mfpertvector(I1, Mlp);
6892  }
6893  delete Mlp;
6895 
6896  //ivString(Xsigma, "Xsigma");
6897  //ivString(Xtau, "Xtau");
6898 
6899  id_Delete(&I, oldRing);
6900  ring tRing = currRing;
6901 
6902  if (rParameter(currRing) != NULL)
6903  DefRingPar(ivstart);
6904  else
6905  rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2
6906 
6907  I = idrMoveR(I1,tRing,currRing);
6908  to=clock();
6909  ideal J = MstdCC(I);
6910  idDelete(&I);
6911  xftostd=xftostd+clock()-to;
6912 
6913  ideal resF;
6914  ring helpRing = currRing;
6915 
6916  J = rec_fractal_call(J, 1, ivtarget);
6917 
6918  rChangeCurrRing(oldRing);
6919  resF = idrMoveR(J, helpRing,currRing);
6920  idSkipZeroes(resF);
6921 
6922  delete Xivlp;
6923  delete Xsigma;
6924  delete Xtau;
6925  delete XivNull;
6926 
6927 #ifdef TIME_TEST
6928  TimeStringFractal(xftinput, xftostd, xtif, xtstd, xtextra,
6929  xtlift, xtred, xtnw);
6930 
6931 
6932  Print("\n// pSetm_Error = (%d)", ErrorCheck());
6933  Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
6934  Print("\n// the numbers of Overflow_Error (%d)", nnflow);
6935 #endif
6936 
6937  return(resF);
6938 }
BOOLEAN ErrorCheck()
#define Print
Definition: emacs.cc:83
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1492
intvec * Xivlp
Definition: walk.cc:4287
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
intvec * Xivinput
Definition: walk.cc:4286
int nnflow
Definition: walk.cc:6105
static ring VMrDefault1(intvec *va)
Definition: walk.cc:2430
int ngleich
Definition: walk.cc:4282
int Xngleich
Definition: walk.cc:6107
#define FALSE
Definition: auxiliary.h:140
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1416
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
clock_t xtred
Definition: walk.cc:98
intvec * Xsigma
Definition: walk.cc:4283
int Xnlev
Definition: walk.cc:1491
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
intvec * MivWeightOrderdp(intvec *ivstart)
Definition: walk.cc:1436
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
intvec * Xtau
Definition: walk.cc:4284
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2748
int Xcall
Definition: walk.cc:6106
clock_t xftostd
Definition: walk.cc:99
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
clock_t xftinput
Definition: walk.cc:99
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2881
static ideal MstdCC(ideal G)
Definition: walk.cc:907
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal rec_fractal_call(ideal G, int nlev, intvec *omtmp)
Definition: walk.cc:6112
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
clock_t xtlift
Definition: walk.cc:98
intvec * MivUnit(int nV)
Definition: walk.cc:1476
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
intvec * XivNull
Definition: walk.cc:6090
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
intvec * Mivlp(int nR)
Definition: walk.cc:995
clock_t xtif
Definition: walk.cc:98
static ideal MidMult ( ideal  A,
ideal  B 
)
static

Definition at line 1698 of file walk.cc.

1699 {
1700  int mA = IDELEMS(A), mB = IDELEMS(B);
1701 
1702  if(A==NULL || B==NULL)
1703  {
1704  return NULL;
1705  }
1706  if(mB < mA)
1707  {
1708  mA = mB;
1709  }
1710  ideal result = idInit(mA, 1);
1711 
1712  int i, k=0;
1713  for(i=0; i<mA; i++)
1714  {
1715  result->m[k] = pMult(A->m[i], pCopy(B->m[i]));
1716  A->m[i]=NULL;
1717  if (result->m[k]!=NULL)
1718  {
1719  k++;
1720  }
1721  }
1722 
1723  idDelete(&A);
1724  idSkipZeroes(result);
1725  return result;
1726 }
int k
Definition: cfEzgcd.cc:93
#define A
Definition: sirandom.c:23
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
#define pMult(p, q)
Definition: polys.h:178
b *CanonicalForm B
Definition: facBivar.cc:51
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
static int MivAbsMax ( intvec vec)
static

Definition at line 1830 of file walk.cc.

1831 {
1832  int i,k;
1833  if((*vec)[0] < 0)
1834  {
1835  k = -(*vec)[0];
1836  }
1837  else
1838  {
1839  k = (*vec)[0];
1840  }
1841  for(i=1; i < (vec->length()); i++)
1842  {
1843  if((*vec)[i] < 0)
1844  {
1845  if(-(*vec)[i] > k)
1846  {
1847  k = -(*vec)[i];
1848  }
1849  }
1850  else
1851  {
1852  if((*vec)[i] > k)
1853  {
1854  k = (*vec)[i];
1855  }
1856  }
1857  }
1858  return k;
1859 }
int length() const
Definition: intvec.h:86
int k
Definition: cfEzgcd.cc:93
int i
Definition: cfEzgcd.cc:123
static int MivComp ( intvec iva,
intvec ivb 
)
inlinestatic

Definition at line 1813 of file walk.cc.

1814 {
1815  assume(iva->length() == ivb->length());
1816  int i;
1817  for(i=iva->length()-1; i>=0; i--)
1818  {
1819  if((*iva)[i] - (*ivb)[i] != 0)
1820  {
1821  return 0;
1822  }
1823  }
1824  return 1;
1825 }
int length() const
Definition: intvec.h:86
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
static long MivDotProduct ( intvec a,
intvec b 
)
inlinestatic

Definition at line 820 of file walk.cc.

821 {
822  assume( a->length() == b->length());
823  int i, n = a->length();
824  long result = 0;
825 
826  for(i=n-1; i>=0; i--)
827  {
828  result += (*a)[i] * (*b)[i];
829  }
830  return result;
831 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
int length() const
Definition: intvec.h:86
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
return result
Definition: facAbsBiFact.cc:76
intvec* Mivdp ( int  nR)

Definition at line 980 of file walk.cc.

981 {
982  int i;
983  intvec* ivm = new intvec(nR);
984 
985  for(i=nR-1; i>=0; i--)
986  {
987  (*ivm)[i] = 1;
988  }
989  return ivm;
990 }
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* Mivlp ( int  nR)

Definition at line 995 of file walk.cc.

996 {
997  intvec* ivm = new intvec(nR);
998  (*ivm)[0] = 1;
999 
1000  return ivm;
1001 }
Definition: intvec.h:16
intvec* MivMatrixOrder ( intvec iv)

Definition at line 938 of file walk.cc.

939 {
940  int i, nR = iv->length();
941 
942  intvec* ivm = new intvec(nR*nR);
943 
944  for(i=0; i<nR; i++)
945  {
946  (*ivm)[i] = (*iv)[i];
947  }
948  for(i=1; i<nR; i++)
949  {
950  (*ivm)[i*nR+i-1] = 1;
951  }
952  return ivm;
953 }
int length() const
Definition: intvec.h:86
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MivMatrixOrderdp ( int  nV)

Definition at line 1397 of file walk.cc.

1398 {
1399  int i;
1400  intvec* ivM = new intvec(nV*nV);
1401 
1402  for(i=0; i<nV; i++)
1403  {
1404  (*ivM)[i] = 1;
1405  }
1406  for(i=1; i<nV; i++)
1407  {
1408  (*ivM)[(i+1)*nV - i] = -1;
1409  }
1410  return(ivM);
1411 }
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MivMatrixOrderlp ( int  nV)

Definition at line 1381 of file walk.cc.

1382 {
1383  int i;
1384  intvec* ivM = new intvec(nV*nV);
1385 
1386  for(i=0; i<nV; i++)
1387  {
1388  (*ivM)[i*nV + i] = 1;
1389  }
1390  return(ivM);
1391 }
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MivMatrixOrderRefine ( intvec iv,
intvec iw 
)

Definition at line 958 of file walk.cc.

959 {
960  assume(iv->length() == iw->length());
961  int i, nR = iv->length();
962 
963  intvec* ivm = new intvec(nR*nR);
964 
965  for(i=0; i<nR; i++)
966  {
967  (*ivm)[i] = (*iv)[i];
968  (*ivm)[i+nR] = (*iw)[i];
969  }
970  for(i=2; i<nR; i++)
971  {
972  (*ivm)[i*nR+i-2] = 1;
973  }
974  return ivm;
975 }
int length() const
Definition: intvec.h:86
Definition: intvec.h:16
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
int MivSame ( intvec u,
intvec v 
)

Definition at line 868 of file walk.cc.

869 {
870  assume(u->length() == v->length());
871 
872  int i, niv = u->length();
873 
874  for (i=0; i<niv; i++)
875  {
876  if ((*u)[i] != (*v)[i])
877  {
878  return 0;
879  }
880  }
881  return 1;
882 }
int length() const
Definition: intvec.h:86
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
static intvec* MivSub ( intvec a,
intvec b 
)
static

Definition at line 836 of file walk.cc.

837 {
838  assume( a->length() == b->length());
839  int i, n = a->length();
840  intvec* result = new intvec(n);
841 
842  for(i=n-1; i>=0; i--)
843  {
844  (*result)[i] = (*a)[i] - (*b)[i];
845  }
846  return result;
847 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
int length() const
Definition: intvec.h:86
Definition: intvec.h:16
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
return result
Definition: facAbsBiFact.cc:76
intvec* MivUnit ( int  nV)

Definition at line 1476 of file walk.cc.

1477 {
1478  int i;
1479  intvec* ivM = new intvec(nV);
1480  for(i=nV-1; i>=0; i--)
1481  {
1482  (*ivM)[i] = 1;
1483  }
1484  return(ivM);
1485 }
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MivWeightOrderdp ( intvec ivstart)

Definition at line 1436 of file walk.cc.

1437 {
1438  int i;
1439  int nV = ivstart->length();
1440  intvec* ivM = new intvec(nV*nV);
1441 
1442  for(i=0; i<nV; i++)
1443  {
1444  (*ivM)[i] = (*ivstart)[i];
1445  }
1446  for(i=0; i<nV; i++)
1447  {
1448  (*ivM)[nV+i] = 1;
1449  }
1450  for(i=2; i<nV; i++)
1451  {
1452  (*ivM)[(i+1)*nV - i] = -1;
1453  }
1454  return(ivM);
1455 }
int length() const
Definition: intvec.h:86
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MivWeightOrderlp ( intvec ivstart)

Definition at line 1416 of file walk.cc.

1417 {
1418  int i;
1419  int nV = ivstart->length();
1420  intvec* ivM = new intvec(nV*nV);
1421 
1422  for(i=0; i<nV; i++)
1423  {
1424  (*ivM)[i] = (*ivstart)[i];
1425  }
1426  for(i=1; i<nV; i++)
1427  {
1428  (*ivM)[i*nV + i-1] = 1;
1429  }
1430  return(ivM);
1431 }
int length() const
Definition: intvec.h:86
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
intvec* MkInterRedNextWeight ( intvec iva,
intvec ivb,
ideal  G 
)

Definition at line 2248 of file walk.cc.

2249 {
2250  intvec* tmp = new intvec(iva->length());
2251  intvec* result;
2252 
2253  if(G == NULL)
2254  {
2255  return tmp;
2256  }
2257  if(MivComp(iva, ivb) == 1)
2258  {
2259  return tmp;
2260  }
2261  result = MwalkNextWeightCC(iva, ivb, G);
2262 
2263  if(MivComp(result, iva) == 1)
2264  {
2265  delete result;
2266  return tmp;
2267  }
2268 
2269  delete tmp;
2270  return result;
2271 }
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
int length() const
Definition: intvec.h:86
static TreeM * G
Definition: janet.cc:38
Definition: intvec.h:16
static intvec * MwalkNextWeightCC(intvec *curr_weight, intvec *target_weight, ideal G)
Definition: walk.cc:1865
#define NULL
Definition: omList.c:10
return result
Definition: facAbsBiFact.cc:76
static long Mlcm ( long &  i1,
long &  i2 
)
inlinestatic

Definition at line 810 of file walk.cc.

811 {
812  long temp = gcd(i1, i2);
813  return ((i1 / temp)* i2);
814 }
static long gcd(const long a, const long b)
Definition: walk.cc:541
static ideal MLifttwoIdeal ( ideal  Gw,
ideal  M,
ideal  G 
)
static

Definition at line 1736 of file walk.cc.

1737 {
1738  ideal Mtmp = idLift(Gw, M, NULL, FALSE, TRUE, TRUE, NULL);
1739 
1740  // If Gw is a GB, then isSB = TRUE, otherwise FALSE
1741  // So, it is better, if one tests whether Gw is a GB
1742  // in ideals.cc:
1743  // idLift (ideal mod, ideal submod,ideal * rest, BOOLEAN goodShape,
1744  // BOOLEAN isSB,BOOLEAN divide,matrix * unit)
1745 
1746  // Let be Mtmp = {m1,...,ms}, where mi=sum hij.in_gj, for all i=1,...,s
1747  // We compute F = {f1,...,fs}, where fi=sum hij.gj
1748  int i, j, nM = IDELEMS(Mtmp);
1749  ideal idpol, idLG;
1750  ideal F = idInit(nM, 1);
1751 
1752  for(i=0; i<nM; i++)
1753  {
1754  idpol = idVec2Ideal(Mtmp->m[i]);
1755  idLG = MidMult(idpol, G);
1756  idpol = NULL;
1757  F->m[i] = NULL;
1758  for(j=IDELEMS(idLG)-1; j>=0; j--)
1759  {
1760  F->m[i] = pAdd(F->m[i], idLG->m[j]);
1761  idLG->m[j]=NULL;
1762  }
1763  idDelete(&idLG);
1764  }
1765  idDelete(&Mtmp);
1766  return F;
1767 }
ideal idVec2Ideal(poly vec)
Definition: ideals.h:169
#define pAdd(p, q)
Definition: polys.h:174
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
static TreeM * G
Definition: janet.cc:38
#define M
Definition: sirandom.c:24
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
static ideal MidMult(ideal A, ideal B)
Definition: walk.cc:1698
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit)
Definition: ideals.cc:938
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
static int MLmWeightedDegree ( const poly  p,
intvec weight 
)
inlinestatic

Definition at line 598 of file walk.cc.

599 {
600  /* 2147483647 is max. integer representation in SINGULAR */
601  mpz_t sing_int;
602  mpz_init_set_ui(sing_int, 2147483647);
603 
604  int i, wgrad;
605 
606  mpz_t zmul;
607  mpz_init(zmul);
608  mpz_t zvec;
609  mpz_init(zvec);
610  mpz_t zsum;
611  mpz_init(zsum);
612 
613  for (i=currRing->N; i>0; i--)
614  {
615  mpz_set_si(zvec, (*weight)[i-1]);
616  mpz_mul_ui(zmul, zvec, pGetExp(p, i));
617  mpz_add(zsum, zsum, zmul);
618  }
619 
620  wgrad = mpz_get_ui(zsum);
621 
622  if(mpz_cmp(zsum, sing_int)>0)
623  {
624  if(Overflow_Error == FALSE)
625  {
626  PrintLn();
627  PrintS("\n// ** OVERFLOW in \"MwalkInitialForm\": ");
628  mpz_out_str( stdout, 10, zsum);
629  PrintS(" is greater than 2147483647 (max. integer representation)");
631  }
632  }
633 
634  mpz_clear(zmul);
635  mpz_clear(zvec);
636  mpz_clear(zsum);
637  mpz_clear(sing_int);
638 
639  return wgrad;
640 }
void PrintLn()
Definition: reporter.cc:322
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
BOOLEAN Overflow_Error
Definition: walk.cc:96
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static void MLmWeightedDegree_gmp ( mpz_t  result,
const poly  p,
intvec weight 
)
static

Definition at line 667 of file walk.cc.

668 {
669  /* 2147483647 is max. integer representation in SINGULAR */
670  mpz_t sing_int;
671  mpz_init_set_ui(sing_int, 2147483647);
672 
673  int i;
674 
675  mpz_t zmul;
676  mpz_init(zmul);
677  mpz_t zvec;
678  mpz_init(zvec);
679  mpz_t ztmp;
680  mpz_init(ztmp);
681 
682  for (i=currRing->N; i>0; i--)
683  {
684  mpz_set_si(zvec, (*weight)[i-1]);
685  mpz_mul_ui(zmul, zvec, pGetExp(p, i));
686  mpz_add(ztmp, ztmp, zmul);
687  }
688  mpz_init_set(result, ztmp);
689  mpz_clear(ztmp);
690  mpz_clear(sing_int);
691  mpz_clear(zvec);
692  mpz_clear(zmul);
693 }
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int i
Definition: cfEzgcd.cc:123
return result
Definition: facAbsBiFact.cc:76
intvec* MMatrixone ( int  nV)

Definition at line 6093 of file walk.cc.

6094 {
6095  int i,j;
6096  intvec* ivM = new intvec(nV*nV);
6097 
6098  for(i=0; i<nV; i++)
6099  for(j=0; j<nV; j++)
6100  (*ivM)[i*nV + j] = 1;
6101 
6102  return(ivM);
6103 }
Definition: intvec.h:16
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
intvec* MPertVectors ( ideal  G,
intvec ivtarget,
int  pdeg 
)

Definition at line 1061 of file walk.cc.

1062 {
1063  // ivtarget is a matrix order of a degree reverse lex. order
1064  int nV = currRing->N;
1065  //assume(pdeg <= nV && pdeg >= 0);
1066 
1067  int i, j, nG = IDELEMS(G);
1068  intvec* v_null = new intvec(nV);
1069 
1070 
1071  // Check that the perturbed degree is valid
1072  if(pdeg > nV || pdeg <= 0)
1073  {
1074  WerrorS("//** The perturbed degree is wrong!!");
1075  return v_null;
1076  }
1077  delete v_null;
1078 
1079  if(pdeg == 1)
1080  {
1081  return ivtarget;
1082  }
1083  mpz_t *pert_vector = (mpz_t*)omAlloc(nV*sizeof(mpz_t));
1084  //mpz_t *pert_vector1 = (mpz_t*)omAlloc(nV*sizeof(mpz_t));
1085 
1086  for(i=0; i<nV; i++)
1087  {
1088  mpz_init_set_si(pert_vector[i], (*ivtarget)[i]);
1089  // mpz_init_set_si(pert_vector1[i], (*ivtarget)[i]);
1090  }
1091  // Calculate max1 = Max(A2)+Max(A3)+...+Max(Apdeg),
1092  // where the Ai are the i-te rows of the matrix target_ord.
1093  int ntemp, maxAi, maxA=0;
1094  for(i=1; i<pdeg; i++)
1095  {
1096  maxAi = (*ivtarget)[i*nV];
1097  if(maxAi<0)
1098  {
1099  maxAi = -maxAi;
1100  }
1101  for(j=i*nV+1; j<(i+1)*nV; j++)
1102  {
1103  ntemp = (*ivtarget)[j];
1104  if(ntemp < 0)
1105  {
1106  ntemp = -ntemp;
1107  }
1108  if(ntemp > maxAi)
1109  {
1110  maxAi = ntemp;
1111  }
1112  }
1113  maxA += maxAi;
1114  }
1115 
1116  // Calculate inveps = 1/eps, where 1/eps > totaldeg(p)*max1 for all p in G.
1117 
1118  intvec* ivUnit = Mivdp(nV);
1119 
1120  mpz_t tot_deg; mpz_init(tot_deg);
1121  mpz_t maxdeg; mpz_init(maxdeg);
1122  mpz_t inveps; mpz_init(inveps);
1123 
1124 
1125  for(i=nG-1; i>=0; i--)
1126  {
1127  mpz_set_ui(maxdeg, MwalkWeightDegree(G->m[i], ivUnit));
1128  if (mpz_cmp(maxdeg, tot_deg) > 0 )
1129  {
1130  mpz_set(tot_deg, maxdeg);
1131  }
1132  }
1133 
1134  delete ivUnit;
1135  mpz_mul_ui(inveps, tot_deg, maxA);
1136  mpz_add_ui(inveps, inveps, 1);
1137 
1138 
1139  // takes "small" inveps
1140 #ifdef INVEPS_SMALL_IN_MPERTVECTOR
1141  if(mpz_cmp_ui(inveps, pdeg)>0 && pdeg > 3)
1142  {
1143  // Print("\n// choose the\"small\" inverse epsilon := %d / %d = ", mpz_get_si(inveps), pdeg);
1144  mpz_fdiv_q_ui(inveps, inveps, pdeg);
1145  // mpz_out_str(stdout, 10, inveps);
1146  }
1147 #else
1148  // PrintS("\n// the \"big\" inverse epsilon: ");
1149  mpz_out_str(stdout, 10, inveps);
1150 #endif
1151 
1152  // pert(A1) = inveps^(pdeg-1)*A1 + inveps^(pdeg-2)*A2+...+A_pdeg,
1153  // pert_vector := A1
1154  for( i=1; i < pdeg; i++ )
1155  {
1156  for(j=0; j<nV; j++)
1157  {
1158  mpz_mul(pert_vector[j], pert_vector[j], inveps);
1159  if((*ivtarget)[i*nV+j]<0)
1160  {
1161  mpz_sub_ui(pert_vector[j], pert_vector[j],-(*ivtarget)[i*nV+j]);
1162  }
1163  else
1164  {
1165  mpz_add_ui(pert_vector[j], pert_vector[j],(*ivtarget)[i*nV+j]);
1166  }
1167  }
1168  }
1169  mpz_t ztemp;
1170  mpz_init(ztemp);
1171  mpz_set(ztemp, pert_vector[0]);
1172  for(i=1; i<nV; i++)
1173  {
1174  mpz_gcd(ztemp, ztemp, pert_vector[i]);
1175  if(mpz_cmp_si(ztemp, 1) == 0)
1176  {
1177  break;
1178  }
1179  }
1180  if(mpz_cmp_si(ztemp, 1) != 0)
1181  {
1182  for(i=0; i<nV; i++)
1183  {
1184  mpz_divexact(pert_vector[i], pert_vector[i], ztemp);
1185  }
1186  }
1187 
1188  intvec *pert_vector1= new intvec(nV);
1189  j = 0;
1190  for(i=0; i<nV; i++)
1191  {
1192  (* pert_vector1)[i] = mpz_get_si(pert_vector[i]);
1193  (* pert_vector1)[i] = 0.1*(* pert_vector1)[i];
1194  (* pert_vector1)[i] = floor((* pert_vector1)[i] + 0.5);
1195  if((* pert_vector1)[i] == 0)
1196  {
1197  j++;
1198  }
1199  }
1200  if(j > nV - 1)
1201  {
1202  // Print("\n// MPertVectors: geaenderter vector gleich Null! \n");
1203  delete pert_vector1;
1204  goto CHECK_OVERFLOW;
1205  }
1206 
1207 // check that the perturbed weight vector lies in the Groebner cone
1208  if(test_w_in_ConeCC(G,pert_vector1) != 0)
1209  {
1210  // Print("\n// MPertVectors: geaenderter vector liegt in Groebnerkegel! \n");
1211  for(i=0; i<nV; i++)
1212  {
1213  mpz_set_si(pert_vector[i], (*pert_vector1)[i]);
1214  }
1215  }
1216  else
1217  {
1218  //Print("\n// MpertVectors: geaenderter vector liegt nicht in Groebnerkegel! \n");
1219  }
1220  delete pert_vector1;
1221 
1222  CHECK_OVERFLOW:
1223  intvec* result = new intvec(nV);
1224 
1225  /* 2147483647 is max. integer representation in SINGULAR */
1226  mpz_t sing_int;
1227  mpz_init_set_ui(sing_int, 2147483647);
1228 
1229  int ntrue=0;
1230  for(i=0; i<nV; i++)
1231  {
1232  (*result)[i] = mpz_get_si(pert_vector[i]);
1233  if(mpz_cmp(pert_vector[i], sing_int)>=0)
1234  {
1235  ntrue++;
1236  if(Overflow_Error == FALSE)
1237  {
1238  Overflow_Error = TRUE;
1239  PrintS("\n// ** OVERFLOW in \"MPertvectors\": ");
1240  mpz_out_str( stdout, 10, pert_vector[i]);
1241  PrintS(" is greater than 2147483647 (max. integer representation)");
1242  Print("\n// So vector[%d] := %d is wrong!!", i+1, (*result)[i]);
1243  }
1244  }
1245  }
1246 
1247  if(Overflow_Error == TRUE)
1248  {
1249  ivString(result, "pert_vector");
1250  Print("\n// %d element(s) of it is overflow!!", ntrue);
1251  }
1252 
1253  mpz_clear(ztemp);
1254  mpz_clear(sing_int);
1255  omFree(pert_vector);
1256  //omFree(pert_vector1);
1257  mpz_clear(tot_deg);
1258  mpz_clear(maxdeg);
1259  mpz_clear(inveps);
1260 
1262  for(j=0; j<IDELEMS(G); j++)
1263  {
1264  poly p=G->m[j];
1265  while(p!=NULL)
1266  {
1267  p_Setm(p,currRing); pIter(p);
1268  }
1269  }
1270  return result;
1271 }
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
static TreeM * G
Definition: janet.cc:38
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
intvec * Mivdp(int nR)
Definition: walk.cc:980
#define NULL
Definition: omList.c:10
static int MwalkWeightDegree(poly p, intvec *weight_vector)
Definition: walk.cc:645
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
polyrec * poly
Definition: hilb.h:10
static void ivString(intvec *iv, const char *ch)
Definition: walk.cc:500
return result
Definition: facAbsBiFact.cc:76
intvec* MPertVectorslp ( ideal  G,
intvec ivtarget,
int  pdeg 
)

Definition at line 1279 of file walk.cc.

1280 {
1281  // ivtarget is a matrix order of the lex. order
1282  int nV = currRing->N;
1283  //assume(pdeg <= nV && pdeg >= 0);
1284 
1285  int i, j, nG = IDELEMS(G);
1286  intvec* pert_vector = new intvec(nV);
1287 
1288  //Checking that the perturbated degree is valid
1289  if(pdeg > nV || pdeg <= 0)
1290  {
1291  WerrorS("//** The perturbed degree is wrong!!");
1292  return pert_vector;
1293  }
1294  for(i=0; i<nV; i++)
1295  {
1296  (*pert_vector)[i]=(*ivtarget)[i];
1297  }
1298  if(pdeg == 1)
1299  {
1300  return pert_vector;
1301  }
1302  // Calculate max1 = Max(A2)+Max(A3)+...+Max(Apdeg),
1303  // where the Ai are the i-te rows of the matrix target_ord.
1304  int ntemp, maxAi, maxA=0;
1305  for(i=1; i<pdeg; i++)
1306  {
1307  maxAi = (*ivtarget)[i*nV];
1308  for(j=i*nV+1; j<(i+1)*nV; j++)
1309  {
1310  ntemp = (*ivtarget)[j];
1311  if(ntemp > maxAi)
1312  {
1313  maxAi = ntemp;
1314  }
1315  }
1316  maxA += maxAi;
1317  }
1318 
1319  // Calculate inveps := 1/eps, where 1/eps > deg(p)*max1 for all p in G.
1320  int inveps, tot_deg = 0, maxdeg;
1321 
1322  intvec* ivUnit = Mivdp(nV);//19.02
1323  for(i=nG-1; i>=0; i--)
1324  {
1325  // maxdeg = pTotaldegree(G->m[i], currRing); //it's wrong for ex1,2,rose
1326  maxdeg = MwalkWeightDegree(G->m[i], ivUnit);
1327  if (maxdeg > tot_deg )
1328  {
1329  tot_deg = maxdeg;
1330  }
1331  }
1332  delete ivUnit;
1333 
1334  inveps = (tot_deg * maxA) + 1;
1335 
1336 #ifdef INVEPS_SMALL_IN_FRACTAL
1337  // Print("\n// choose the\"small\" inverse epsilon := %d / %d = ", inveps, pdeg);
1338  if(inveps > pdeg && pdeg > 3)
1339  {
1340  inveps = inveps / pdeg;
1341  }
1342  // Print(" %d", inveps);
1343 #else
1344  PrintS("\n// the \"big\" inverse epsilon %d", inveps);
1345 #endif
1346 
1347  // Pert(A1) = inveps^(pdeg-1)*A1 + inveps^(pdeg-2)*A2+...+A_pdeg
1348  for ( i=1; i < pdeg; i++ )
1349  {
1350  for(j=0; j<nV; j++)
1351  {
1352  (*pert_vector)[j] = inveps*((*pert_vector)[j]) + (*ivtarget)[i*nV+j];
1353  }
1354  }
1355 
1356  int temp = (*pert_vector)[0];
1357  for(i=1; i<nV; i++)
1358  {
1359  temp = gcd(temp, (*pert_vector)[i]);
1360  if(temp == 1)
1361  {
1362  break;
1363  }
1364  }
1365  if(temp != 1)
1366  {
1367  for(i=0; i<nV; i++)
1368  {
1369  (*pert_vector)[i] = (*pert_vector)[i] / temp;
1370  }
1371  }
1372 
1373  intvec* result = pert_vector;
1374  delete pert_vector;
1375  return result;
1376 }
void WerrorS(const char *s)
Definition: feFopen.cc:23
static TreeM * G
Definition: janet.cc:38
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
intvec * Mivdp(int nR)
Definition: walk.cc:980
static long gcd(const long a, const long b)
Definition: walk.cc:541
static int MwalkWeightDegree(poly p, intvec *weight_vector)
Definition: walk.cc:645
return result
Definition: facAbsBiFact.cc:76
static poly MpolyInitialForm ( poly  g,
intvec curr_weight 
)
static

Definition at line 699 of file walk.cc.

700 {
701  if(g == NULL)
702  {
703  return NULL;
704  }
705  mpz_t max; mpz_init(max);
706  mpz_t maxtmp; mpz_init(maxtmp);
707 
708  poly hg, in_w_g = NULL;
709 
710  while(g != NULL)
711  {
712  hg = g;
713  pIter(g);
714  MLmWeightedDegree_gmp(maxtmp, hg, curr_weight);
715 
716  if(mpz_cmp(maxtmp, max)>0)
717  {
718  mpz_init_set(max, maxtmp);
719  pDelete(&in_w_g);
720  in_w_g = pHead(hg);
721  }
722  else
723  {
724  if(mpz_cmp(maxtmp, max)==0)
725  {
726  in_w_g = pAdd(in_w_g, pHead(hg));
727  }
728  }
729  }
730  return in_w_g;
731 }
#define pAdd(p, q)
Definition: polys.h:174
g
Definition: cfModGcd.cc:4031
#define pIter(p)
Definition: monomials.h:44
static int max(int a, int b)
Definition: fast_mult.cc:264
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
static void MLmWeightedDegree_gmp(mpz_t result, const poly p, intvec *weight)
Definition: walk.cc:667
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
ideal Mprwalk ( ideal  Go,
intvec curr_weight,
intvec target_weight,
int  weight_rad,
int  op_deg,
int  tp_deg,
ring  baseRing 
)

Definition at line 8246 of file walk.cc.

8247 {
8248  BITSET save1 = si_opt_1; // save current options
8249  si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
8250  Set_Error(FALSE);
8252 #ifdef TIME_TEST
8253  clock_t tinput=0, tostd=0, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
8254  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
8255  tinput = clock();
8256  clock_t tim;
8257 #endif
8258  int i,nwalk,nV = baseRing->N;
8259 
8260  ideal G, Gomega, M, F, Gomega1, Gomega2, M1;
8261  ring newRing;
8262  ring XXRing = baseRing;
8263  intvec* exivlp = Mivlp(nV);
8264  intvec* orig_target = target_weight;
8265  intvec* pert_target_vector = target_weight;
8266  intvec* ivNull = new intvec(nV);
8267  intvec* tmp_weight = new intvec(nV);
8268 #ifdef CHECK_IDEAL_MWALK
8269  poly p;
8270 #endif
8271  for(i=0; i<nV; i++)
8272  {
8273  (*tmp_weight)[i] = (*curr_weight)[i];
8274  }
8275 #ifndef BUCHBERGER_ALG
8276  intvec* hilb_func;
8277  // to avoid (1,0,...,0) as the target vector
8278  intvec* last_omega = new intvec(nV);
8279  for(i=0 i<nV; i++)
8280  {
8281  (*last_omega)[i] = 1;
8282  }
8283  (*last_omega)[0] = 10000;
8284 #endif
8285  baseRing = currRing;
8286  newRing = VMrDefault(curr_weight);
8287  rChangeCurrRing(newRing);
8288  G = idrMoveR(Go,baseRing,currRing);
8289 #ifdef TIME_TEST
8290  to = clock();
8291 #endif
8292  G = kStd(G,NULL,testHomog,NULL,NULL,0,0,NULL);
8293  idSkipZeroes(G);
8294 #ifdef TIME_TEST
8295  tostd = tostd + to - clock();
8296 #endif
8297 #ifdef CHECK_IDEAL_MWALK
8298  idString(G,"G");
8299 #endif
8300  if(op_deg >1)
8301  {
8302  if(MivComp(curr_weight,MivUnit(nV)) == 1) //ring order is "dp"
8303  {
8304  curr_weight = MPertVectors(G, MivMatrixOrderdp(nV), op_deg);
8305  }
8306  else //ring order is not "dp"
8307  {
8308  curr_weight = MPertVectors(G, MivMatrixOrder(curr_weight), op_deg);
8309  }
8310  }
8311  baseRing = currRing;
8312  if(tp_deg > 1 && tp_deg <= nV)
8313  {
8314  pert_target_vector = target_weight;
8315  }
8316 #ifdef CHECK_IDEAL_MWALK
8317  ivString(curr_weight, "new curr_weight");
8318  ivString(target_weight, "new target_weight");
8319 #endif
8320  nwalk = 0;
8321  while(1)
8322  {
8323  nwalk ++;
8324 #ifdef TIME_TEST
8325  to = clock();
8326 #endif
8327  Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
8328 #ifdef TIME_TEST
8329  tif = tif + clock()-to; //time for computing initial form ideal
8330 #endif
8331 #ifdef CHECK_IDEAL_MWALK
8332  idString(Gomega,"Gomega");
8333 #endif
8334 #ifndef BUCHBERGER_ALG
8335  if(isNolVector(curr_weight) == 0)
8336  {
8337  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
8338  }
8339  else
8340  {
8341  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
8342  }
8343 #endif
8344  if(nwalk == 1)
8345  {
8346  newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
8347  }
8348  else
8349  {
8350  newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
8351  }
8352  rChangeCurrRing(newRing);
8353  Gomega1 = idrMoveR(Gomega, baseRing,currRing);
8354  idDelete(&Gomega);
8355  // compute a Groebner basis of <Gomega> w.r.t. "newRing"
8356 #ifdef TIME_TEST
8357  to = clock();
8358 #endif
8359 #ifndef BUCHBERGER_ALG
8360  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
8361  delete hilb_func;
8362 #else
8363  M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
8364 #endif
8365  idSkipZeroes(M);
8366 #ifdef TIME_TEST
8367  tstd = tstd + clock() - to;
8368 #endif
8369 #ifdef CHECK_IDEAL_MWALK
8370  idString(M, "M");
8371 #endif
8372  //change the ring to baseRing
8373  rChangeCurrRing(baseRing);
8374  M1 = idrMoveR(M, newRing,currRing);
8375  idDelete(&M);
8376  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
8377  idDelete(&Gomega1);
8378  to = clock();
8379  // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring
8380  F = MLifttwoIdeal(Gomega2, M1, G);
8381  idSkipZeroes(F);
8382 #ifdef TIME_TEST
8383  tlift = tlift + clock() - to;
8384 #endif
8385 #ifdef CHECK_IDEAL_MWALK
8386  idString(F,"F");
8387 #endif
8388  rChangeCurrRing(newRing); // change the ring to newRing
8389  G = idrMoveR(F,baseRing,currRing);
8390  idDelete(&F);
8391  baseRing = currRing; // set baseRing equal to newRing
8392 #ifdef CHECK_IDEAL_MWALK
8393  idString(G,"G");
8394 #endif
8395 #ifdef TIME_TEST
8396  to = clock();
8397 #endif
8398  intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, op_deg);
8399 #ifdef TIME_TEST
8400  tnw = tnw + clock() - to;
8401 #endif
8402 #ifdef PRINT_VECTORS
8403  MivString(curr_weight, target_weight, next_weight);
8404 #endif
8405  if(Overflow_Error == TRUE)
8406  {
8407  PrintS("\n//**Mprwalk: OVERFLOW: The computed vector does not stay in cone, the result may be wrong.\n");
8408  delete next_weight;
8409  break;
8410  }
8411 
8412  if(test_w_in_ConeCC(G,target_weight) == 1 || MivComp(next_weight, ivNull) == 1)
8413  {
8414  delete next_weight;
8415  break;
8416  }
8417  //update tmp_weight and curr_weight
8418  for(i=nV-1; i>=0; i--)
8419  {
8420  (*tmp_weight)[i] = (*curr_weight)[i];
8421  (*curr_weight)[i] = (*next_weight)[i];
8422  }
8423  delete next_weight;
8424  } //end of while-loop
8425  Print("\n// Mprwalk took %d steps. Ring= %s;\n", nwalk, rString(currRing));
8426  idSkipZeroes(G);
8427  si_opt_1 = save1; //set original options, e. g. option(RedSB)
8428  baseRing = currRing;
8429  rChangeCurrRing(XXRing);
8430  ideal Res = idrMoveR(G,baseRing,currRing);
8431  delete tmp_weight;
8432  delete ivNull;
8433  delete exivlp;
8434 #ifndef BUCHBERGER_ALG
8435  delete last_omega;
8436 #endif
8437 #ifdef TIME_TEST
8438  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
8439 #endif
8440  return(Res);
8441 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
#define OPT_REDSB
Definition: options.h:71
unsigned si_opt_1
Definition: options.c:5
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
char * rString(ring r)
Definition: ring.cc:644
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
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:2221
static TreeM * G
Definition: janet.cc:38
#define BITSET
Definition: structs.h:17
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
#define Sy_bit(x)
Definition: options.h:30
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rChangeCurrRing(ring r)
Definition: polys.cc:14
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
clock_t xtlift
Definition: walk.cc:98
intvec * MivUnit(int nV)
Definition: walk.cc:1476
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
polyrec * poly
Definition: hilb.h:10
static void ivString(intvec *iv, const char *ch)
Definition: walk.cc:500
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
static ring VMrRefine(intvec *va, intvec *vb)
Definition: walk.cc:2505
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
intvec * Mivlp(int nR)
Definition: walk.cc:995
static intvec * MWalkRandomNextWeight(ideal G, intvec *curr_weight, intvec *target_weight, int weight_rad, int pert_deg)
Definition: walk.cc:4408
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
ideal Mpwalk ( ideal  Go,
int  op_deg,
int  tp_deg,
intvec curr_weight,
intvec target_weight,
int  nP 
)

Definition at line 5752 of file walk.cc.

5754 {
5755  Set_Error(FALSE );
5757  //Print("// pSetm_Error = (%d)", ErrorCheck());
5758 
5759  clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
5760  xtextra=0;
5761  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
5762  tinput = clock();
5763 
5764  clock_t tim;
5765 
5766  nstep = 0;
5767  int i, ntwC=1, ntestw=1, nV = currRing->N;
5768  int endwalks=0;
5769 
5770  ideal Gomega, M, F, G, Gomega1, Gomega2, M1,F1,Eresult,ssG;
5771  ring newRing, oldRing, TargetRing;
5772  intvec* iv_M_dp;
5773  intvec* iv_M_lp;
5774  intvec* exivlp = Mivlp(nV);
5775  intvec* orig_target = target_weight;
5776  intvec* pert_target_vector = target_weight;
5777  intvec* ivNull = new intvec(nV);
5778  intvec* iv_dp = MivUnit(nV);// define (1,1,...,1)
5779 #ifndef BUCHBERGER_ALG
5780  intvec* hilb_func;
5781 #endif
5782  intvec* next_weight;
5783 
5784  // to avoid (1,0,...,0) as the target vector
5785  intvec* last_omega = new intvec(nV);
5786  for(i=nV-1; i>0; i--)
5787  (*last_omega)[i] = 1;
5788  (*last_omega)[0] = 10000;
5789 
5790  ring XXRing = currRing;
5791 
5792 
5793  to = clock();
5794  /* perturbs the original vector */
5795  if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp"
5796  {
5797  G = MstdCC(Go);
5798  tostd = clock()-to;
5799  if(op_deg != 1){
5800  iv_M_dp = MivMatrixOrderdp(nV);
5801  //ivString(iv_M_dp, "iv_M_dp");
5802  curr_weight = MPertVectors(G, iv_M_dp, op_deg);
5803  }
5804  }
5805  else
5806  {
5807  //define ring order := (a(curr_weight),lp);
5808  if (rParameter(currRing) != NULL)
5809  DefRingPar(curr_weight);
5810  else
5811  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 1
5812 
5813  G = idrMoveR(Go, XXRing,currRing);
5814  G = MstdCC(G);
5815  tostd = clock()-to;
5816  if(op_deg != 1){
5817  iv_M_dp = MivMatrixOrder(curr_weight);
5818  curr_weight = MPertVectors(G, iv_M_dp, op_deg);
5819  }
5820  }
5821  delete iv_dp;
5822  if(op_deg != 1) delete iv_M_dp;
5823 
5824  ring HelpRing = currRing;
5825 
5826  /* perturbs the target weight vector */
5827  if(tp_deg > 1 && tp_deg <= nV)
5828  {
5829  if (rParameter(currRing) != NULL)
5830  DefRingPar(target_weight);
5831  else
5832  rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 2
5833 
5834  TargetRing = currRing;
5835  ssG = idrMoveR(G,HelpRing,currRing);
5836  if(MivSame(target_weight, exivlp) == 1)
5837  {
5838  iv_M_lp = MivMatrixOrderlp(nV);
5839  //ivString(iv_M_lp, "iv_M_lp");
5840  //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg);
5841  target_weight = MPertVectors(ssG, iv_M_lp, tp_deg);
5842  }
5843  else
5844  {
5845  iv_M_lp = MivMatrixOrder(target_weight);
5846  //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg);
5847  target_weight = MPertVectors(ssG, iv_M_lp, tp_deg);
5848  }
5849  delete iv_M_lp;
5850  pert_target_vector = target_weight;
5851  rChangeCurrRing(HelpRing);
5852  G = idrMoveR(ssG, TargetRing,currRing);
5853  }
5854  /*
5855  Print("\n// Perturbationwalkalg. vom Gradpaar (%d,%d):",op_deg,tp_deg);
5856  ivString(curr_weight, "new sigma");
5857  ivString(target_weight, "new tau");
5858  */
5859  while(1)
5860  {
5861  nstep ++;
5862  to = clock();
5863  /* compute an initial form ideal of <G> w.r.t. the weight vector
5864  "curr_weight" */
5865  Gomega = MwalkInitialForm(G, curr_weight);
5866 
5867 
5868 #ifdef ENDWALKS
5869  if(endwalks == 1){
5870  Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
5871  idElements(G, "G");
5872  // idElements(Gomega, "Gw");
5873  headidString(G, "G");
5874  //headidString(Gomega, "Gw");
5875  }
5876 #endif
5877 
5878  tif = tif + clock()-to;
5879 
5880 #ifndef BUCHBERGER_ALG
5881  if(isNolVector(curr_weight) == 0)
5882  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
5883  else
5884  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
5885 #endif // BUCHBERGER_ALG
5886 
5887  oldRing = currRing;
5888 
5889  // define a new ring with ordering "(a(curr_weight),lp)
5890  if (rParameter(currRing) != NULL)
5891  DefRingPar(curr_weight);
5892  else
5893  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 3
5894 
5895  newRing = currRing;
5896  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
5897 
5898 #ifdef ENDWALKS
5899  if(endwalks==1)
5900  {
5901  Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
5902  idElements(Gomega1, "Gw");
5903  headidString(Gomega1, "headGw");
5904  PrintS("\n// compute a rGB of Gw:\n");
5905 
5906 #ifndef BUCHBERGER_ALG
5907  ivString(hilb_func, "w");
5908 #endif
5909  }
5910 #endif
5911 
5912  tim = clock();
5913  to = clock();
5914  /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */
5915 #ifdef BUCHBERGER_ALG
5916  M = MstdhomCC(Gomega1);
5917 #else
5918  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
5919  delete hilb_func;
5920 #endif // BUCHBERGER_ALG
5921 
5922  if(endwalks == 1){
5923  xtstd = xtstd+clock()-to;
5924 #ifdef ENDWALKS
5925  Print("\n// time for the last std(Gw) = %.2f sec\n",
5926  ((double) clock())/1000000 -((double)tim) /1000000);
5927 #endif
5928  }
5929  else
5930  tstd=tstd+clock()-to;
5931 
5932  /* change the ring to oldRing */
5933  rChangeCurrRing(oldRing);
5934  M1 = idrMoveR(M, newRing,currRing);
5935  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
5936 
5937  //if(endwalks==1) PrintS("\n// Lifting is working:..");
5938 
5939  to=clock();
5940  /* compute a representation of the generators of submod (M)
5941  with respect to those of mod (Gomega).
5942  Gomega is a reduced Groebner basis w.r.t. the current ring */
5943  F = MLifttwoIdeal(Gomega2, M1, G);
5944  if(endwalks != 1)
5945  tlift = tlift+clock()-to;
5946  else
5947  xtlift=clock()-to;
5948 
5949  idDelete(&M1);
5950  idDelete(&Gomega2);
5951  idDelete(&G);
5952 
5953  /* change the ring to newRing */
5954  rChangeCurrRing(newRing);
5955  F1 = idrMoveR(F, oldRing,currRing);
5956 
5957  //if(endwalks==1)PrintS("\n// InterRed is working now:");
5958 
5959  to=clock();
5960  /* reduce the Groebner basis <G> w.r.t. new ring */
5961  G = kInterRedCC(F1, NULL);
5962  if(endwalks != 1)
5963  tred = tred+clock()-to;
5964  else
5965  xtred=clock()-to;
5966 
5967  idDelete(&F1);
5968 
5969  if(endwalks == 1)
5970  break;
5971 
5972  to=clock();
5973  /* compute a next weight vector */
5974  next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
5975  tnw=tnw+clock()-to;
5976 #ifdef PRINT_VECTORS
5977  MivString(curr_weight, target_weight, next_weight);
5978 #endif
5979 
5980  if(Overflow_Error == TRUE)
5981  {
5982  ntwC = 0;
5983  //ntestomega = 1;
5984  //Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
5985  //idElements(G, "G");
5986  delete next_weight;
5987  goto FINISH_160302;
5988  }
5989  if(MivComp(next_weight, ivNull) == 1){
5990  newRing = currRing;
5991  delete next_weight;
5992  //Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
5993  break;
5994  }
5995  if(MivComp(next_weight, target_weight) == 1)
5996  endwalks = 1;
5997 
5998  for(i=nV-1; i>=0; i--)
5999  (*curr_weight)[i] = (*next_weight)[i];
6000 
6001  delete next_weight;
6002  }//while
6003 
6004  if(tp_deg != 1)
6005  {
6006  FINISH_160302:
6007  if(MivSame(orig_target, exivlp) == 1)
6008  if (rParameter(currRing) != NULL)
6009  DefRingParlp();
6010  else
6011  VMrDefaultlp();
6012  else
6013  if (rParameter(currRing) != NULL)
6014  DefRingPar(orig_target);
6015  else
6016  rChangeCurrRing(VMrDefault(orig_target)); //Aenderung
6017 
6018  TargetRing=currRing;
6019  F1 = idrMoveR(G, newRing,currRing);
6020 #ifdef CHECK_IDEAL
6021  headidString(G, "G");
6022 #endif
6023 
6024 
6025  // check whether the pertubed target vector stays in the correct cone
6026  if(ntwC != 0){
6027  ntestw = test_w_in_ConeCC(F1, pert_target_vector);
6028  }
6029 
6030  if( ntestw != 1 || ntwC == 0)
6031  {
6032  /*
6033  if(ntestw != 1){
6034  ivString(pert_target_vector, "tau");
6035  PrintS("\n// ** perturbed target vector doesn't stay in cone!!");
6036  Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
6037  idElements(F1, "G");
6038  }
6039  */
6040  // LastGB is "better" than the kStd subroutine
6041  to=clock();
6042  ideal eF1;
6043  if(nP == 0 || tp_deg == 1 || MivSame(orig_target, exivlp) != 1){
6044  // PrintS("\n// ** calls \"std\" to compute a GB");
6045  eF1 = MstdCC(F1);
6046  idDelete(&F1);
6047  }
6048  else {
6049  // PrintS("\n// ** calls \"LastGB\" to compute a GB");
6050  rChangeCurrRing(newRing);
6051  ideal F2 = idrMoveR(F1, TargetRing,currRing);
6052  eF1 = LastGB(F2, curr_weight, tp_deg-1);
6053  F2=NULL;
6054  }
6055  xtextra=clock()-to;
6056  ring exTargetRing = currRing;
6057 
6058  rChangeCurrRing(XXRing);
6059  Eresult = idrMoveR(eF1, exTargetRing,currRing);
6060  }
6061  else{
6062  rChangeCurrRing(XXRing);
6063  Eresult = idrMoveR(F1, TargetRing,currRing);
6064  }
6065  }
6066  else {
6067  rChangeCurrRing(XXRing);
6068  Eresult = idrMoveR(G, newRing,currRing);
6069  }
6070  delete ivNull;
6071  if(tp_deg != 1)
6072  delete target_weight;
6073 
6074  if(op_deg != 1 )
6075  delete curr_weight;
6076 
6077  delete exivlp;
6078  delete last_omega;
6079 
6080 #ifdef TIME_TEST
6081  TimeStringFractal(tinput, tostd, tif+xtif, tstd+xtstd,0, tlift+xtlift, tred+xtred,
6082  tnw+xtnw);
6083 
6084  Print("\n// pSetm_Error = (%d)", ErrorCheck());
6085  Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep, Overflow_Error);
6086 #endif
6087  return(Eresult);
6088 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
BOOLEAN ErrorCheck()
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
char * rString(ring r)
Definition: ring.cc:644
static ideal LastGB(ideal G, intvec *curr_weight, int tp_deg)
Definition: walk.cc:2986
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
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:2221
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2748
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2881
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
clock_t xtlift
Definition: walk.cc:98
intvec * MivUnit(int nV)
Definition: walk.cc:1476
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
static void ivString(intvec *iv, const char *ch)
Definition: walk.cc:500
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
static ideal Mpwalk_MAltwalk1 ( ideal  Go,
intvec curr_weight,
int  tp_deg 
)
static

Definition at line 7990 of file walk.cc.

7991 {
7993  // BOOLEAN nOverflow_Error = FALSE;
7994  clock_t tproc=0;
7995  clock_t tinput=clock();
7996  int i, nV = currRing->N;
7997  int nwalk=0, endwalks=0, ntestwinC=1;
7998  int tp_deg_tmp = tp_deg;
7999  ideal Gomega, M, F, G, M1, F1, Gomega1, Gomega2, G1;
8000  ring newRing, oldRing, TargetRing;
8001  intvec* next_weight;
8002  intvec* ivNull = new intvec(nV);
8003 
8004  ring YXXRing = currRing;
8005 
8006  intvec* iv_M_dpp = MivMatrixOrderlp(nV);
8007  intvec* target_weight;// = Mivlp(nV);
8008  ideal ssG;
8009 
8010  // perturb the target vector
8011  while(1)
8012  {
8013  if(Overflow_Error == FALSE)
8014  {
8015  if (rParameter(currRing) != NULL)
8016  {
8017  DefRingParlp();
8018  }
8019  else
8020  {
8021  VMrDefaultlp();
8022  }
8023  TargetRing = currRing;
8024  ssG = idrMoveR(Go,YXXRing,currRing);
8025  }
8027  if(tp_deg != 1)
8028  {
8029  target_weight = MPertVectors(ssG, iv_M_dpp, tp_deg);
8030  }
8031  else
8032  {
8033  target_weight = Mivlp(nV);
8034  break;
8035  }
8036  if(Overflow_Error == FALSE)
8037  {
8038  break;
8039  }
8040  Overflow_Error = TRUE;
8041  tp_deg --;
8042  }
8043  if(tp_deg != tp_deg_tmp)
8044  {
8045  Overflow_Error = TRUE;
8046  //nOverflow_Error = TRUE;
8047  }
8048 
8049  // Print("\n// tp_deg = %d", tp_deg);
8050  // ivString(target_weight, "pert target");
8051 
8052  delete iv_M_dpp;
8053 #ifndef BUCHBERGER_ALG
8054  intvec* hilb_func;
8055 #endif
8056  // to avoid (1,0,...,0) as the target vector
8057  intvec* last_omega = new intvec(nV);
8058  for(i=nV-1; i>0; i--)
8059  {
8060  (*last_omega)[i] = 1;
8061  }
8062  (*last_omega)[0] = 10000;
8063 
8064  rChangeCurrRing(YXXRing);
8065  G = idrMoveR(ssG, TargetRing,currRing);
8066 
8067  while(1)
8068  {
8069  nwalk ++;
8070  nstep ++;
8071 
8072  if(nwalk==1)
8073  {
8074  goto FIRST_STEP;
8075  }
8076  to=clock();
8077  // compute an initial form ideal of <G> w.r.t. "curr_vector"
8078  Gomega = MwalkInitialForm(G, curr_weight);
8079  xtif=xtif+clock()-to;
8080 
8081 #ifndef BUCHBERGER_ALG
8082  if(isNolVector(curr_weight) == 0)
8083  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
8084  else
8085  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
8086 #endif
8087 
8088  oldRing = currRing;
8089 
8090  // define a new ring that its ordering is "(a(curr_weight),lp)
8091  if (rParameter(currRing) != NULL)
8092  {
8093  DefRingPar(curr_weight);
8094  }
8095  else
8096  {
8097  rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 15
8098  }
8099  newRing = currRing;
8100  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
8101 
8102 #ifdef ENDWALKS
8103  if(endwalks == 1)
8104  {
8105  Print("\n// it is %d-th step!!", nwalk);
8106  idElements(Gomega1, "Gw");
8107  PrintS("\n// compute a rGB of Gw:");
8108  }
8109 #endif
8110 
8111  to=clock();
8112  // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing"
8113 #ifdef BUCHBERGER_ALG
8114  M = MstdhomCC(Gomega1);
8115 #else
8116  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
8117  delete hilb_func;
8118 #endif // BUCHBERGER_ALG
8119  xtstd=xtstd+clock()-to;
8120 
8121  // change the ring to oldRing
8122  rChangeCurrRing(oldRing);
8123  M1 = idrMoveR(M, newRing,currRing);
8124  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
8125  to=clock();
8126 
8127  // if(endwalks == 1){PrintS("\n// Lifting is still working:");}
8128 
8129  // compute a reduced Groebner basis of <G> w.r.t. "newRing" by the lifting process
8130  F = MLifttwoIdeal(Gomega2, M1, G);
8131  xtlift=xtlift+clock()-to;
8132 
8133  idDelete(&M1);
8134  idDelete(&Gomega2);
8135  idDelete(&G);
8136 
8137  // change the ring to newRing
8138  rChangeCurrRing(newRing);
8139  F1 = idrMoveR(F, oldRing,currRing);
8140  to=clock();
8141  //if(endwalks == 1){ PrintS("\n// InterRed is still working:");}
8142  // reduce the Groebner basis <G> w.r.t. the new ring
8143  G = kInterRedCC(F1, NULL);
8144  xtred=xtred+clock()-to;
8145  idDelete(&F1);
8146 
8147  if(endwalks == 1)
8148  break;
8149 
8150  FIRST_STEP:
8152  to=clock();
8153  // compute a next weight vector
8154  next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
8155  xtnw=xtnw+clock()-to;
8156 #ifdef PRINT_VECTORS
8157  MivString(curr_weight, target_weight, next_weight);
8158 #endif
8159 
8160  if(Overflow_Error == TRUE)
8161  {
8162  delete next_weight;
8163  if(tp_deg > 1){
8164  //nOverflow_Error = Overflow_Error;
8165  tproc = tproc+clock()-tinput;
8166  //Print("\n// A subroutine takes %d steps and calls \"Mpwalk\" (1,%d):", nwalk, tp_deg-1);
8167  G1 = Mpwalk_MAltwalk1(G, curr_weight, tp_deg-1);
8168  goto MPW_Finish;
8169  }
8170  else {
8171  newRing = currRing;
8172  ntestwinC = 0;
8173  break;
8174  }
8175  }
8176 
8177  if(MivComp(next_weight, ivNull) == 1)
8178  {
8179  newRing = currRing;
8180  delete next_weight;
8181  break;
8182  }
8183  if(MivComp(next_weight, target_weight) == 1)
8184  {
8185  endwalks = 1;
8186  }
8187  for(i=nV-1; i>=0; i--)
8188  {
8189  //(*extra_curr_weight)[i] = (*curr_weight)[i];
8190  (*curr_weight)[i] = (*next_weight)[i];
8191  }
8192  delete next_weight;
8193  }//while
8194 
8195  // check whether the pertubed target vector is correct
8196 
8197  //define and execute ring with lex. order
8198  if (rParameter(currRing) != NULL)
8199  {
8200  DefRingParlp();
8201  }
8202  else
8203  {
8204  VMrDefaultlp();
8205  }
8206  G1 = idrMoveR(G, newRing,currRing);
8207 
8208  if( test_w_in_ConeCC(G1, target_weight) != 1 || ntestwinC == 0)
8209  {
8210  PrintS("\n// The perturbed target vector doesn't STAY in the correct cone!!");
8211  if(tp_deg == 1)
8212  {
8213  //Print("\n// subroutine takes %d steps and applys \"std\"", nwalk);
8214  to=clock();
8215  ideal G2 = MstdCC(G1);
8216  xtextra=xtextra+clock()-to;
8217  idDelete(&G1);
8218  G1 = G2;
8219  G2 = NULL;
8220  }
8221  else
8222  {
8223  //nOverflow_Error = Overflow_Error;
8224  tproc = tproc+clock()-tinput;
8225  // Print("\n// B subroutine takes %d steps and calls \"Mpwalk\" (1,%d) :", nwalk, tp_deg-1);
8226  G1 = Mpwalk_MAltwalk1(G1, curr_weight, tp_deg-1);
8227  }
8228  }
8229 
8230  MPW_Finish:
8231  newRing = currRing;
8232  rChangeCurrRing(YXXRing);
8233  ideal result = idrMoveR(G1, newRing,currRing);
8234 
8235  delete ivNull;
8236  delete target_weight;
8237 
8238  //Print("\n// \"Mpwalk\" (1,%d) took %d steps and %.2f sec. Overflow_Error (%d)", tp_deg, nwalk, ((double) clock()-tinput)/1000000, nOverflow_Error);
8239 
8240  return(result);
8241 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
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:2221
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
static TreeM * G
Definition: janet.cc:38
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2748
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
static ideal Mpwalk_MAltwalk1(ideal Go, intvec *curr_weight, int tp_deg)
Definition: walk.cc:7990
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2881
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
return result
Definition: facAbsBiFact.cc:76
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
ideal Mrwalk ( ideal  Go,
intvec orig_M,
intvec target_M,
int  weight_rad,
int  pert_deg,
ring  baseRing 
)

Definition at line 5341 of file walk.cc.

5342 {
5343  BITSET save1 = si_opt_1; // save current options
5344  //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
5345  //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
5346  //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
5347  Set_Error(FALSE);
5349 #ifdef TIME_TEST
5350  clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
5351  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
5352  tinput = clock();
5353  clock_t tim;
5354 #endif
5355  nstep=0;
5356  int i,nwalk,endwalks = 0;
5357  int nV = baseRing->N;
5358 
5359  ideal Gomega, M, F, Gomega1, Gomega2, M1; //, F1;
5360  ring newRing;
5361  ring XXRing = baseRing;
5362  intvec* ivNull = new intvec(nV);
5363  intvec* curr_weight = new intvec(nV);
5364  intvec* target_weight = new intvec(nV);
5365  intvec* exivlp = Mivlp(nV);
5366  intvec* tmp_weight = new intvec(nV);
5367  for(i=0; i<nV; i++)
5368  {
5369  (*tmp_weight)[i] = (*target_M)[i];
5370  }
5371  for(i=0; i<nV; i++)
5372  {
5373  (*curr_weight)[i] = (*orig_M)[i];
5374  (*target_weight)[i] = (*target_M)[i];
5375  }
5376 #ifndef BUCHBERGER_ALG
5377  intvec* hilb_func;
5378  // to avoid (1,0,...,0) as the target vector
5379  intvec* last_omega = new intvec(nV);
5380  for(i=nV-1; i>0; i--)
5381  {
5382  (*last_omega)[i] = 1;
5383  }
5384  (*last_omega)[0] = 10000;
5385 #endif
5387 #ifdef CHECK_IDEAL_MWALK
5388  idString(Go,"Go");
5389 #endif
5390 #ifdef TIME_TEST
5391  to = clock();
5392 #endif
5393  if(orig_M->length() == nV)
5394  {
5395  newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
5396  }
5397  else
5398  {
5399  newRing = VMatrDefault(orig_M);
5400  }
5401  rChangeCurrRing(newRing);
5402  ideal G = MstdCC(idrMoveR(Go,baseRing,currRing));
5403  baseRing = currRing;
5404 #ifdef TIME_TEST
5405  tostd = clock()-to;
5406 #endif
5407 
5408  nwalk = 0;
5409  while(1)
5410  {
5411  nwalk ++;
5412  nstep ++;
5413 #ifdef TIME_TEST
5414  to = clock();
5415 #endif
5416 #ifdef CHECK_IDEAL_MWALK
5417  idString(G,"G");
5418 #endif
5419  Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
5420 #ifdef TIME_TEST
5421  tif = tif + clock()-to; //time for computing initial form ideal
5422 #endif
5423 #ifdef CHECK_IDEAL_MWALK
5424  idString(Gomega,"Gomega");
5425 #endif
5426 #ifndef BUCHBERGER_ALG
5427  if(isNolVector(curr_weight) == 0)
5428  {
5429  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
5430  }
5431  else
5432  {
5433  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
5434  }
5435 #endif
5436  if(nwalk == 1)
5437  {
5438  if(orig_M->length() == nV)
5439  {
5440  newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
5441  }
5442  else
5443  {
5444  newRing = VMatrDefault(orig_M);
5445  }
5446  }
5447  else
5448  {
5449  if(target_M->length() == nV)
5450  {
5451  newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
5452  }
5453  else
5454  {
5455  newRing = VMatrRefine(target_M,curr_weight);
5456  }
5457  }
5458  rChangeCurrRing(newRing);
5459  Gomega1 = idrMoveR(Gomega, baseRing,currRing);
5460  idDelete(&Gomega);
5461  // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing"
5462 #ifdef TIME_TEST
5463  to = clock();
5464 #endif
5465 #ifndef BUCHBERGER_ALG
5466  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
5467  delete hilb_func;
5468 #else
5469  M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
5470 #endif
5471 #ifdef TIME_TEST
5472  tstd = tstd + clock() - to;
5473 #endif
5474  idSkipZeroes(M);
5475 #ifdef CHECK_IDEAL_MWALK
5476  PrintS("\n//** Mwalk: computed M.\n");
5477  idString(M, "M");
5478 #endif
5479  //change the ring to baseRing
5480  rChangeCurrRing(baseRing);
5481  M1 = idrMoveR(M, newRing,currRing);
5482  idDelete(&M);
5483  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
5484  idDelete(&Gomega1);
5485 #ifdef TIME_TEST
5486  to = clock();
5487 #endif
5488  // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring
5489  F = MLifttwoIdeal(Gomega2, M1, G);
5490 #ifdef TIME_TEST
5491  tlift = tlift + clock() - to;
5492 #endif
5493 #ifdef CHECK_IDEAL_MWALK
5494  idString(F, "F");
5495 #endif
5496  idDelete(&Gomega2);
5497  idDelete(&M1);
5498  rChangeCurrRing(newRing); // change the ring to newRing
5499  G = idrMoveR(F,baseRing,currRing);
5500  idDelete(&F);
5501  baseRing = currRing;
5502 #ifdef TIME_TEST
5503  to = clock();
5504 #endif
5505  //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);
5506 #ifdef TIME_TEST
5507  tstd = tstd + clock() - to;
5508 #endif
5509  idSkipZeroes(G);
5510 #ifdef CHECK_IDEAL_MWALK
5511  idString(G, "G");
5512 #endif
5513 #ifdef TIME_TEST
5514  to = clock();
5515 #endif
5516  intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg);//next_weight = MwalkNextWeightCC(curr_weight,target_weight,G);
5517 #ifdef TIME_TEST
5518  tnw = tnw + clock() - to;
5519 #endif
5520 #ifdef PRINT_VECTORS
5521  MivString(curr_weight, target_weight, next_weight);
5522 #endif
5523  if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1 || MivComp(next_weight,curr_weight) == 1)
5524  {
5525 #ifdef CHECK_IDEAL_MWALK
5526  PrintS("\n//** Mwalk: entering last cone.\n");
5527 #endif
5528  Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
5529  if(target_M->length() == nV)
5530  {
5531  newRing = VMrDefault(target_weight); // define a new ring with ordering "(a(curr_weight),lp)
5532  }
5533  else
5534  {
5535  newRing = VMatrDefault(target_M);
5536  }
5537  rChangeCurrRing(newRing);
5538  Gomega1 = idrMoveR(Gomega, baseRing,currRing);
5539  idDelete(&Gomega);
5540 #ifdef CHECK_IDEAL_MWALK
5541  idString(Gomega1, "Gomega");
5542 #endif
5543  M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
5544 #ifdef CHECK_IDEAL_MWALK
5545  idString(M,"M");
5546 #endif
5547  rChangeCurrRing(baseRing);
5548  M1 = idrMoveR(M, newRing,currRing);
5549  idDelete(&M);
5550  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
5551  idDelete(&Gomega1);
5552  F = MLifttwoIdeal(Gomega2, M1, G);
5553 #ifdef CHECK_IDEAL_MWALK
5554  idString(F,"F");
5555 #endif
5556  idDelete(&Gomega2);
5557  idDelete(&M1);
5558  rChangeCurrRing(newRing); // change the ring to newRing
5559  G = idrMoveR(F,baseRing,currRing);
5560  idDelete(&F);
5561  baseRing = currRing;
5562  si_opt_1 = save1; //set original options, e. g. option(RedSB)
5563  idSkipZeroes(G);
5564 #ifdef TIME_TEST
5565  to = clock();
5566 #endif
5567  // if(si_opt_1 == (Sy_bit(OPT_REDSB)))
5568  // {
5569  //G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set
5570  // }
5571 #ifdef TIME_TEST
5572  tred = tred + clock() - to;
5573 #endif
5574  idSkipZeroes(G);
5575  delete next_weight;
5576  break;
5577 #ifdef CHECK_IDEAL_MWALK
5578  PrintS("\n//** Mwalk: last cone.\n");
5579 #endif
5580  }
5581 #ifdef CHECK_IDEAL_MWALK
5582  PrintS("\n//** Mwalk: update weight vectors.\n");
5583 #endif
5584  for(i=nV-1; i>=0; i--)
5585  {
5586  (*tmp_weight)[i] = (*curr_weight)[i];
5587  (*curr_weight)[i] = (*next_weight)[i];
5588  }
5589  delete next_weight;
5590  }
5591  rChangeCurrRing(XXRing);
5592  ideal result = idrMoveR(G,baseRing,currRing);
5593  idDelete(&G);
5594 /*#ifdef CHECK_IDEAL_MWALK
5595  pDelete(&p);
5596 #endif*/
5597  delete tmp_weight;
5598  delete ivNull;
5599  delete exivlp;
5600 #ifndef BUCHBERGER_ALG
5601  delete last_omega;
5602 #endif
5603 #ifdef TIME_TEST
5604  Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);
5605  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
5606  Print("\n//** Mwalk: Ergebnis.\n");
5607  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
5608  //Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
5609 #endif
5610  return(result);
5611 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
unsigned si_opt_1
Definition: options.c:5
#define Print
Definition: emacs.cc:83
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
static ring VMatrDefault(intvec *va)
Definition: walk.cc:2588
clock_t xtred
Definition: walk.cc:98
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:2221
int length() const
Definition: intvec.h:86
static ring VMatrRefine(intvec *va, intvec *vb)
Definition: walk.cc:2666
static TreeM * G
Definition: janet.cc:38
#define BITSET
Definition: structs.h:17
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
static ring VMrRefine(intvec *va, intvec *vb)
Definition: walk.cc:2505
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
intvec * Mivlp(int nR)
Definition: walk.cc:995
static intvec * MWalkRandomNextWeight(ideal G, intvec *curr_weight, intvec *target_weight, int weight_rad, int pert_deg)
Definition: walk.cc:4408
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
static ideal MstdCC ( ideal  G)
static

Definition at line 907 of file walk.cc.

908 {
909  BITSET save1,save2;
910  SI_SAVE_OPT(save1,save2);
912  ideal G1 = kStd(G, NULL, testHomog, NULL);
913  SI_RESTORE_OPT(save1,save2);
914 
915  idSkipZeroes(G1);
916  return G1;
917 }
#define OPT_REDSB
Definition: options.h:71
unsigned si_opt_1
Definition: options.c:5
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:2221
static TreeM * G
Definition: janet.cc:38
#define BITSET
Definition: structs.h:17
#define Sy_bit(x)
Definition: options.h:30
#define SI_RESTORE_OPT(A, B)
Definition: options.h:22
#define OPT_REDTAIL
Definition: options.h:86
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define NULL
Definition: omList.c:10
#define SI_SAVE_OPT(A, B)
Definition: options.h:19
static ideal MstdhomCC ( ideal  G)
static

Definition at line 922 of file walk.cc.

923 {
924  BITSET save1,save2;
925  SI_SAVE_OPT(save1,save2);
927  ideal G1 = kStd(G, NULL, isHomog, NULL);
928  SI_RESTORE_OPT(save1,save2);
929 
930  idSkipZeroes(G1);
931  return G1;
932 }
#define OPT_REDSB
Definition: options.h:71
unsigned si_opt_1
Definition: options.c:5
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:2221
static TreeM * G
Definition: janet.cc:38
#define BITSET
Definition: structs.h:17
#define Sy_bit(x)
Definition: options.h:30
#define SI_RESTORE_OPT(A, B)
Definition: options.h:22
#define OPT_REDTAIL
Definition: options.h:86
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define NULL
Definition: omList.c:10
#define SI_SAVE_OPT(A, B)
Definition: options.h:19
ideal Mwalk ( ideal  Go,
intvec orig_M,
intvec target_M,
ring  baseRing 
)

Definition at line 5067 of file walk.cc.

5068 {
5069  BITSET save1 = si_opt_1; // save current options
5070  //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
5071  //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
5072  //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
5073  Set_Error(FALSE);
5075 #ifdef TIME_TEST
5076  clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
5077  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
5078  tinput = clock();
5079  clock_t tim;
5080 #endif
5081  nstep=0;
5082  int i,nwalk,endwalks = 0;
5083  int nV = baseRing->N;
5084 
5085  ideal Gomega, M, F, Gomega1, Gomega2, M1; //, F1;
5086  ring newRing;
5087  ring XXRing = baseRing;
5088  intvec* ivNull = new intvec(nV);
5089  intvec* curr_weight = new intvec(nV);
5090  intvec* target_weight = new intvec(nV);
5091  intvec* exivlp = Mivlp(nV);
5092  intvec* tmp_weight = new intvec(nV);
5093  for(i=0; i<nV; i++)
5094  {
5095  (*tmp_weight)[i] = (*target_M)[i];
5096  }
5097  for(i=0; i<nV; i++)
5098  {
5099  (*curr_weight)[i] = (*orig_M)[i];
5100  (*target_weight)[i] = (*target_M)[i];
5101  }
5102 #ifndef BUCHBERGER_ALG
5103  intvec* hilb_func;
5104  // to avoid (1,0,...,0) as the target vector
5105  intvec* last_omega = new intvec(nV);
5106  for(i=nV-1; i>0; i--)
5107  {
5108  (*last_omega)[i] = 1;
5109  }
5110  (*last_omega)[0] = 10000;
5111 #endif
5113 #ifdef CHECK_IDEAL_MWALK
5114  idString(Go,"Go");
5115 #endif
5116 #ifdef TIME_TEST
5117  to = clock();
5118 #endif
5119  if(orig_M->length() == nV)
5120  {
5121  newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
5122  }
5123  else
5124  {
5125  newRing = VMatrDefault(orig_M);
5126  }
5127  rChangeCurrRing(newRing);
5128  ideal G = MstdCC(idrMoveR(Go,baseRing,currRing));
5129  baseRing = currRing;
5130 #ifdef TIME_TEST
5131  tostd = clock()-to;
5132 #endif
5133 
5134  nwalk = 0;
5135  while(1)
5136  {
5137  nwalk ++;
5138  nstep ++;
5139 #ifdef TIME_TEST
5140  to = clock();
5141 #endif
5142 #ifdef CHECK_IDEAL_MWALK
5143  idString(G,"G");
5144 #endif
5145  Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
5146 #ifdef TIME_TEST
5147  tif = tif + clock()-to; //time for computing initial form ideal
5148 #endif
5149 #ifdef CHECK_IDEAL_MWALK
5150  idString(Gomega,"Gomega");
5151 #endif
5152 #ifndef BUCHBERGER_ALG
5153  if(isNolVector(curr_weight) == 0)
5154  {
5155  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
5156  }
5157  else
5158  {
5159  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
5160  }
5161 #endif
5162  if(nwalk == 1)
5163  {
5164  if(orig_M->length() == nV)
5165  {
5166  newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
5167  }
5168  else
5169  {
5170  newRing = VMatrDefault(orig_M);
5171  }
5172  }
5173  else
5174  {
5175  if(target_M->length() == nV)
5176  {
5177  newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
5178  }
5179  else
5180  {
5181  newRing = VMatrRefine(target_M,curr_weight);
5182  }
5183  }
5184  rChangeCurrRing(newRing);
5185  Gomega1 = idrMoveR(Gomega, baseRing,currRing);
5186  idDelete(&Gomega);
5187  // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing"
5188 #ifdef TIME_TEST
5189  to = clock();
5190 #endif
5191 #ifndef BUCHBERGER_ALG
5192  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
5193  delete hilb_func;
5194 #else
5195  M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
5196 #endif
5197 #ifdef TIME_TEST
5198  tstd = tstd + clock() - to;
5199 #endif
5200  idSkipZeroes(M);
5201 #ifdef CHECK_IDEAL_MWALK
5202  PrintS("\n//** Mwalk: computed M.\n");
5203  idString(M, "M");
5204 #endif
5205  //change the ring to baseRing
5206  rChangeCurrRing(baseRing);
5207  M1 = idrMoveR(M, newRing,currRing);
5208  idDelete(&M);
5209  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
5210  idDelete(&Gomega1);
5211 #ifdef TIME_TEST
5212  to = clock();
5213 #endif
5214  // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring
5215  F = MLifttwoIdeal(Gomega2, M1, G);
5216 #ifdef TIME_TEST
5217  tlift = tlift + clock() - to;
5218 #endif
5219 #ifdef CHECK_IDEAL_MWALK
5220  idString(F, "F");
5221 #endif
5222  idDelete(&Gomega2);
5223  idDelete(&M1);
5224  rChangeCurrRing(newRing); // change the ring to newRing
5225  G = idrMoveR(F,baseRing,currRing);
5226  idDelete(&F);
5227  baseRing = currRing;
5228 #ifdef TIME_TEST
5229  to = clock();
5230 #endif
5231  //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);
5232 #ifdef TIME_TEST
5233  tstd = tstd + clock() - to;
5234 #endif
5235  idSkipZeroes(G);
5236 #ifdef CHECK_IDEAL_MWALK
5237  idString(G, "G");
5238 #endif
5239 #ifdef TIME_TEST
5240  to = clock();
5241 #endif
5242  intvec* next_weight = MwalkNextWeightCC(curr_weight,target_weight,G);
5243 #ifdef TIME_TEST
5244  tnw = tnw + clock() - to;
5245 #endif
5246 #ifdef PRINT_VECTORS
5247  MivString(curr_weight, target_weight, next_weight);
5248 #endif
5249  if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1 || MivComp(next_weight,curr_weight) == 1)
5250  {
5251 #ifdef CHECK_IDEAL_MWALK
5252  PrintS("\n//** Mwalk: entering last cone.\n");
5253 #endif
5254  Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
5255  if(target_M->length() == nV)
5256  {
5257  newRing = VMrDefault(target_weight); // define a new ring with ordering "(a(curr_weight),lp)
5258  }
5259  else
5260  {
5261  newRing = VMatrDefault(target_M);
5262  }
5263  rChangeCurrRing(newRing);
5264  Gomega1 = idrMoveR(Gomega, baseRing,currRing);
5265  idDelete(&Gomega);
5266 #ifdef CHECK_IDEAL_MWALK
5267  idString(Gomega1, "Gomega");
5268 #endif
5269  M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
5270 #ifdef CHECK_IDEAL_MWALK
5271  idString(M,"M");
5272 #endif
5273  rChangeCurrRing(baseRing);
5274  M1 = idrMoveR(M, newRing,currRing);
5275  idDelete(&M);
5276  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
5277  idDelete(&Gomega1);
5278  F = MLifttwoIdeal(Gomega2, M1, G);
5279 #ifdef CHECK_IDEAL_MWALK
5280  idString(F,"F");
5281 #endif
5282  idDelete(&Gomega2);
5283  idDelete(&M1);
5284  rChangeCurrRing(newRing); // change the ring to newRing
5285  G = idrMoveR(F,baseRing,currRing);
5286  idDelete(&F);
5287  baseRing = currRing;
5288  si_opt_1 = save1; //set original options, e. g. option(RedSB)
5289  idSkipZeroes(G);
5290 #ifdef TIME_TEST
5291  to = clock();
5292 #endif
5293  // if(si_opt_1 == (Sy_bit(OPT_REDSB)))
5294  // {
5295  G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set
5296  // }
5297 #ifdef TIME_TEST
5298  tred = tred + clock() - to;
5299 #endif
5300  idSkipZeroes(G);
5301  delete next_weight;
5302  break;
5303 #ifdef CHECK_IDEAL_MWALK
5304  PrintS("\n//** Mwalk: last cone.\n");
5305 #endif
5306  }
5307 #ifdef CHECK_IDEAL_MWALK
5308  PrintS("\n//** Mwalk: update weight vectors.\n");
5309 #endif
5310  for(i=nV-1; i>=0; i--)
5311  {
5312  (*tmp_weight)[i] = (*curr_weight)[i];
5313  (*curr_weight)[i] = (*next_weight)[i];
5314  }
5315  delete next_weight;
5316  }
5317  rChangeCurrRing(XXRing);
5318  ideal result = idrMoveR(G,baseRing,currRing);
5319  idDelete(&G);
5320 /*#ifdef CHECK_IDEAL_MWALK
5321  pDelete(&p);
5322 #endif*/
5323  delete tmp_weight;
5324  delete ivNull;
5325  delete exivlp;
5326 #ifndef BUCHBERGER_ALG
5327  delete last_omega;
5328 #endif
5329 #ifdef TIME_TEST
5330  Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);
5331  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
5332  Print("\n//** Mwalk: Ergebnis.\n");
5333  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
5334  //Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
5335 #endif
5336  return(result);
5337 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
unsigned si_opt_1
Definition: options.c:5
#define Print
Definition: emacs.cc:83
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
static ring VMatrDefault(intvec *va)
Definition: walk.cc:2588
clock_t xtred
Definition: walk.cc:98
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:2221
int length() const
Definition: intvec.h:86
static ring VMatrRefine(intvec *va, intvec *vb)
Definition: walk.cc:2666
static TreeM * G
Definition: janet.cc:38
#define BITSET
Definition: structs.h:17
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
static intvec * MwalkNextWeightCC(intvec *curr_weight, intvec *target_weight, ideal G)
Definition: walk.cc:1865
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
static ring VMrRefine(intvec *va, intvec *vb)
Definition: walk.cc:2505
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
ideal MwalkAlt ( ideal  Go,
intvec curr_weight,
intvec target_weight 
)

Definition at line 4825 of file walk.cc.

4826 {
4827  Set_Error(FALSE);
4829  //Print("// pSetm_Error = (%d)", ErrorCheck());
4830 
4831  clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
4832  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
4833  tinput = clock();
4834  clock_t tim;
4835  nstep=0;
4836  int i;
4837  int nV = currRing->N;
4838  int nwalk=0;
4839  int endwalks=0;
4840 
4841  ideal Gomega, M, F, Gomega1, Gomega2, M1, F1, G;
4842  //ideal G1;
4843  //ring endRing;
4844  ring newRing, oldRing;
4845  intvec* ivNull = new intvec(nV);
4846  intvec* exivlp = Mivlp(nV);
4847 #ifndef BUCHBERGER_ALG
4848  intvec* hilb_func;
4849 #endif
4850  intvec* tmp_weight = new intvec(nV);
4851  for(i=nV-1; i>=0; i--)
4852  (*tmp_weight)[i] = (*curr_weight)[i];
4853 
4854  // to avoid (1,0,...,0) as the target vector
4855  intvec* last_omega = new intvec(nV);
4856  for(i=nV-1; i>0; i--)
4857  (*last_omega)[i] = 1;
4858  (*last_omega)[0] = 10000;
4859 
4860  ring XXRing = currRing;
4861 
4862  to = clock();
4863  // the monomial ordering of this current ring would be "dp"
4864  G = MstdCC(Go);
4865  tostd = clock()-to;
4866 
4867  if(currRing->order[0] == ringorder_a)
4868  goto NEXT_VECTOR;
4869 
4870  while(1)
4871  {
4872  nwalk ++;
4873  nstep ++;
4874  to = clock();
4875  // compute an initial form ideal of <G> w.r.t. "curr_vector"
4876  Gomega = MwalkInitialForm(G, curr_weight);
4877  tif = tif + clock()-to;
4878  oldRing = currRing;
4879 
4880  if(endwalks == 1)
4881  {
4882  /* compute a reduced Groebner basis of Gomega w.r.t. >>_cw by
4883  the recursive changed perturbation walk alg. */
4884  tim = clock();
4885  /*
4886  Print("\n// **** Gr�bnerwalk took %d steps and ", nwalk);
4887  PrintS("\n// **** call the rec. Pert. Walk to compute a red GB of:");
4888  idElements(Gomega, "G_omega");
4889  */
4890 
4891  if(MivSame(exivlp, target_weight)==1)
4892  M = REC_GB_Mwalk(idCopy(Gomega), tmp_weight, curr_weight, 2,1);
4893  else
4894  goto NORMAL_GW;
4895  /*
4896  Print("\n// time for the last std(Gw) = %.2f sec",
4897  ((double) (clock()-tim)/1000000));
4898  PrintS("\n// ***************************************************\n");
4899  */
4900 #ifdef CHECK_IDEAL_MWALK
4901  idElements(Gomega, "G_omega");
4902  headidString(Gomega, "Gw");
4903  idElements(M, "M");
4904  //headidString(M, "M");
4905 #endif
4906  to = clock();
4907  F = MLifttwoIdeal(Gomega, M, G);
4908  xtlift = xtlift + clock() - to;
4909 
4910  idDelete(&Gomega);
4911  idDelete(&M);
4912  idDelete(&G);
4913 
4914  oldRing = currRing;
4915 
4916  /* create a new ring newRing */
4917  if (rParameter(currRing) != NULL)
4918  {
4919  DefRingPar(curr_weight);
4920  }
4921  else
4922  {
4923  rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
4924  }
4925  newRing = currRing;
4926  F1 = idrMoveR(F, oldRing,currRing);
4927  }
4928  else
4929  {
4930  NORMAL_GW:
4931 #ifndef BUCHBERGER_ALG
4932  if(isNolVector(curr_weight) == 0)
4933  {
4934  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
4935  }
4936  else
4937  {
4938  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
4939  }
4940 #endif // BUCHBERGER_ALG
4941 
4942  // define a new ring that its ordering is "(a(curr_weight),lp)
4943  if (rParameter(currRing) != NULL)
4944  {
4945  DefRingPar(curr_weight);
4946  }
4947  else
4948  {
4949  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung
4950  }
4951  newRing = currRing;
4952  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
4953 
4954  to = clock();
4955  // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing"
4956 #ifdef BUCHBERGER_ALG
4957  M = MstdhomCC(Gomega1);
4958 #else
4959  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
4960  delete hilb_func;
4961 #endif // BUCHBERGER_ALG
4962  tstd = tstd + clock() - to;
4963 
4964  // change the ring to oldRing
4965  rChangeCurrRing(oldRing);
4966  M1 = idrMoveR(M, newRing,currRing);
4967  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
4968 
4969  to = clock();
4970  // compute a representation of the generators of submod (M) with respect to those of mod (Gomega). Gomega is a reduced Groebner basis w.r.t. the current ring.
4971  F = MLifttwoIdeal(Gomega2, M1, G);
4972  tlift = tlift + clock() - to;
4973 
4974  idDelete(&M1);
4975  idDelete(&Gomega2);
4976  idDelete(&G);
4977 
4978  // change the ring to newRing
4979  rChangeCurrRing(newRing);
4980  F1 = idrMoveR(F, oldRing,currRing);
4981  }
4982 
4983  to = clock();
4984  // reduce the Groebner basis <G> w.r.t. new ring
4985  G = kInterRedCC(F1, NULL);
4986  if(endwalks != 1)
4987  {
4988  tred = tred + clock() - to;
4989  }
4990  else
4991  {
4992  xtred = xtred + clock() - to;
4993  }
4994  idDelete(&F1);
4995  if(endwalks == 1)
4996  {
4997  break;
4998  }
4999  NEXT_VECTOR:
5000  to = clock();
5001  // compute a next weight vector
5002  intvec* next_weight = MkInterRedNextWeight(curr_weight,target_weight,G);
5003  tnw = tnw + clock() - to;
5004 #ifdef PRINT_VECTORS
5005  MivString(curr_weight, target_weight, next_weight);
5006 #endif
5007 
5008  //if(test_w_in_ConeCC(G, next_weight) != 1)
5009  if(Overflow_Error == TRUE)
5010  {
5011  newRing = currRing;
5012  PrintS("\n// ** The computed vector does NOT stay in Cone!!\n");
5013 
5014  if (rParameter(currRing) != NULL)
5015  {
5016  DefRingPar(target_weight);
5017  }
5018  else
5019  {
5020  rChangeCurrRing(VMrDefault(target_weight)); // Aenderung
5021  }
5022  F1 = idrMoveR(G, newRing,currRing);
5023  G = MstdCC(F1);
5024  idDelete(&F1);
5025 
5026  newRing = currRing;
5027  break;
5028  }
5029 
5030  if(MivComp(next_weight, ivNull) == 1)
5031  {
5032  newRing = currRing;
5033  delete next_weight;
5034  break;
5035  }
5036  if(MivComp(next_weight, target_weight) == 1)
5037  {
5038  endwalks = 1;
5039  }
5040  for(i=nV-1; i>=0; i--)
5041  {
5042  (*tmp_weight)[i] = (*curr_weight)[i];
5043  (*curr_weight)[i] = (*next_weight)[i];
5044  }
5045  delete next_weight;
5046  }
5047  rChangeCurrRing(XXRing);
5048  G = idrMoveR(G, newRing,currRing);
5049 
5050  delete tmp_weight;
5051  delete ivNull;
5052  delete exivlp;
5053 
5054 #ifdef TIME_TEST
5055  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
5056 
5057  Print("\n// pSetm_Error = (%d)", ErrorCheck());
5058  Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
5059 #endif
5060  return(G);
5061 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
BOOLEAN ErrorCheck()
#define Print
Definition: emacs.cc:83
static ideal REC_GB_Mwalk(ideal G, intvec *curr_weight, intvec *orig_target_weight, int tp_deg, int npwinc)
Definition: walk.cc:4541
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
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:2221
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
ideal idCopy(ideal A)
Definition: ideals.h:76
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
ideal MwalkInitialForm ( ideal  G,
intvec ivw 
)

Definition at line 736 of file walk.cc.

737 {
738  BOOLEAN nError = Overflow_Error;
740 
741  int i, nG = IDELEMS(G);
742  ideal Gomega = idInit(nG, 1);
743 
744  for(i=nG-1; i>=0; i--)
745  {
746  Gomega->m[i] = MpolyInitialForm(G->m[i], ivw);
747  }
748  if(Overflow_Error == FALSE)
749  {
750  Overflow_Error = nError;
751  }
752  return Gomega;
753 }
#define FALSE
Definition: auxiliary.h:140
static poly MpolyInitialForm(poly g, intvec *curr_weight)
Definition: walk.cc:699
static TreeM * G
Definition: janet.cc:38
BOOLEAN Overflow_Error
Definition: walk.cc:96
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
int BOOLEAN
Definition: auxiliary.h:131
static intvec* MwalkNextWeightCC ( intvec curr_weight,
intvec target_weight,
ideal  G 
)
static

Definition at line 1865 of file walk.cc.

1867 {
1868  BOOLEAN nError = Overflow_Error;
1870 
1871  assume(currRing != NULL && curr_weight != NULL &&
1872  target_weight != NULL && G != NULL);
1873 
1874  int nRing = currRing->N;
1875  int checkRed, j, kkk, nG = IDELEMS(G);
1876  intvec* ivtemp;
1877 
1878  mpz_t t_zaehler, t_nenner;
1879  mpz_init(t_zaehler);
1880  mpz_init(t_nenner);
1881 
1882  mpz_t s_zaehler, s_nenner, temp, MwWd;
1883  mpz_init(s_zaehler);
1884  mpz_init(s_nenner);
1885  mpz_init(temp);
1886  mpz_init(MwWd);
1887 
1888  mpz_t sing_int;
1889  mpz_init(sing_int);
1890  mpz_set_si(sing_int, 2147483647);
1891 
1892  mpz_t sing_int_half;
1893  mpz_init(sing_int_half);
1894  mpz_set_si(sing_int_half, 3*(1073741824/2));
1895 
1896  mpz_t deg_w0_p1, deg_d0_p1;
1897  mpz_init(deg_w0_p1);
1898  mpz_init(deg_d0_p1);
1899 
1900  mpz_t sztn, sntz;
1901  mpz_init(sztn);
1902  mpz_init(sntz);
1903 
1904  mpz_t t_null;
1905  mpz_init(t_null);
1906 
1907  mpz_t ggt;
1908  mpz_init(ggt);
1909 
1910  mpz_t dcw;
1911  mpz_init(dcw);
1912 
1913  //int tn0, tn1, tz1, ncmp, gcd_tmp, ntmp;
1914  int gcd_tmp;
1915  intvec* diff_weight = MivSub(target_weight, curr_weight);
1916 
1917  intvec* diff_weight1 = MivSub(target_weight, curr_weight);
1918  poly g;
1919  //poly g, gw;
1920  for (j=0; j<nG; j++)
1921  {
1922  g = G->m[j];
1923  if (g != NULL)
1924  {
1925  ivtemp = MExpPol(g);
1926  mpz_set_si(deg_w0_p1, MivDotProduct(ivtemp, curr_weight));
1927  mpz_set_si(deg_d0_p1, MivDotProduct(ivtemp, diff_weight));
1928  delete ivtemp;
1929 
1930  pIter(g);
1931  while (g != NULL)
1932  {
1933  ivtemp = MExpPol(g);
1934  mpz_set_si(MwWd, MivDotProduct(ivtemp, curr_weight));
1935  mpz_sub(s_zaehler, deg_w0_p1, MwWd);
1936 
1937  if(mpz_cmp(s_zaehler, t_null) != 0)
1938  {
1939  mpz_set_si(MwWd, MivDotProduct(ivtemp, diff_weight));
1940  mpz_sub(s_nenner, MwWd, deg_d0_p1);
1941 
1942  // check for 0 < s <= 1
1943  if( (mpz_cmp(s_zaehler,t_null) > 0 &&
1944  mpz_cmp(s_nenner, s_zaehler)>=0) ||
1945  (mpz_cmp(s_zaehler, t_null) < 0 &&
1946  mpz_cmp(s_nenner, s_zaehler)<=0))
1947  {
1948  // make both positive
1949  if (mpz_cmp(s_zaehler, t_null) < 0)
1950  {
1951  mpz_neg(s_zaehler, s_zaehler);
1952  mpz_neg(s_nenner, s_nenner);
1953  }
1954 
1955  //compute a simple fraction of s
1956  cancel(s_zaehler, s_nenner);
1957 
1958  if(mpz_cmp(t_nenner, t_null) != 0)
1959  {
1960  mpz_mul(sztn, s_zaehler, t_nenner);
1961  mpz_mul(sntz, s_nenner, t_zaehler);
1962 
1963  if(mpz_cmp(sztn,sntz) < 0)
1964  {
1965  mpz_add(t_nenner, t_null, s_nenner);
1966  mpz_add(t_zaehler,t_null, s_zaehler);
1967  }
1968  }
1969  else
1970  {
1971  mpz_add(t_nenner, t_null, s_nenner);
1972  mpz_add(t_zaehler,t_null, s_zaehler);
1973  }
1974  }
1975  }
1976  pIter(g);
1977  delete ivtemp;
1978  }
1979  }
1980  }
1981 //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t));
1982  mpz_t *vec=(mpz_t*)omAlloc(nRing*sizeof(mpz_t));
1983 
1984 
1985  // there is no 0<t<1 and define the next weight vector that is equal to the current weight vector
1986  if(mpz_cmp(t_nenner, t_null) == 0)
1987  {
1988  #ifndef SING_NDEBUG
1989  Print("\n//MwalkNextWeightCC: t_nenner ist Null!");
1990  #endif
1991  delete diff_weight;
1992  diff_weight = ivCopy(curr_weight);//take memory
1993  goto FINISH;
1994  }
1995 
1996  // define the target vector as the next weight vector, if t = 1
1997  if(mpz_cmp_si(t_nenner, 1)==0 && mpz_cmp_si(t_zaehler,1)==0)
1998  {
1999  delete diff_weight;
2000  diff_weight = ivCopy(target_weight); //this takes memory
2001  goto FINISH;
2002  }
2003 
2004  checkRed = 0;
2005 
2006  SIMPLIFY_GCD:
2007 
2008  // simplify the vectors curr_weight and diff_weight (C-int)
2009  gcd_tmp = (*curr_weight)[0];
2010 
2011  for (j=1; j<nRing; j++)
2012  {
2013  gcd_tmp = gcd(gcd_tmp, (*curr_weight)[j]);
2014  if(gcd_tmp == 1)
2015  {
2016  break;
2017  }
2018  }
2019  if(gcd_tmp != 1)
2020  {
2021  for (j=0; j<nRing; j++)
2022  {
2023  gcd_tmp = gcd(gcd_tmp, (*diff_weight)[j]);
2024  if(gcd_tmp == 1)
2025  {
2026  break;
2027  }
2028  }
2029  }
2030  if(gcd_tmp != 1)
2031  {
2032  for (j=0; j<nRing; j++)
2033  {
2034  (*curr_weight)[j] = (*curr_weight)[j]/gcd_tmp;
2035  (*diff_weight)[j] = (*diff_weight)[j]/gcd_tmp;
2036  }
2037  }
2038  if(checkRed > 0)
2039  {
2040  for (j=0; j<nRing; j++)
2041  {
2042  mpz_set_si(vec[j], (*diff_weight)[j]);
2043  }
2044  goto TEST_OVERFLOW;
2045  }
2046 
2047 #ifdef NEXT_VECTORS_CC
2048  Print("\n// gcd of the weight vectors (current and target) = %d", gcd_tmp);
2049  ivString(curr_weight, "new cw");
2050  ivString(diff_weight, "new dw");
2051 
2052  PrintS("\n// t_zaehler: "); mpz_out_str( stdout, 10, t_zaehler);
2053  PrintS(", t_nenner: "); mpz_out_str( stdout, 10, t_nenner);
2054 #endif
2055 
2056  // BOOLEAN isdwpos;
2057 
2058  // construct a new weight vector
2059  for (j=0; j<nRing; j++)
2060  {
2061  mpz_set_si(dcw, (*curr_weight)[j]);
2062  mpz_mul(s_nenner, t_nenner, dcw);
2063 
2064  if( (*diff_weight)[j]>0)
2065  {
2066  mpz_mul_ui(s_zaehler, t_zaehler, (*diff_weight)[j]);
2067  }
2068  else
2069  {
2070  mpz_mul_ui(s_zaehler, t_zaehler, -(*diff_weight)[j]);
2071  mpz_neg(s_zaehler, s_zaehler);
2072  }
2073  mpz_add(sntz, s_nenner, s_zaehler);
2074  mpz_init_set(vec[j], sntz);
2075 
2076 #ifdef NEXT_VECTORS_CC
2077  Print("\n// j = %d ==> ", j);
2078  PrintS("(");
2079  mpz_out_str( stdout, 10, t_nenner);
2080  Print(" * %d)", (*curr_weight)[j]);
2081  Print(" + ("); mpz_out_str( stdout, 10, t_zaehler);
2082  Print(" * %d) = ", (*diff_weight)[j]);
2083  mpz_out_str( stdout, 10, s_nenner);
2084  PrintS(" + ");
2085  mpz_out_str( stdout, 10, s_zaehler);
2086  PrintS(" = "); mpz_out_str( stdout, 10, sntz);
2087  Print(" ==> vector[%d]: ", j); mpz_out_str(stdout, 10, vec[j]);
2088 #endif
2089 
2090  if(j==0)
2091  {
2092  mpz_set(ggt, sntz);
2093  }
2094  else
2095  {
2096  if(mpz_cmp_si(ggt,1) != 0)
2097  {
2098  mpz_gcd(ggt, ggt, sntz);
2099  }
2100  }
2101  }
2102 
2103 #ifdef NEXT_VECTORS_CC
2104  PrintS("\n// gcd of elements of the vector: ");
2105  mpz_out_str( stdout, 10, ggt);
2106 #endif
2107 
2108 /**********************************************************************
2109 * construct a new weight vector and check whether vec[j] is overflow, *
2110 * i.e. vec[j] > 2^31. *
2111 * If vec[j] doesn't overflow, define a weight vector. Otherwise, *
2112 * report that overflow appears. In the second case, test whether the *
2113 * the correctness of the new vector plays an important role *
2114 **********************************************************************/
2115  kkk=0;
2116  for(j=0; j<nRing; j++)
2117  {
2118  if(mpz_cmp(vec[j], sing_int_half) >= 0)
2119  {
2120  goto REDUCTION;
2121  }
2122  }
2123  checkRed = 1;
2124  for (j=0; j<nRing; j++)
2125  {
2126  (*diff_weight)[j] = mpz_get_si(vec[j]);
2127  }
2128  goto SIMPLIFY_GCD;
2129 
2130  REDUCTION:
2131  for (j=0; j<nRing; j++)
2132  {
2133  (*diff_weight)[j] = mpz_get_si(vec[j]);
2134  }
2135  while(MivAbsMax(diff_weight) >= 5)
2136  {
2137  for (j=0; j<nRing; j++)
2138  {
2139  if(mpz_cmp_si(ggt,1)==0)
2140  {
2141  (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
2142  // Print("\n// vector[%d] = %d \n",j+1, (*diff_weight1)[j]);
2143  }
2144  else
2145  {
2146  mpz_divexact(vec[j], vec[j], ggt);
2147  (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
2148  // Print("\n// vector[%d] = %d \n",j+1, (*diff_weight1)[j]);
2149  }
2150 /*
2151  if((*diff_weight1)[j] == 0)
2152  {
2153  kkk = kkk + 1;
2154  }
2155 */
2156  }
2157 
2158 
2159 /*
2160  if(kkk > nRing - 1)
2161  {
2162  // diff_weight was reduced to zero
2163  // Print("\n // MwalkNextWeightCC: geaenderter Vector gleich Null! \n");
2164  goto TEST_OVERFLOW;
2165  }
2166 */
2167 
2168  if(test_w_in_ConeCC(G,diff_weight1) != 0)
2169  {
2170  Print("\n// MwalkNextWeightCC: geaenderter vector liegt in Groebnerkegel! \n");
2171  for (j=0; j<nRing; j++)
2172  {
2173  (*diff_weight)[j] = (*diff_weight1)[j];
2174  }
2175  if(MivAbsMax(diff_weight) < 5)
2176  {
2177  checkRed = 1;
2178  goto SIMPLIFY_GCD;
2179  }
2180  }
2181  else
2182  {
2183  // Print("\n// MwalkNextWeightCC: geaenderter vector liegt nicht in Groebnerkegel! \n");
2184  break;
2185  }
2186  }
2187 
2188  TEST_OVERFLOW:
2189 
2190  for (j=0; j<nRing; j++)
2191  {
2192  if(mpz_cmp(vec[j], sing_int)>=0)
2193  {
2194  if(Overflow_Error == FALSE)
2195  {
2196  Overflow_Error = TRUE;
2197  PrintS("\n// ** OVERFLOW in \"MwalkNextWeightCC\": ");
2198  mpz_out_str( stdout, 10, vec[j]);
2199  PrintS(" is greater than 2147483647 (max. integer representation)\n");
2200  //Print("// So vector[%d] := %d is wrong!!\n",j+1, vec[j]);// vec[j] is mpz_t
2201  }
2202  }
2203  }
2204 
2205  FINISH:
2206  delete diff_weight1;
2207  mpz_clear(t_zaehler);
2208  mpz_clear(t_nenner);
2209  mpz_clear(s_zaehler);
2210  mpz_clear(s_nenner);
2211  mpz_clear(sntz);
2212  mpz_clear(sztn);
2213  mpz_clear(temp);
2214  mpz_clear(MwWd);
2215  mpz_clear(deg_w0_p1);
2216  mpz_clear(deg_d0_p1);
2217  mpz_clear(ggt);
2218  omFree(vec);
2219  mpz_clear(sing_int_half);
2220  mpz_clear(sing_int);
2221  mpz_clear(dcw);
2222  mpz_clear(t_null);
2223 
2224 
2225 
2226  if(Overflow_Error == FALSE)
2227  {
2228  Overflow_Error = nError;
2229  }
2231  for(kkk=0; kkk<IDELEMS(G);kkk++)
2232  {
2233  poly p=G->m[kkk];
2234  while(p!=NULL)
2235  {
2236  p_Setm(p,currRing);
2237  pIter(p);
2238  }
2239  }
2240 return diff_weight;
2241 }
#define Print
Definition: emacs.cc:83
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
#define FALSE
Definition: auxiliary.h:140
static int MivAbsMax(intvec *vec)
Definition: walk.cc:1830
return P p
Definition: myNF.cc:203
intvec * ivCopy(const intvec *o)
Definition: intvec.h:137
#define TRUE
Definition: auxiliary.h:144
g
Definition: cfModGcd.cc:4031
static intvec * MivSub(intvec *a, intvec *b)
Definition: walk.cc:836
static TreeM * G
Definition: janet.cc:38
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN Overflow_Error
Definition: walk.cc:96
static long MivDotProduct(intvec *a, intvec *b)
Definition: walk.cc:820
static void cancel(mpz_t zaehler, mpz_t nenner)
Definition: walk.cc:565
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
fq_nmod_poly_t * vec
Definition: facHensel.cc:103
Definition: intvec.h:16
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
static long gcd(const long a, const long b)
Definition: walk.cc:541
static intvec * MExpPol(poly f)
Definition: walk.cc:852
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
polyrec * poly
Definition: hilb.h:10
static void ivString(intvec *iv, const char *ch)
Definition: walk.cc:500
int BOOLEAN
Definition: auxiliary.h:131
static intvec* MWalkRandomNextWeight ( ideal  G,
intvec curr_weight,
intvec target_weight,
int  weight_rad,
int  pert_deg 
)
static

Definition at line 4408 of file walk.cc.

4409 {
4410  int i, weight_norm;
4411  //int randCount=0;
4412  int nV = currRing->N;
4413  intvec* next_weight2;
4414  intvec* next_weight22 = new intvec(nV);
4415  intvec* result = new intvec(nV);
4416 
4417  //compute a perturbed next weight vector "next_weight1"
4418  //intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G,MivMatrixOrderRefine(curr_weight,target_weight),pert_deg),target_weight,G);
4419  intvec* next_weight1 =MkInterRedNextWeight(curr_weight,target_weight,G);
4420  //compute a random next weight vector "next_weight2"
4421  while(1)
4422  {
4423  weight_norm = 0;
4424  while(weight_norm == 0)
4425  {
4426  for(i=0; i<nV; i++)
4427  {
4428  (*next_weight22)[i] = rand() % 60000 - 30000;
4429  weight_norm = weight_norm + (*next_weight22)[i]*(*next_weight22)[i];
4430  }
4431  weight_norm = 1 + floor(sqrt(weight_norm));
4432  }
4433  for(i=0; i<nV; i++)
4434  {
4435  if((*next_weight22)[i] < 0)
4436  {
4437  (*next_weight22)[i] = 1 + (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);
4438  }
4439  else
4440  {
4441  (*next_weight22)[i] = (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);
4442  }
4443  }
4444  if(test_w_in_ConeCC(G, next_weight22) == 1)
4445  {
4446  next_weight2 = MkInterRedNextWeight(next_weight22,target_weight,G);
4447  delete next_weight22;
4448  break;
4449  }
4450  }
4451  // compute "usual" next weight vector
4452  intvec* next_weight = MwalkNextWeightCC(curr_weight,target_weight, G);
4453  ideal G_test = MwalkInitialForm(G, next_weight);
4454  ideal G_test2 = MwalkInitialForm(G, next_weight2);
4455 
4456  // compare next weights
4457  if(Overflow_Error == FALSE)
4458  {
4459  ideal G_test1 = MwalkInitialForm(G, next_weight1);
4460  if(IDELEMS(G_test1) < IDELEMS(G_test))
4461  {
4462  if(IDELEMS(G_test2) < IDELEMS(G_test1))
4463  {
4464  // |G_test2| < |G_test1| < |G_test|
4465  for(i=0; i<nV; i++)
4466  {
4467  (*result)[i] = (*next_weight2)[i];
4468  }
4469  }
4470  else
4471  {
4472  // |G_test1| < |G_test|, |G_test1| <= |G_test2|
4473  for(i=0; i<nV; i++)
4474  {
4475  (*result)[i] = (*next_weight1)[i];
4476  }
4477  }
4478  }
4479  else
4480  {
4481  if(IDELEMS(G_test2) < IDELEMS(G_test)) // |G_test2| < |G_test| <= |G_test1|
4482  {
4483  for(i=0; i<nV; i++)
4484  {
4485  (*result)[i] = (*next_weight2)[i];
4486  }
4487  }
4488  else
4489  {
4490  // |G_test| < |G_test1|, |G_test| <= |G_test2|
4491  for(i=0; i<nV; i++)
4492  {
4493  (*result)[i] = (*next_weight)[i];
4494  }
4495  }
4496  }
4497  idDelete(&G_test1);
4498  }
4499  else
4500  {
4502  if(IDELEMS(G_test2) < IDELEMS(G_test))
4503  {
4504  for(i=1; i<nV; i++)
4505  {
4506  (*result)[i] = (*next_weight2)[i];
4507  }
4508  }
4509  else
4510  {
4511  for(i=0; i<nV; i++)
4512  {
4513  (*result)[i] = (*next_weight)[i];
4514  }
4515  }
4516  }
4517  idDelete(&G_test);
4518  idDelete(&G_test2);
4519  if(test_w_in_ConeCC(G, result) == 1)
4520  {
4521  delete next_weight2;
4522  delete next_weight;
4523  delete next_weight1;
4524  return result;
4525  }
4526  else
4527  {
4528  delete result;
4529  delete next_weight2;
4530  delete next_weight1;
4531  return next_weight;
4532  }
4533 }
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
#define FALSE
Definition: auxiliary.h:140
static TreeM * G
Definition: janet.cc:38
BOOLEAN Overflow_Error
Definition: walk.cc:96
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
gmp_float sqrt(const gmp_float &a)
Definition: mpr_complex.cc:329
static intvec * MwalkNextWeightCC(intvec *curr_weight, intvec *target_weight, ideal G)
Definition: walk.cc:1865
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
static int MwalkWeightDegree ( poly  p,
intvec weight_vector 
)
inlinestatic

Definition at line 645 of file walk.cc.

646 {
647  assume(weight_vector->length() >= currRing->N);
648  int max = 0, maxtemp;
649 
650  while(p != NULL)
651  {
652  maxtemp = MLmWeightedDegree(p, weight_vector);
653  pIter(p);
654 
655  if (maxtemp > max)
656  {
657  max = maxtemp;
658  }
659  }
660  return max;
661 }
return P p
Definition: myNF.cc:203
int length() const
Definition: intvec.h:86
static int MLmWeightedDegree(const poly p, intvec *weight)
Definition: walk.cc:598
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
static intvec* NewVectorlp ( ideal  I)
static

Definition at line 4273 of file walk.cc.

4274 {
4275  int nV = currRing->N;
4276  intvec* iv_wlp = MivMatrixOrderlp(nV);
4277  intvec* result = Mfpertvector(I, iv_wlp);
4278  delete iv_wlp;
4279  return result;
4280 }
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1492
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
return result
Definition: facAbsBiFact.cc:76
static ideal rec_fractal_call ( ideal  G,
int  nlev,
intvec omtmp 
)
static

Definition at line 6112 of file walk.cc.

6113 {
6115  //Print("\n\n// Entering the %d-th recursion:", nlev);
6116 
6117  int i, nV = currRing->N;
6118  ring new_ring, testring;
6119  //ring extoRing;
6120  ideal Gomega, Gomega1, Gomega2, F, F1, Gresult, Gresult1, G1, Gt;
6121  int nwalks = 0;
6122  intvec* Mwlp;
6123 #ifndef BUCHBERGER_ALG
6124  intvec* hilb_func;
6125 #endif
6126 // intvec* extXtau;
6127  intvec* next_vect;
6128  intvec* omega2 = new intvec(nV);
6129  intvec* altomega = new intvec(nV);
6130 
6131  //BOOLEAN isnewtarget = FALSE;
6132 
6133  // to avoid (1,0,...,0) as the target vector (Hans)
6134  intvec* last_omega = new intvec(nV);
6135  for(i=nV-1; i>0; i--)
6136  (*last_omega)[i] = 1;
6137  (*last_omega)[0] = 10000;
6138 
6139  intvec* omega = new intvec(nV);
6140  for(i=0; i<nV; i++) {
6141  if(Xsigma->length() == nV)
6142  (*omega)[i] = (*Xsigma)[i];
6143  else
6144  (*omega)[i] = (*Xsigma)[(nV*(nlev-1))+i];
6145 
6146  (*omega2)[i] = (*Xtau)[(nlev-1)*nV+i];
6147  }
6148 
6149  if(nlev == 1) Xcall = 1;
6150  else Xcall = 0;
6151 
6152  ring oRing = currRing;
6153 
6154  while(1)
6155  {
6156 #ifdef FIRST_STEP_FRACTAL
6157  // perturb the current weight vector only on the top level or
6158  // after perturbation of the both vectors, nlev = 2 as the top level
6159  if((nlev == 1 && Xcall == 0) || (nlev == 2 && Xngleich == 1))
6160  if(islengthpoly2(G) == 1)
6161  {
6162  Mwlp = MivWeightOrderlp(omega);
6163  Xsigma = Mfpertvector(G, Mwlp);
6164  delete Mwlp;
6166  }
6167 #endif
6168  nwalks ++;
6169  NEXT_VECTOR_FRACTAL:
6170  to=clock();
6171  /* determine the next border */
6172  next_vect = MkInterRedNextWeight(omega,omega2,G);
6173  xtnw=xtnw+clock()-to;
6174 #ifdef PRINT_VECTORS
6175  MivString(omega, omega2, next_vect);
6176 #endif
6177  oRing = currRing;
6178 
6179  /* We only perturb the current target vector at the recursion level 1 */
6180  if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3
6181  if (MivComp(next_vect, omega2) != 1)
6182  {
6183  /* to dispense with taking initial (and lifting/interreducing
6184  after the call of recursion */
6185  //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev);
6186  //idElements(G, "G");
6187 
6188  Xngleich = 1;
6189  nlev +=1;
6190 
6191  if (rParameter(currRing) != NULL)
6192  DefRingPar(omtmp);
6193  else
6194  rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung3
6195 
6196  testring = currRing;
6197  Gt = idrMoveR(G, oRing,currRing);
6198 
6199  /* perturb the original target vector w.r.t. the current GB */
6200  delete Xtau;
6201  Xtau = NewVectorlp(Gt);
6202 
6203  rChangeCurrRing(oRing);
6204  G = idrMoveR(Gt, testring,currRing);
6205 
6206  /* perturb the current vector w.r.t. the current GB */
6207  Mwlp = MivWeightOrderlp(omega);
6208  Xsigma = Mfpertvector(G, Mwlp);
6209  delete Mwlp;
6210 
6211  for(i=nV-1; i>=0; i--) {
6212  (*omega2)[i] = (*Xtau)[nV+i];
6213  (*omega)[i] = (*Xsigma)[nV+i];
6214  }
6215 
6216  delete next_vect;
6217  to=clock();
6218 
6219  /* to avoid the value of Overflow_Error that occur in Mfpertvector*/
6221 
6222  next_vect = MkInterRedNextWeight(omega,omega2,G);
6223  xtnw=xtnw+clock()-to;
6224 
6225 #ifdef PRINT_VECTORS
6226  MivString(omega, omega2, next_vect);
6227 #endif
6228  }
6229 
6230 
6231  /* check whether the the computed vector is in the correct cone */
6232  /* If no, the reduced GB of an omega-homogeneous ideal will be
6233  computed by Buchberger algorithm and stop this recursion step*/
6234  //if(test_w_in_ConeCC(G, next_vect) != 1) //e.g. Example s7, cyc6
6235  if(Overflow_Error == TRUE)
6236  {
6237  delete next_vect;
6238  if (rParameter(currRing) != NULL)
6239  {
6240  DefRingPar(omtmp);
6241  }
6242  else
6243  {
6244  rChangeCurrRing(VMrDefault1(omtmp)); // Aenderung4
6245  }
6246 #ifdef TEST_OVERFLOW
6247  Gt = idrMoveR(G, oRing,currRing);
6248  Gt = NULL; return(Gt);
6249 #endif
6250 
6251  //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing));
6252  to=clock();
6253  Gt = idrMoveR(G, oRing,currRing);
6254  G1 = MstdCC(Gt);
6255  xtextra=xtextra+clock()-to;
6256  Gt = NULL;
6257 
6258  delete omega2;
6259  delete altomega;
6260 
6261  //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks);
6262  //Print(" ** Overflow_Error? (%d)", Overflow_Error);
6263  nnflow ++;
6264 
6266  return (G1);
6267  }
6268 
6269 
6270  /* If the perturbed target vector stays in the correct cone,
6271  return the current GB,
6272  otherwise, return the computed GB by the Buchberger-algorithm.
6273  Then we update the perturbed target vectors w.r.t. this GB. */
6274 
6275  /* the computed vector is equal to the origin vector, since
6276  t is not defined */
6277  if (MivComp(next_vect, XivNull) == 1)
6278  {
6279  if (rParameter(currRing) != NULL)
6280  DefRingPar(omtmp);
6281  else
6282  rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung5
6283 
6284  testring = currRing;
6285  Gt = idrMoveR(G, oRing,currRing);
6286 
6287  if(test_w_in_ConeCC(Gt, omega2) == 1) {
6288  delete omega2;
6289  delete next_vect;
6290  delete altomega;
6291  //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks);
6292  //Print(" ** Overflow_Error? (%d)", Overflow_Error);
6293 
6294  return (Gt);
6295  }
6296  else
6297  {
6298  //ivString(omega2, "tau'");
6299  //Print("\n// tau' doesn't stay in the correct cone!!");
6300 
6301 #ifndef MSTDCC_FRACTAL
6302  //07.08.03
6303  //ivString(Xtau, "old Xtau");
6304  intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
6305 #ifdef TEST_OVERFLOW
6306  if(Overflow_Error == TRUE)
6307  Gt = NULL; return(Gt);
6308 #endif
6309 
6310  if(MivSame(Xtau, Xtautmp) == 1)
6311  {
6312  //PrintS("\n// Update vectors are equal to the old vectors!!");
6313  delete Xtautmp;
6314  goto FRACTAL_MSTDCC;
6315  }
6316 
6317  Xtau = Xtautmp;
6318  Xtautmp = NULL;
6319  //ivString(Xtau, "new Xtau");
6320 
6321  for(i=nV-1; i>=0; i--)
6322  (*omega2)[i] = (*Xtau)[(nlev-1)*nV+i];
6323 
6324  //Print("\n// ring tau = %s;", rString(currRing));
6325  rChangeCurrRing(oRing);
6326  G = idrMoveR(Gt, testring,currRing);
6327 
6328  goto NEXT_VECTOR_FRACTAL;
6329 #endif
6330 
6331  FRACTAL_MSTDCC:
6332  //Print("\n// apply BB-Alg in ring = %s;", rString(currRing));
6333  to=clock();
6334  G = MstdCC(Gt);
6335  xtextra=xtextra+clock()-to;
6336 
6337  oRing = currRing;
6338 
6339  // update the original target vector w.r.t. the current GB
6340  if(MivSame(Xivinput, Xivlp) == 1)
6341  if (rParameter(currRing) != NULL)
6342  DefRingParlp();
6343  else
6344  VMrDefaultlp();
6345  else
6346  if (rParameter(currRing) != NULL)
6348  else
6349  rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung6
6350 
6351  testring = currRing;
6352  Gt = idrMoveR(G, oRing,currRing);
6353 
6354  delete Xtau;
6355  Xtau = NewVectorlp(Gt);
6356 
6357  rChangeCurrRing(oRing);
6358  G = idrMoveR(Gt, testring,currRing);
6359 
6360  delete omega2;
6361  delete next_vect;
6362  delete altomega;
6363  /*
6364  Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks);
6365  Print(" ** Overflow_Error? (%d)", Overflow_Error);
6366  */
6367  if(Overflow_Error == TRUE)
6368  nnflow ++;
6369 
6371  return(G);
6372  }
6373  }
6374 
6375  for(i=nV-1; i>=0; i--) {
6376  (*altomega)[i] = (*omega)[i];
6377  (*omega)[i] = (*next_vect)[i];
6378  }
6379  delete next_vect;
6380 
6381  to=clock();
6382  /* Take the initial form of <G> w.r.t. omega */
6383  Gomega = MwalkInitialForm(G, omega);
6384  xtif=xtif+clock()-to;
6385 
6386 #ifndef BUCHBERGER_ALG
6387  if(isNolVector(omega) == 0)
6388  hilb_func = hFirstSeries(Gomega,NULL,NULL,omega,currRing);
6389  else
6390  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
6391 #endif // BUCHBERGER_ALG
6392 
6393  if (rParameter(currRing) != NULL)
6394  DefRingPar(omega);
6395  else
6396  rChangeCurrRing(VMrDefault1(omega)); //Aenderung7
6397 
6398  Gomega1 = idrMoveR(Gomega, oRing,currRing);
6399 
6400  /* Maximal recursion depth, to compute a red. GB */
6401  /* Fractal walk with the alternative recursion */
6402  /* alternative recursion */
6403  // if(nlev == nV || lengthpoly(Gomega1) == 0)
6404  if(nlev == Xnlev || lengthpoly(Gomega1) == 0)
6405  //if(nlev == nV) // blind recursion
6406  {
6407  /*
6408  if(Xnlev != nV)
6409  {
6410  Print("\n// ** Xnlev = %d", Xnlev);
6411  ivString(Xtau, "Xtau");
6412  }
6413  */
6414  to=clock();
6415 #ifdef BUCHBERGER_ALG
6416  Gresult = MstdhomCC(Gomega1);
6417 #else
6418  Gresult =kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,omega);
6419  delete hilb_func;
6420 #endif // BUCHBERGER_ALG
6421  xtstd=xtstd+clock()-to;
6422  }
6423  else {
6424  rChangeCurrRing(oRing);
6425  Gomega1 = idrMoveR(Gomega1, oRing,currRing);
6426  Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega);
6427  }
6428 
6429  //convert a Groebner basis from a ring to another ring,
6430  new_ring = currRing;
6431 
6432  rChangeCurrRing(oRing);
6433  Gresult1 = idrMoveR(Gresult, new_ring,currRing);
6434  Gomega2 = idrMoveR(Gomega1, new_ring,currRing);
6435 
6436  to=clock();
6437  /* Lifting process */
6438  F = MLifttwoIdeal(Gomega2, Gresult1, G);
6439  xtlift=xtlift+clock()-to;
6440  idDelete(&Gresult1);
6441  idDelete(&Gomega2);
6442  idDelete(&G);
6443 
6444  rChangeCurrRing(new_ring);
6445  F1 = idrMoveR(F, oRing,currRing);
6446 
6447  to=clock();
6448  /* Interreduce G */
6449  G = kInterRedCC(F1, NULL);
6450  xtred=xtred+clock()-to;
6451  idDelete(&F1);
6452  }
6453 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1492
intvec * Xivlp
Definition: walk.cc:4287
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
intvec * Xivinput
Definition: walk.cc:4286
int nnflow
Definition: walk.cc:6105
static ring VMrDefault1(intvec *va)
Definition: walk.cc:2430
int Xngleich
Definition: walk.cc:6107
#define FALSE
Definition: auxiliary.h:140
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1416
clock_t xtred
Definition: walk.cc:98
intvec * Xsigma
Definition: walk.cc:4283
#define TRUE
Definition: auxiliary.h:144
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:2221
int length() const
Definition: intvec.h:86
int Xnlev
Definition: walk.cc:1491
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
intvec * Xtau
Definition: walk.cc:4284
static TreeM * G
Definition: janet.cc:38
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2748
int Xcall
Definition: walk.cc:6106
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
static int islengthpoly2(ideal G)
Definition: walk.cc:3287
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
static intvec * NewVectorlp(ideal I)
Definition: walk.cc:4273
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
ideal idCopy(ideal A)
Definition: ideals.h:76
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2881
static ideal MstdCC(ideal G)
Definition: walk.cc:907
static int lengthpoly(ideal G)
Definition: walk.cc:3259
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
static ideal rec_fractal_call(ideal G, int nlev, intvec *omtmp)
Definition: walk.cc:6112
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
intvec * XivNull
Definition: walk.cc:6090
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
static ideal REC_GB_Mwalk ( ideal  G,
intvec curr_weight,
intvec orig_target_weight,
int  tp_deg,
int  npwinc 
)
static

Definition at line 4541 of file walk.cc.

4543 {
4544  BOOLEAN nError = Overflow_Error;
4546 
4547  int i, nV = currRing->N;
4548  int nwalk=0, endwalks=0, nnwinC=1, nlast = 0;
4549  ideal Gomega, M, F, Gomega1, Gomega2, M1,F1,result,ssG;
4550  ring newRing, oldRing, TargetRing;
4551  intvec* target_weight;
4552  intvec* ivNull = new intvec(nV);
4553 #ifndef BUCHBERGER_ALG
4554  intvec* hilb_func;
4555  // to avoid (1,0,...,0) as the target vector
4556  intvec* last_omega = new intvec(nV);
4557  for(i=nV-1; i>0; i--)
4558  {
4559  (*last_omega)[i] = 1;
4560  }
4561  (*last_omega)[0] = 10000;
4562 #endif
4563  BOOLEAN isGB = FALSE;
4564 
4565  ring EXXRing = currRing;
4566 
4567  // compute a pertubed weight vector of the target weight vector
4568  if(tp_deg > 1 && tp_deg <= nV)
4569  {
4570  ideal H0 = idHeadCC(G);
4571  if (rParameter(currRing) != NULL)
4572  {
4573  DefRingPar(orig_target_weight);
4574  }
4575  else
4576  {
4577  rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
4578  }
4579  TargetRing = currRing;
4580  ssG = idrMoveR(G,EXXRing,currRing);
4581 
4582  ideal H0_tmp = idrMoveR(H0,EXXRing,currRing);
4583  ideal H1 = idHeadCC(ssG);
4584  id_Delete(&H0,EXXRing);
4585 
4586  if(test_G_GB_walk(H0_tmp,H1)==1)
4587  {
4588  //Print("\n//REC_GB_Mwalk: input in %d-th recursive is a GB!\n",tp_deg);
4589  idDelete(&H0_tmp);
4590  idDelete(&H1);
4591  G = ssG;
4592  ssG = NULL;
4593  newRing = currRing;
4594  delete ivNull;
4595  if(npwinc == 0)
4596  {
4597  isGB = TRUE;
4598  goto KSTD_Finish;
4599  }
4600  else
4601  {
4602  goto LastGB_Finish;
4603  }
4604  }
4605  idDelete(&H0_tmp);
4606  idDelete(&H1);
4607 
4608  target_weight = MPertVectors(ssG, MivMatrixOrder(orig_target_weight), tp_deg);
4609 
4610  rChangeCurrRing(EXXRing);
4611  G = idrMoveR(ssG, TargetRing,currRing);
4612  }
4613 
4614  while(1)
4615  {
4616  nwalk ++;
4617  nstep++;
4618  if(nwalk == 1)
4619  {
4620  goto NEXT_STEP;
4621  }
4622  //Print("\n//REC_GB_Mwalk: Entering the %d-th step in the %d-th recursive:\n",nwalk,tp_deg);
4623  to = clock();
4624  // compute an initial form ideal of <G> w.r.t. "curr_vector"
4625  Gomega = MwalkInitialForm(G, curr_weight);
4626  xtif = xtif + clock()-to;
4627 
4628 #ifndef BUCHBERGER_ALG
4629  if(isNolVector(curr_weight) == 0)
4630  {
4631  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
4632  }
4633  else
4634  {
4635  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
4636  }
4637 #endif
4638 
4639  oldRing = currRing;
4640 
4641  // define a new ring with ordering "(a(curr_weight),lp)
4642  if (rParameter(currRing) != NULL)
4643  {
4644  DefRingPar(curr_weight);
4645  }
4646  else
4647  {
4648  rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
4649  }
4650  newRing = currRing;
4651  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
4652 
4653  to = clock();
4654  // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing"
4655 #ifdef BUCHBERGER_ALG
4656  M = MstdhomCC(Gomega1);
4657 #else
4658  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
4659  delete hilb_func;
4660 #endif
4661  xtstd = xtstd + clock() - to;
4662 
4663  // change the ring to oldRing
4664  rChangeCurrRing(oldRing);
4665 
4666  M1 = idrMoveR(M, newRing,currRing);
4667  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
4668 
4669  to = clock();
4670  F = MLifttwoIdeal(Gomega2, M1, G);
4671  xtlift = xtlift + clock() -to;
4672 
4673  idDelete(&M1);
4674  idDelete(&Gomega2);
4675  idDelete(&G);
4676 
4677 
4678  // change the ring to newRing
4679  rChangeCurrRing(newRing);
4680  F1 = idrMoveR(F, oldRing,currRing);
4681 
4682  to = clock();
4683  // reduce the Groebner basis <G> w.r.t. new ring
4684  G = kInterRedCC(F1, NULL);
4685  xtred = xtred + clock() -to;
4686 
4687  idDelete(&F1);
4688 
4689  if(endwalks == 1)
4690  {
4691  break;
4692  }
4693  NEXT_STEP:
4694  to = clock();
4695  // compute a next weight vector
4696  intvec* next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
4697 
4698 
4699  xtnw = xtnw + clock() - to;
4700 
4701 #ifdef PRINT_VECTORS
4702  MivString(curr_weight, target_weight, next_weight);
4703 #endif
4704 
4705  if(Overflow_Error == TRUE)
4706  {
4707  //PrintS("\n//REC_GB_Mwalk: The computed vector does NOT stay in the correct cone!!\n");
4708  nnwinC = 0;
4709  if(tp_deg == nV)
4710  {
4711  nlast = 1;
4712  }
4713  delete next_weight;
4714  break;
4715  }
4716  if(MivComp(next_weight, ivNull) == 1)
4717  {
4718  newRing = currRing;
4719  delete next_weight;
4720  break;
4721  }
4722 
4723  if(MivComp(next_weight, target_weight) == 1)
4724  {
4725  if(tp_deg == nV)
4726  {
4727  endwalks = 1;
4728  }
4729  else
4730  {
4731  G = REC_GB_Mwalk(G,curr_weight, orig_target_weight, tp_deg+1,nnwinC);
4732  newRing = currRing;
4733  delete next_weight;
4734  break;
4735  }
4736  }
4737 
4738  for(i=nV-1; i>=0; i--)
4739  {
4740  (*curr_weight)[i] = (*next_weight)[i];
4741  }
4742  delete next_weight;
4743  }
4744 
4745  delete ivNull;
4746 
4747  if(tp_deg != nV)
4748  {
4749  newRing = currRing;
4750 
4751  if (rParameter(currRing) != NULL)
4752  {
4753  DefRingPar(orig_target_weight);
4754  }
4755  else
4756  {
4757  rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
4758  }
4759  F1 = idrMoveR(G, newRing,currRing);
4760 
4761  if(nnwinC == 0)
4762  {
4763  F1 = REC_GB_Mwalk(F1,curr_weight, orig_target_weight, tp_deg+1,nnwinC);
4764  }
4765  else
4766  {
4767  if(test_w_in_ConeCC(F1, target_weight) != 1)
4768  {
4769  F1 = REC_GB_Mwalk(F1,curr_weight, orig_target_weight,tp_deg+1,nnwinC);
4770  }
4771  }
4772  delete target_weight;
4773 
4774  TargetRing = currRing;
4775  rChangeCurrRing(EXXRing);
4776  result = idrMoveR(F1, TargetRing,currRing);
4777  }
4778  else
4779  {
4780  if(nlast == 1)
4781  {
4782  if (rParameter(currRing) != NULL)
4783  {
4784  DefRingPar(orig_target_weight);
4785  }
4786  else
4787  {
4788  rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
4789  }
4790  KSTD_Finish:
4791  if(isGB == FALSE)
4792  {
4793  F1 = idrMoveR(G, newRing,currRing);
4794  }
4795  else
4796  {
4797  F1 = G;
4798  }
4799  to=clock();
4800  // apply Buchberger alg to compute a red. GB of F1
4801  G = MstdCC(F1);
4802  xtextra=clock()-to;
4803  idDelete(&F1);
4804  newRing = currRing;
4805  }
4806 
4807  LastGB_Finish:
4808  rChangeCurrRing(EXXRing);
4809  result = idrMoveR(G, newRing,currRing);
4810  }
4811 
4812  if(Overflow_Error == FALSE)
4813  {
4814  Overflow_Error = nError;
4815  }
4816 #ifndef BUCHBERGER_ALG
4817  delete last_omega;
4818 #endif
4819  return(result);
4820 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
static ideal REC_GB_Mwalk(ideal G, intvec *curr_weight, intvec *orig_target_weight, int tp_deg, int npwinc)
Definition: walk.cc:4541
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
static int test_G_GB_walk(ideal H0, ideal H1)
Definition: walk.cc:3342
#define FALSE
Definition: auxiliary.h:140
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
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:2221
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
static TreeM * G
Definition: janet.cc:38
BOOLEAN Overflow_Error
Definition: walk.cc:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
static ideal idHeadCC(ideal h)
Definition: walk.cc:3323
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
int BOOLEAN
Definition: auxiliary.h:131
clock_t xtextra
Definition: walk.cc:99
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
static ideal Rec_LastGB ( ideal  G,
intvec curr_weight,
intvec orig_target_weight,
int  tp_deg,
int  npwinc 
)
static

Definition at line 3761 of file walk.cc.

3763 {
3764  BOOLEAN nError = Overflow_Error;
3766  // BOOLEAN nOverflow_Error = FALSE;
3767 
3768  clock_t tproc=0;
3769  clock_t tinput = clock();
3770 
3771  int i, nV = currRing->N;
3772  int nwalk=0, endwalks=0, nnwinC=1;
3773  int nlast = 0;
3774  ideal Gomega, M, F, Gomega1, Gomega2, M1,F1,result,ssG;
3775  ring newRing, oldRing, TargetRing;
3776  intvec* iv_M_lp;
3777  intvec* target_weight;
3778  intvec* ivNull = new intvec(nV); //define (0,...,0)
3779  ring EXXRing = currRing;
3780  //int NEG=0; //19 juni 03
3781  intvec* next_weight;
3782 #ifndef BUCHBERGER_ALG
3783  //08 Juli 03
3784  intvec* hilb_func;
3785 #endif
3786  // to avoid (1,0,...,0) as the target vector
3787  intvec* last_omega = new intvec(nV);
3788  for(i=nV-1; i>0; i--)
3789  (*last_omega)[i] = 1;
3790  (*last_omega)[0] = 10000;
3791 
3792  BOOLEAN isGB = FALSE;
3793 
3794  // compute a pertubed weight vector of the target weight vector
3795  if(tp_deg > 1 && tp_deg <= nV)
3796  {
3797  ideal H0 = idHeadCC(G);
3798 
3799  if (rParameter (currRing) != NULL)
3800  {
3801  DefRingParlp();
3802  }
3803  else
3804  {
3805  VMrDefaultlp();
3806  }
3807  TargetRing = currRing;
3808  ssG = idrMoveR(G,EXXRing,currRing);
3809 
3810  ideal H0_tmp = idrMoveR(H0,EXXRing,currRing);
3811  ideal H1 = idHeadCC(ssG);
3812 
3813  // Apply Lemma 2.2 in Collart et. al (1997) to check whether cone(k-1) is equal to cone(k)
3814  if(test_G_GB_walk(H0_tmp,H1)==1)
3815  {
3816  idDelete(&H0_tmp);
3817  idDelete(&H1);
3818  G = ssG;
3819  ssG = NULL;
3820  newRing = currRing;
3821  delete ivNull;
3822 
3823  if(npwinc != 0)
3824  {
3825  goto LastGB_Finish;
3826  }
3827  else
3828  {
3829  isGB = TRUE;
3830  goto KSTD_Finish;
3831  }
3832  }
3833  idDelete(&H0_tmp);
3834  idDelete(&H1);
3835 
3836  iv_M_lp = MivMatrixOrderlp(nV);
3837  target_weight = MPertVectors(ssG, iv_M_lp, tp_deg);
3838  delete iv_M_lp;
3839  //PrintS("\n// Input is not GB!!");
3840  rChangeCurrRing(EXXRing);
3841  G = idrMoveR(ssG, TargetRing,currRing);
3842 
3843  if(Overflow_Error == TRUE)
3844  {
3845  //nOverflow_Error = Overflow_Error;
3846  //NEG = 1;
3847  newRing = currRing;
3848  goto JUNI_STD;
3849  }
3850  }
3851 
3852  while(1)
3853  {
3854  nwalk ++;
3855  nstep++;
3856 
3857  if(nwalk==1)
3858  {
3859  goto FIRST_STEP;
3860  }
3861  to=clock();
3862  // compute an initial form ideal of <G> w.r.t. "curr_vector"
3863  Gomega = MwalkInitialForm(G, curr_weight);
3864  xtif=xtif+clock()-to;
3865 
3866 #ifndef BUCHBERGER_ALG
3867  if(isNolVector(curr_weight) == 0)
3868  {
3869  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
3870  }
3871  else
3872  {
3873  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
3874  }
3875 #endif // BUCHBERGER_ALG
3876 
3877  oldRing = currRing;
3878 
3879  // defiNe a new ring that its ordering is "(a(curr_weight),lp)
3880  if (rParameter(currRing) != NULL)
3881  {
3882  DefRingPar(curr_weight);
3883  }
3884  else
3885  {
3886  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung
3887  }
3888  newRing = currRing;
3889  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
3890  to=clock();
3891  // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing"
3892 #ifdef BUCHBERGER_ALG
3893  M = MstdhomCC(Gomega1);
3894 #else
3895  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
3896  delete hilb_func;
3897 #endif // BUCHBERGER_ALG
3898  xtstd=xtstd+clock()-to;
3899  // change the ring to oldRing
3900  rChangeCurrRing(oldRing);
3901  M1 = idrMoveR(M, newRing,currRing);
3902  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
3903 
3904  to=clock();
3905  // compute a reduced Groebner basis of <G> w.r.t. "newRing" by the lifting process
3906  F = MLifttwoIdeal(Gomega2, M1, G);
3907  xtlift=xtlift+clock()-to;
3908  idDelete(&M1);
3909  idDelete(&Gomega2);
3910  idDelete(&G);
3911 
3912  // change the ring to newRing
3913  rChangeCurrRing(newRing);
3914  F1 = idrMoveR(F, oldRing,currRing);
3915 
3916  to=clock();
3917  // reduce the Groebner basis <G> w.r.t. new ring
3918  G = kInterRedCC(F1, NULL);
3919  xtred=xtred+clock()-to;
3920  idDelete(&F1);
3921 
3922  if(endwalks == 1)
3923  {
3924  break;
3925  }
3926  FIRST_STEP:
3927  to=clock();
3929  // compute a next weight vector
3930  next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
3931  xtnw=xtnw+clock()-to;
3932 #ifdef PRINT_VECTORS
3933  MivString(curr_weight, target_weight, next_weight);
3934 #endif
3935 
3936  if(Overflow_Error == TRUE)
3937  {
3938  //PrintS("\n// ** The next vector does NOT stay in Cone!!\n");
3939 #ifdef TEST_OVERFLOW
3940  goto LastGB_Finish;
3941 #endif
3942 
3943  nnwinC = 0;
3944  if(tp_deg == nV)
3945  {
3946  nlast = 1;
3947  }
3948  delete next_weight;
3949  break;
3950  }
3951 
3952  if(MivComp(next_weight, ivNull) == 1)
3953  {
3954  //newRing = currRing;
3955  delete next_weight;
3956  break;
3957  }
3958 
3959  if(MivComp(next_weight, target_weight) == 1)
3960  {
3961  if(tp_deg == nV)
3962  {
3963  endwalks = 1;
3964  }
3965  else
3966  {
3967  // REC_LAST_GB_ALT2:
3968  //nOverflow_Error = Overflow_Error;
3969  tproc=tproc+clock()-tinput;
3970  /*
3971  Print("\n// takes %d steps and calls \"Rec_LastGB\" (%d):",
3972  nwalk, tp_deg+1);
3973  */
3974  G = Rec_LastGB(G,curr_weight, orig_target_weight, tp_deg+1,nnwinC);
3975  newRing = currRing;
3976  delete next_weight;
3977  break;
3978  }
3979  }
3980 
3981  for(i=nV-1; i>=0; i--)
3982  {
3983  (*curr_weight)[i] = (*next_weight)[i];
3984  }
3985  delete next_weight;
3986  }//while
3987 
3988  delete ivNull;
3989 
3990  if(tp_deg != nV)
3991  {
3992  newRing = currRing;
3993 
3994  if (rParameter(currRing) != NULL)
3995  {
3996  DefRingParlp();
3997  }
3998  else
3999  {
4000  VMrDefaultlp();
4001  }
4002  F1 = idrMoveR(G, newRing,currRing);
4003 
4004  if(nnwinC == 0 || test_w_in_ConeCC(F1, target_weight) != 1 )
4005  {
4006  // nOverflow_Error = Overflow_Error;
4007  //Print("\n// takes %d steps and calls \"Rec_LastGB (%d):", tp_deg+1);
4008  tproc=tproc+clock()-tinput;
4009  F1 = Rec_LastGB(F1,curr_weight, orig_target_weight, tp_deg+1,nnwinC);
4010  }
4011  delete target_weight;
4012 
4013  TargetRing = currRing;
4014  rChangeCurrRing(EXXRing);
4015  result = idrMoveR(F1, TargetRing,currRing);
4016  }
4017  else
4018  {
4019  if(nlast == 1)
4020  {
4021  JUNI_STD:
4022 
4023  newRing = currRing;
4024  if (rParameter(currRing) != NULL)
4025  {
4026  DefRingParlp();
4027  }
4028  else
4029  {
4030  VMrDefaultlp();
4031  }
4032  KSTD_Finish:
4033  if(isGB == FALSE)
4034  {
4035  F1 = idrMoveR(G, newRing,currRing);
4036  }
4037  else
4038  {
4039  F1 = G;
4040  }
4041  to=clock();
4042  // Print("\n// apply the Buchberger's alg in ring = %s",rString(currRing));
4043  // idElements(F1, "F1");
4044  G = MstdCC(F1);
4045  xtextra=xtextra+clock()-to;
4046 
4047 
4048  idDelete(&F1);
4049  newRing = currRing;
4050  }
4051 
4052  LastGB_Finish:
4053  rChangeCurrRing(EXXRing);
4054  result = idrMoveR(G, newRing,currRing);
4055  }
4056 
4057  if(Overflow_Error == FALSE)
4058  {
4059  Overflow_Error=nError;
4060  }
4061 // Print("\n// \"Rec_LastGB\" (%d) took %d steps and %.2f sec.Overflow_Error (%d)", tp_deg, nwalk, ((double) tproc)/1000000, nOverflow_Error);
4062  return(result);
4063 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
static int test_G_GB_walk(ideal H0, ideal H1)
Definition: walk.cc:3342
#define FALSE
Definition: auxiliary.h:140
clock_t xtred
Definition: walk.cc:98
#define TRUE
Definition: auxiliary.h:144
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:2221
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
static TreeM * G
Definition: janet.cc:38
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2748
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
static ideal idHeadCC(ideal h)
Definition: walk.cc:3323
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
static ideal Rec_LastGB(ideal G, intvec *curr_weight, intvec *orig_target_weight, int tp_deg, int npwinc)
Definition: walk.cc:3761
clock_t xtnw
Definition: walk.cc:98
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2881
static ideal MstdCC(ideal G)
Definition: walk.cc:907
int nstep
kstd2.cc
Definition: walk.cc:88
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
int BOOLEAN
Definition: auxiliary.h:131
clock_t xtextra
Definition: walk.cc:99
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
return result
Definition: facAbsBiFact.cc:76
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
static ideal rec_r_fractal_call ( ideal  G,
int  nlev,
intvec omtmp,
int  weight_rad 
)
static

Definition at line 6458 of file walk.cc.

6459 {
6461  //Print("\n\n// Entering the %d-th recursion:", nlev);
6462 
6463  int i, nV = currRing->N;
6464  ring new_ring, testring;
6465  //ring extoRing;
6466  ideal Gomega, Gomega1, Gomega2, F, F1, Gresult, Gresult1, G1, Gt;
6467  int nwalks = 0;
6468  intvec* Mwlp;
6469 #ifndef BUCHBERGER_ALG
6470  intvec* hilb_func;
6471 #endif
6472 // intvec* extXtau;
6473  intvec* next_vect;
6474  intvec* omega2 = new intvec(nV);
6475  intvec* altomega = new intvec(nV);
6476 
6477  //BOOLEAN isnewtarget = FALSE;
6478 
6479  // to avoid (1,0,...,0) as the target vector (Hans)
6480  intvec* last_omega = new intvec(nV);
6481  for(i=nV-1; i>0; i--)
6482  (*last_omega)[i] = 1;
6483  (*last_omega)[0] = 10000;
6484 
6485  intvec* omega = new intvec(nV);
6486  for(i=0; i<nV; i++) {
6487  if(Xsigma->length() == nV)
6488  (*omega)[i] = (*Xsigma)[i];
6489  else
6490  (*omega)[i] = (*Xsigma)[(nV*(nlev-1))+i];
6491 
6492  (*omega2)[i] = (*Xtau)[(nlev-1)*nV+i];
6493  }
6494 
6495  if(nlev == 1) Xcall = 1;
6496  else Xcall = 0;
6497 
6498  ring oRing = currRing;
6499 
6500  while(1)
6501  {
6502 #ifdef FIRST_STEP_FRACTAL
6503  // perturb the current weight vector only on the top level or
6504  // after perturbation of the both vectors, nlev = 2 as the top level
6505  if((nlev == 1 && Xcall == 0) || (nlev == 2 && Xngleich == 1))
6506  if(islengthpoly2(G) == 1)
6507  {
6508  Mwlp = MivWeightOrderlp(omega);
6509  Xsigma = Mfpertvector(G, Mwlp);
6510  delete Mwlp;
6512  }
6513 #endif
6514  nwalks ++;
6515  NEXT_VECTOR_FRACTAL:
6516  to=clock();
6517  /* determine the next border */
6518  next_vect = MWalkRandomNextWeight(G, omega,omega2, weight_rad, 1+nlev);
6519  //next_vect = MkInterRedNextWeight(omega,omega2,G);
6520  xtnw=xtnw+clock()-to;
6521 #ifdef PRINT_VECTORS
6522  MivString(omega, omega2, next_vect);
6523 #endif
6524  oRing = currRing;
6525 
6526  /* We only perturb the current target vector at the recursion level 1 */
6527  if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3
6528  if (MivComp(next_vect, omega2) == 1)
6529  {
6530  /* to dispense with taking initial (and lifting/interreducing
6531  after the call of recursion */
6532  //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev);
6533  //idElements(G, "G");
6534 
6535  Xngleich = 1;
6536  nlev +=1;
6537 
6538  if (rParameter(currRing) != NULL)
6539  DefRingPar(omtmp);
6540  else
6541  rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung3
6542 
6543  testring = currRing;
6544  Gt = idrMoveR(G, oRing,currRing);
6545 
6546  /* perturb the original target vector w.r.t. the current GB */
6547  delete Xtau;
6548  Xtau = NewVectorlp(Gt);
6549 
6550  rChangeCurrRing(oRing);
6551  G = idrMoveR(Gt, testring,currRing);
6552 
6553  /* perturb the current vector w.r.t. the current GB */
6554  Mwlp = MivWeightOrderlp(omega);
6555  Xsigma = Mfpertvector(G, Mwlp);
6556  delete Mwlp;
6557 
6558  for(i=nV-1; i>=0; i--) {
6559  (*omega2)[i] = (*Xtau)[nV+i];
6560  (*omega)[i] = (*Xsigma)[nV+i];
6561  }
6562 
6563  delete next_vect;
6564  to=clock();
6565 
6566  /* to avoid the value of Overflow_Error that occur in Mfpertvector*/
6568 
6569  next_vect = MkInterRedNextWeight(omega,omega2,G);
6570  xtnw=xtnw+clock()-to;
6571 
6572 #ifdef PRINT_VECTORS
6573  MivString(omega, omega2, next_vect);
6574 #endif
6575  }
6576 
6577 
6578  /* check whether the the computed vector is in the correct cone */
6579  /* If no, the reduced GB of an omega-homogeneous ideal will be
6580  computed by Buchberger algorithm and stop this recursion step*/
6581  //if(test_w_in_ConeCC(G, next_vect) != 1) //e.g. Example s7, cyc6
6582  if(Overflow_Error == TRUE)
6583  {
6584  delete next_vect;
6585  if (rParameter(currRing) != NULL)
6586  {
6587  DefRingPar(omtmp);
6588  }
6589  else
6590  {
6591  rChangeCurrRing(VMrDefault1(omtmp)); // Aenderung4
6592  }
6593 #ifdef TEST_OVERFLOW
6594  Gt = idrMoveR(G, oRing,currRing);
6595  Gt = NULL; return(Gt);
6596 #endif
6597 
6598  //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing));
6599  to=clock();
6600  Gt = idrMoveR(G, oRing,currRing);
6601  G1 = MstdCC(Gt);
6602  xtextra=xtextra+clock()-to;
6603  Gt = NULL;
6604 
6605  delete omega2;
6606  delete altomega;
6607 
6608  //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks);
6609  //Print(" ** Overflow_Error? (%d)", Overflow_Error);
6610  nnflow ++;
6611 
6613  return (G1);
6614  }
6615 
6616 
6617  /* If the perturbed target vector stays in the correct cone,
6618  return the current GB,
6619  otherwise, return the computed GB by the Buchberger-algorithm.
6620  Then we update the perturbed target vectors w.r.t. this GB. */
6621 
6622  /* the computed vector is equal to the origin vector, since
6623  t is not defined */
6624  if (MivComp(next_vect, XivNull) == 1)
6625  {
6626  if (rParameter(currRing) != NULL)
6627  DefRingPar(omtmp);
6628  else
6629  rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung5
6630 
6631  testring = currRing;
6632  Gt = idrMoveR(G, oRing,currRing);
6633 
6634  if(test_w_in_ConeCC(Gt, omega2) == 1) {
6635  delete omega2;
6636  delete next_vect;
6637  delete altomega;
6638  //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks);
6639  //Print(" ** Overflow_Error? (%d)", Overflow_Error);
6640 
6641  return (Gt);
6642  }
6643  else
6644  {
6645  //ivString(omega2, "tau'");
6646  //Print("\n// tau' doesn't stay in the correct cone!!");
6647 
6648 #ifndef MSTDCC_FRACTAL
6649  //07.08.03
6650  //ivString(Xtau, "old Xtau");
6651  intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
6652 #ifdef TEST_OVERFLOW
6653  if(Overflow_Error == TRUE)
6654  Gt = NULL; return(Gt);
6655 #endif
6656 
6657  if(MivSame(Xtau, Xtautmp) == 1)
6658  {
6659  //PrintS("\n// Update vectors are equal to the old vectors!!");
6660  delete Xtautmp;
6661  goto FRACTAL_MSTDCC;
6662  }
6663 
6664  Xtau = Xtautmp;
6665  Xtautmp = NULL;
6666  //ivString(Xtau, "new Xtau");
6667 
6668  for(i=nV-1; i>=0; i--)
6669  (*omega2)[i] = (*Xtau)[(nlev-1)*nV+i];
6670 
6671  //Print("\n// ring tau = %s;", rString(currRing));
6672  rChangeCurrRing(oRing);
6673  G = idrMoveR(Gt, testring,currRing);
6674 
6675  goto NEXT_VECTOR_FRACTAL;
6676 #endif
6677 
6678  FRACTAL_MSTDCC:
6679  //Print("\n// apply BB-Alg in ring = %s;", rString(currRing));
6680  to=clock();
6681  G = MstdCC(Gt);
6682  xtextra=xtextra+clock()-to;
6683 
6684  oRing = currRing;
6685 
6686  // update the original target vector w.r.t. the current GB
6687  if(MivSame(Xivinput, Xivlp) == 1)
6688  if (rParameter(currRing) != NULL)
6689  DefRingParlp();
6690  else
6691  VMrDefaultlp();
6692  else
6693  if (rParameter(currRing) != NULL)
6695  else
6696  rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung6
6697 
6698  testring = currRing;
6699  Gt = idrMoveR(G, oRing,currRing);
6700 
6701  delete Xtau;
6702  Xtau = NewVectorlp(Gt);
6703 
6704  rChangeCurrRing(oRing);
6705  G = idrMoveR(Gt, testring,currRing);
6706 
6707  delete omega2;
6708  delete next_vect;
6709  delete altomega;
6710  /*
6711  Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks);
6712  Print(" ** Overflow_Error? (%d)", Overflow_Error);
6713  */
6714  if(Overflow_Error == TRUE)
6715  nnflow ++;
6716 
6718  return(G);
6719  }
6720  }
6721 
6722  for(i=nV-1; i>=0; i--) {
6723  (*altomega)[i] = (*omega)[i];
6724  (*omega)[i] = (*next_vect)[i];
6725  }
6726  delete next_vect;
6727 
6728  to=clock();
6729  /* Take the initial form of <G> w.r.t. omega */
6730  Gomega = MwalkInitialForm(G, omega);
6731  xtif=xtif+clock()-to;
6732 
6733 #ifndef BUCHBERGER_ALG
6734  if(isNolVector(omega) == 0)
6735  hilb_func = hFirstSeries(Gomega,NULL,NULL,omega,currRing);
6736  else
6737  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
6738 #endif // BUCHBERGER_ALG
6739 
6740  if (rParameter(currRing) != NULL)
6741  DefRingPar(omega);
6742  else
6743  rChangeCurrRing(VMrDefault1(omega)); //Aenderung7
6744 
6745  Gomega1 = idrMoveR(Gomega, oRing,currRing);
6746 
6747  /* Maximal recursion depth, to compute a red. GB */
6748  /* Fractal walk with the alternative recursion */
6749  /* alternative recursion */
6750  // if(nlev == nV || lengthpoly(Gomega1) == 0)
6751  if(nlev == Xnlev || lengthpoly(Gomega1) == 0)
6752  //if(nlev == nV) // blind recursion
6753  {
6754  /*
6755  if(Xnlev != nV)
6756  {
6757  Print("\n// ** Xnlev = %d", Xnlev);
6758  ivString(Xtau, "Xtau");
6759  }
6760  */
6761  to=clock();
6762 #ifdef BUCHBERGER_ALG
6763  Gresult = MstdhomCC(Gomega1);
6764 #else
6765  Gresult =kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,omega);
6766  delete hilb_func;
6767 #endif // BUCHBERGER_ALG
6768  xtstd=xtstd+clock()-to;
6769  }
6770  else {
6771  rChangeCurrRing(oRing);
6772  Gomega1 = idrMoveR(Gomega1, oRing,currRing);
6773  Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega);
6774  }
6775 
6776  //convert a Groebner basis from a ring to another ring,
6777  new_ring = currRing;
6778 
6779  rChangeCurrRing(oRing);
6780  Gresult1 = idrMoveR(Gresult, new_ring,currRing);
6781  Gomega2 = idrMoveR(Gomega1, new_ring,currRing);
6782 
6783  to=clock();
6784  /* Lifting process */
6785  F = MLifttwoIdeal(Gomega2, Gresult1, G);
6786  xtlift=xtlift+clock()-to;
6787  idDelete(&Gresult1);
6788  idDelete(&Gomega2);
6789  idDelete(&G);
6790 
6791  rChangeCurrRing(new_ring);
6792  F1 = idrMoveR(F, oRing,currRing);
6793 
6794  to=clock();
6795  /* Interreduce G */
6796  G = kInterRedCC(F1, NULL);
6797  xtred=xtred+clock()-to;
6798  idDelete(&F1);
6799  }
6800 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
static int test_w_in_ConeCC(ideal G, intvec *iv)
Definition: walk.cc:760
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1492
intvec * Xivlp
Definition: walk.cc:4287
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
intvec * Xivinput
Definition: walk.cc:4286
int nnflow
Definition: walk.cc:6105
static ring VMrDefault1(intvec *va)
Definition: walk.cc:2430
int Xngleich
Definition: walk.cc:6107
#define FALSE
Definition: auxiliary.h:140
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1416
clock_t xtred
Definition: walk.cc:98
intvec * Xsigma
Definition: walk.cc:4283
#define TRUE
Definition: auxiliary.h:144
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:2221
int length() const
Definition: intvec.h:86
int Xnlev
Definition: walk.cc:1491
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
intvec * Xtau
Definition: walk.cc:4284
static TreeM * G
Definition: janet.cc:38
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2748
int Xcall
Definition: walk.cc:6106
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
static int islengthpoly2(ideal G)
Definition: walk.cc:3287
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
static intvec * NewVectorlp(ideal I)
Definition: walk.cc:4273
int i
Definition: cfEzgcd.cc:123
clock_t xtstd
Definition: walk.cc:98
clock_t xtnw
Definition: walk.cc:98
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
ideal idCopy(ideal A)
Definition: ideals.h:76
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2881
static ideal MstdCC(ideal G)
Definition: walk.cc:907
static int lengthpoly(ideal G)
Definition: walk.cc:3259
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
static ideal rec_fractal_call(ideal G, int nlev, intvec *omtmp)
Definition: walk.cc:6112
clock_t xtlift
Definition: walk.cc:98
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
clock_t xtextra
Definition: walk.cc:99
intvec * XivNull
Definition: walk.cc:6090
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
static intvec * MWalkRandomNextWeight(ideal G, intvec *curr_weight, intvec *target_weight, int weight_rad, int pert_deg)
Definition: walk.cc:4408
clock_t xtif
Definition: walk.cc:98
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
void Set_Error ( BOOLEAN  f)

Definition at line 94 of file walk.cc.

94 { pSetm_error=f; }
FILE * f
Definition: checklibs.c:7
BOOLEAN pSetm_error
Definition: p_polys.cc:155
static int test_G_GB_walk ( ideal  H0,
ideal  H1 
)
inlinestatic

Definition at line 3342 of file walk.cc.

3343 {
3344  int i, nG = IDELEMS(H0);
3345 
3346  if(nG != IDELEMS(H1))
3347  {
3348  return 0;
3349  }
3350  for(i=nG-1; i>=0; i--)
3351  {
3352 #if 0
3353  poly t;
3354  if((t=pSub(pCopy(H0->m[i]), pCopy(H1->m[i]))) != NULL)
3355  {
3356  pDelete(&t);
3357  return 0;
3358  }
3359  pDelete(&t);
3360 #else
3361  if(!pEqualPolys(H0->m[i],H1->m[i]))
3362  {
3363  return 0;
3364  }
3365 #endif
3366  }
3367  return 1;
3368 }
#define pEqualPolys(p1, p2)
Definition: polys.h:372
#define pSub(a, b)
Definition: polys.h:258
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
static int test_w_in_ConeCC ( ideal  G,
intvec iv 
)
static

Definition at line 760 of file walk.cc.

761 {
762  if(G->m[0] == NULL)
763  {
764  PrintS("//** the result may be WRONG, i.e. 0!!\n");
765  return 0;
766  }
767 
768  BOOLEAN nError = Overflow_Error;
770 
771  int i, nG = IDELEMS(G);
772  poly mi, gi;
773 
774  for(i=nG-1; i>=0; i--)
775  {
776  mi = MpolyInitialForm(G->m[i], iv);
777  gi = G->m[i];
778 
779  if(mi == NULL)
780  {
781  pDelete(&mi);
782  if(Overflow_Error == FALSE)
783  {
784  Overflow_Error = nError;
785  }
786  return 0;
787  }
788  if(!pLmEqual(mi, gi))
789  {
790  pDelete(&mi);
791  if(Overflow_Error == FALSE)
792  {
793  Overflow_Error = nError;
794  }
795  return 0;
796  }
797  pDelete(&mi);
798  }
799 
800  if(Overflow_Error == FALSE)
801  {
802  Overflow_Error = nError;
803  }
804  return 1;
805 }
#define FALSE
Definition: auxiliary.h:140
static poly MpolyInitialForm(poly g, intvec *curr_weight)
Definition: walk.cc:699
static TreeM * G
Definition: janet.cc:38
BOOLEAN Overflow_Error
Definition: walk.cc:96
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:131
#define pLmEqual(p1, p2)
Definition: polys.h:111
ideal TranMImprovwalk ( ideal  G,
intvec curr_weight,
intvec target_tmp,
int  nP 
)

Definition at line 7071 of file walk.cc.

7072 {
7073 #ifdef TIME_TEST
7074  clock_t mtim = clock();
7075 #endif
7076  Set_Error(FALSE );
7078  //Print("// pSetm_Error = (%d)", ErrorCheck());
7079  //Print("\n// ring ro = %s;", rString(currRing));
7080 
7081  clock_t tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0, textra=0;
7082 #ifdef TIME_TEST
7083  clock_t tinput = clock();
7084 #endif
7085  int nsteppert=0, i, nV = currRing->N, nwalk=0, npert_tmp=0;
7086  int *npert=(int*)omAlloc(2*nV*sizeof(int));
7087  ideal Gomega, M,F, G1, Gomega1, Gomega2, M1, F1;
7088  //ring endRing;
7089  ring newRing, oldRing, lpRing;
7090  intvec* next_weight;
7091  intvec* ivNull = new intvec(nV); //define (0,...,0)
7092  intvec* iv_dp = MivUnit(nV);// define (1,1,...,1)
7093  intvec* iv_lp = Mivlp(nV); //define (1,0,...,0)
7094  ideal H0;
7095  //ideal H1;
7096  ideal H2, Glp;
7097  int nGB, endwalks = 0, nwalkpert=0, npertstep=0;
7098  intvec* Mlp = MivMatrixOrderlp(nV);
7099  intvec* vector_tmp = new intvec(nV);
7100 #ifndef BUCHBERGER_ALG
7101  intvec* hilb_func;
7102 #endif
7103  /* to avoid (1,0,...,0) as the target vector */
7104  intvec* last_omega = new intvec(nV);
7105  for(i=nV-1; i>0; i--)
7106  (*last_omega)[i] = 1;
7107  (*last_omega)[0] = 10000;
7108 
7109  // intvec* extra_curr_weight = new intvec(nV);
7110  intvec* target_weight = new intvec(nV);
7111  for(i=nV-1; i>=0; i--)
7112  (*target_weight)[i] = (*target_tmp)[i];
7113 
7114  ring XXRing = currRing;
7115  newRing = currRing;
7116 
7117  to=clock();
7118  /* compute a red. GB w.r.t. the help ring */
7119  if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) = "dp"
7120  G = MstdCC(G);
7121  else
7122  {
7123  //rOrdStr(currRing) = (a(.c_w..),lp,C)
7124  if (rParameter(currRing) != NULL)
7125  DefRingPar(curr_weight);
7126  else
7127  rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 4
7128  G = idrMoveR(G, XXRing,currRing);
7129  G = MstdCC(G);
7130  }
7131  tostd=clock()-to;
7132 
7133 #ifdef REPRESENTATION_OF_SIGMA
7134  ideal Gw = MwalkInitialForm(G, curr_weight);
7135 
7136  if(islengthpoly2(Gw)==1)
7137  {
7138  intvec* MDp;
7139  if(MivComp(curr_weight, iv_dp) == 1)
7140  MDp = MatrixOrderdp(nV); //MivWeightOrderlp(iv_dp);
7141  else
7142  MDp = MivWeightOrderlp(curr_weight);
7143 
7144  curr_weight = RepresentationMatrix_Dp(G, MDp);
7145 
7146  delete MDp;
7147 
7148  ring exring = currRing;
7149 
7150  if (rParameter(currRing) != NULL)
7151  DefRingPar(curr_weight);
7152  else
7153  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 5
7154  to=clock();
7155  Gw = idrMoveR(G, exring,currRing);
7156  G = MstdCC(Gw);
7157  Gw = NULL;
7158  tostd=tostd+clock()-to;
7159  //ivString(curr_weight,"rep. sigma");
7160  goto COMPUTE_NEW_VECTOR;
7161  }
7162 
7163  idDelete(&Gw);
7164  delete iv_dp;
7165 #endif
7166 
7167 
7168  while(1)
7169  {
7170  to=clock();
7171  /* compute an initial form ideal of <G> w.r.t. "curr_vector" */
7172  Gomega = MwalkInitialForm(G, curr_weight);
7173  tif=tif+clock()-to;
7174 
7175 #ifndef BUCHBERGER_ALG
7176  if(isNolVector(curr_weight) == 0)
7177  hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
7178  else
7179  hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
7180 #endif // BUCHBERGER_ALG
7181 
7182  oldRing = currRing;
7183 
7184  /* define a new ring that its ordering is "(a(curr_weight),lp) */
7185  if (rParameter(currRing) != NULL)
7186  DefRingPar(curr_weight);
7187  else
7188  rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 6
7189 
7190  newRing = currRing;
7191  Gomega1 = idrMoveR(Gomega, oldRing,currRing);
7192 
7193  to=clock();
7194  /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */
7195 #ifdef BUCHBERGER_ALG
7196  M = MstdhomCC(Gomega1);
7197 #else
7198  M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
7199  delete hilb_func;
7200 #endif // BUCHBERGER_ALG
7201  tstd=tstd+clock()-to;
7202 
7203  /* change the ring to oldRing */
7204  rChangeCurrRing(oldRing);
7205  M1 = idrMoveR(M, newRing,currRing);
7206  Gomega2 = idrMoveR(Gomega1, newRing,currRing);
7207 
7208  to=clock();
7209  /* compute a representation of the generators of submod (M)
7210  with respect to those of mod (Gomega).
7211  Gomega is a reduced Groebner basis w.r.t. the current ring */
7212  F = MLifttwoIdeal(Gomega2, M1, G);
7213  tlift=tlift+clock()-to;
7214 
7215  idDelete(&M1);
7216  idDelete(&Gomega2);
7217  idDelete(&G);
7218 
7219  /* change the ring to newRing */
7220  rChangeCurrRing(newRing);
7221  F1 = idrMoveR(F, oldRing,currRing);
7222 
7223  to=clock();
7224  /* reduce the Groebner basis <G> w.r.t. new ring */
7225  G = kInterRedCC(F1, NULL);
7226  tred=tred+clock()-to;
7227  idDelete(&F1);
7228 
7229 
7230  COMPUTE_NEW_VECTOR:
7231  newRing = currRing;
7232  nwalk++;
7233  nwalkpert++;
7234  to=clock();
7235  // compute a next weight vector
7236  next_weight = MwalkNextWeightCC(curr_weight,target_weight, G);
7237  tnw=tnw+clock()-to;
7238 #ifdef PRINT_VECTORS
7239  MivString(curr_weight, target_weight, next_weight);
7240 #endif
7241 
7242 
7243  /* check whether the computed intermediate weight vector is in
7244  the correct cone; sometimes it is very big e.g. s7, cyc7.
7245  If it is NOT in the correct cone, then compute directly
7246  a reduced Groebner basis with respect to the lexicographic ordering
7247  for the known Groebner basis that it is computed in the last step.
7248  */
7249  //if(test_w_in_ConeCC(G, next_weight) != 1)
7250  if(Overflow_Error == TRUE)
7251  {
7252  OMEGA_OVERFLOW_TRAN_NEW:
7253  //Print("\n// takes %d steps!", nwalk-1);
7254  //Print("\n//ring lastRing = %s;", rString(currRing));
7255 #ifdef TEST_OVERFLOW
7256  goto BE_FINISH;
7257 #endif
7258 
7259 #ifdef CHECK_IDEAL_MWALK
7260  idElements(G, "G");
7261  //headidString(G, "G");
7262 #endif
7263 
7264  if(MivSame(target_tmp, iv_lp) == 1)
7265  if (rParameter(currRing) != NULL)
7266  DefRingParlp();
7267  else
7268  VMrDefaultlp();
7269  else
7270  if (rParameter(currRing) != NULL)
7271  DefRingPar(target_tmp);
7272  else
7273  rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 8
7274 
7275  lpRing = currRing;
7276  G1 = idrMoveR(G, newRing,currRing);
7277 
7278  to=clock();
7279  /*apply kStd or LastGB to compute a lex. red. Groebner basis of <G>*/
7280  if(nP == 0 || MivSame(target_tmp, iv_lp) == 0){
7281  //Print("\n\n// calls \"std in ring r_%d = %s;", nwalk, rString(currRing));
7282  G = MstdCC(G1);//no result for qnt1
7283  }
7284  else {
7285  rChangeCurrRing(newRing);
7286  G1 = idrMoveR(G1, lpRing,currRing);
7287 
7288  //Print("\n\n// calls \"LastGB\" (%d) to compute a GB", nV-1);
7289  G = LastGB(G1, curr_weight, nV-1); //no result for kats7
7290 
7291  rChangeCurrRing(lpRing);
7292  G = idrMoveR(G, newRing,currRing);
7293  }
7294  textra=clock()-to;
7295  npert[endwalks]=nwalk-npert_tmp;
7296  npert_tmp = nwalk;
7297  endwalks ++;
7298  break;
7299  }
7300 
7301  /* check whether the computed Groebner basis is really a Groebner basis.
7302  If not, we perturb the target vector with the maximal "perturbation"
7303  degree.*/
7304  if(MivComp(next_weight, target_weight) == 1 ||
7305  MivComp(next_weight, curr_weight) == 1 )
7306  {
7307  //Print("\n//ring r_%d = %s;", nwalk, rString(currRing));
7308 
7309 
7310  //compute the number of perturbations and its step
7311  npert[endwalks]=nwalk-npert_tmp;
7312  npert_tmp = nwalk;
7313 
7314  endwalks ++;
7315 
7316  /*it is very important if the walk only uses one step, e.g. Fate, liu*/
7317  if(endwalks == 1 && MivComp(next_weight, curr_weight) == 1){
7318  rChangeCurrRing(XXRing);
7319  G = idrMoveR(G, newRing,currRing);
7320  goto FINISH;
7321  }
7322  H0 = id_Head(G,currRing);
7323 
7324  if(MivSame(target_tmp, iv_lp) == 1)
7325  if (rParameter(currRing) != NULL)
7326  DefRingParlp();
7327  else
7328  VMrDefaultlp();
7329  else
7330  if (rParameter(currRing) != NULL)
7331  DefRingPar(target_tmp);
7332  else
7333  rChangeCurrRing(VMrDefault(target_tmp)); //Aenderung 9
7334 
7335  lpRing = currRing;
7336  Glp = idrMoveR(G, newRing,currRing);
7337  H2 = idrMoveR(H0, newRing,currRing);
7338 
7339  /* Apply Lemma 2.2 in Collart et. al (1997) to check whether
7340  cone(k-1) is equal to cone(k) */
7341  nGB = 1;
7342  for(i=IDELEMS(Glp)-1; i>=0; i--)
7343  {
7344  poly t;
7345  if((t=pSub(pHead(Glp->m[i]), pCopy(H2->m[i]))) != NULL)
7346  {
7347  pDelete(&t);
7348  idDelete(&H2);//5.5.02
7349  nGB = 0; //i.e. Glp is no reduced Groebner basis
7350  break;
7351  }
7352  pDelete(&t);
7353  }
7354 
7355  idDelete(&H2);//5.5.02
7356 
7357  if(nGB == 1)
7358  {
7359  G = Glp;
7360  Glp = NULL;
7361  break;
7362  }
7363 
7364  /* perturb the target weight vector, if the vector target_tmp
7365  stays in many cones */
7366  poly p;
7367  BOOLEAN plength3 = FALSE;
7368  for(i=IDELEMS(Glp)-1; i>=0; i--)
7369  {
7370  p = MpolyInitialForm(Glp->m[i], target_tmp);
7371  if(p->next != NULL &&
7372  p->next->next != NULL &&
7373  p->next->next->next != NULL)
7374  {
7376 
7377  for(i=0; i<nV; i++)
7378  (*vector_tmp)[i] = (*target_weight)[i];
7379 
7380  delete target_weight;
7381  target_weight = MPertVectors(Glp, Mlp, nV);
7382 
7383  if(MivComp(vector_tmp, target_weight)==1)
7384  {
7385  //PrintS("\n// The old and new representaion vector are the same!!");
7386  G = Glp;
7387  newRing = currRing;
7388  goto OMEGA_OVERFLOW_TRAN_NEW;
7389  }
7390 
7391  if(Overflow_Error == TRUE)
7392  {
7393  rChangeCurrRing(newRing);
7394  G = idrMoveR(Glp, lpRing,currRing);
7395  goto OMEGA_OVERFLOW_TRAN_NEW;
7396  }
7397 
7398  plength3 = TRUE;
7399  pDelete(&p);
7400  break;
7401  }
7402  pDelete(&p);
7403  }
7404 
7405  if(plength3 == FALSE)
7406  {
7407  rChangeCurrRing(newRing);
7408  G = idrMoveR(Glp, lpRing,currRing);
7409  goto TRAN_LIFTING;
7410  }
7411 
7412 
7413  npertstep = nwalk;
7414  nwalkpert = 1;
7415  nsteppert ++;
7416 
7417  /*
7418  Print("\n// Subroutine needs (%d) steps.", nwalk);
7419  idElements(Glp, "last G in walk:");
7420  PrintS("\n// ****************************************");
7421  Print("\n// Perturb the original target vector (%d): ", nsteppert);
7422  ivString(target_weight, "new target");
7423  PrintS("\n// ****************************************\n");
7424  */
7425  rChangeCurrRing(newRing);
7426  G = idrMoveR(Glp, lpRing,currRing);
7427 
7428  delete next_weight;
7429 
7430  //Print("\n// ring rNEW = %s;", rString(currRing));
7431  goto COMPUTE_NEW_VECTOR;
7432  }
7433 
7434  TRAN_LIFTING:
7435  for(i=nV-1; i>=0; i--)
7436  (*curr_weight)[i] = (*next_weight)[i];
7437 
7438  delete next_weight;
7439  }//while
7440 #ifdef TEST_OVERFLOW
7441  BE_FINISH:
7442 #endif
7443  rChangeCurrRing(XXRing);
7444  G = idrMoveR(G, lpRing,currRing);
7445 
7446  FINISH:
7447  delete ivNull;
7448  delete next_weight;
7449  delete iv_lp;
7450  omFree(npert);
7451 
7452 #ifdef TIME_TEST
7453  Print("\n// Computation took %d steps and %.2f sec",
7454  nwalk, ((double) (clock()-mtim)/1000000));
7455 
7456  TimeStringFractal(tinput, tostd, tif, tstd, textra, tlift, tred, tnw);
7457 
7458  Print("\n// pSetm_Error = (%d)", ErrorCheck());
7459  Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
7460 #endif
7461 
7462  return(G);
7463 }
static ideal MLifttwoIdeal(ideal Gw, ideal M, ideal G)
Definition: walk.cc:1736
BOOLEAN ErrorCheck()
#define Print
Definition: emacs.cc:83
static int MivComp(intvec *iva, intvec *ivb)
Definition: walk.cc:1813
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1416
static ideal LastGB(ideal G, intvec *curr_weight, int tp_deg)
Definition: walk.cc:2986
static poly MpolyInitialForm(poly g, intvec *curr_weight)
Definition: walk.cc:699
#define TRUE
Definition: auxiliary.h:144
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:2221
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:573
static TreeM * G
Definition: janet.cc:38
void Set_Error(BOOLEAN f)
Definition: walk.cc:94
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN Overflow_Error
Definition: walk.cc:96
static void VMrDefaultlp(void)
Definition: walk.cc:2748
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
clock_t to
Definition: walk.cc:99
Definition: intvec.h:16
#define pSub(a, b)
Definition: polys.h:258
static int islengthpoly2(ideal G)
Definition: walk.cc:3287
#define omFree(addr)
Definition: omAllocDecl.h:261
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
static intvec * MwalkNextWeightCC(intvec *curr_weight, intvec *target_weight, ideal G)
Definition: walk.cc:1865
int i
Definition: cfEzgcd.cc:123
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
static ideal MstdhomCC(ideal G)
Definition: walk.cc:922
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void DefRingParlp(void)
Definition: walk.cc:2881
static ideal MstdCC(ideal G)
Definition: walk.cc:907
#define NULL
Definition: omList.c:10
static void DefRingPar(intvec *va)
Definition: walk.cc:2811
static ideal kInterRedCC(ideal F, ideal Q)
Definition: walk.cc:275
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
#define pDelete(p_ptr)
Definition: polys.h:157
intvec * MivUnit(int nV)
Definition: walk.cc:1476
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1299
polyrec * poly
Definition: hilb.h:10
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
int BOOLEAN
Definition: auxiliary.h:131
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
intvec * Mivlp(int nR)
Definition: walk.cc:995
static ring VMrDefault(intvec *va)
Definition: walk.cc:2360
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
static ring VMatrDefault ( intvec va)
static

Definition at line 2588 of file walk.cc.

2589 {
2590 
2591  if ((currRing->ppNoether)!=NULL)
2592  {
2593  pDelete(&(currRing->ppNoether));
2594  }
2597  {
2599  }
2600 
2601  ring r = (ring) omAlloc0Bin(sip_sring_bin);
2602  int i, nv = currRing->N;
2603 
2604  r->cf = currRing->cf;
2605  r->N = currRing->N;
2606 
2607  int nb = 4;
2608 
2609  //names
2610  char* Q; // In order to avoid the corrupted memory, do not change.
2611  r->names = (char **) omAlloc0(nv * sizeof(char_ptr));
2612  for(i=0; i<nv; i++)
2613  {
2614  Q = currRing->names[i];
2615  r->names[i] = omStrDup(Q);
2616  }
2617 
2618  /*weights: entries for 3 blocks: NULL Made:???*/
2619  r->wvhdl = (int **)omAlloc0(nb * sizeof(int_ptr));
2620  r->wvhdl[0] = (int*) omAlloc(nv*nv*sizeof(int));
2621  r->wvhdl[1] =NULL; // (int*) omAlloc(nv*sizeof(int));
2622  r->wvhdl[2]=NULL;
2623  r->wvhdl[3]=NULL;
2624  for(i=0; i<nv*nv; i++)
2625  r->wvhdl[0][i] = (*va)[i];
2626 
2627  /* order: a,lp,C,0 */
2628  r->order = (int *) omAlloc(nb * sizeof(int *));
2629  r->block0 = (int *)omAlloc0(nb * sizeof(int *));
2630  r->block1 = (int *)omAlloc0(nb * sizeof(int *));
2631 
2632  // ringorder a for the first block: var 1..nv
2633  r->order[0] = ringorder_M;
2634  r->block0[0] = 1;
2635  r->block1[0] = nv;
2636 
2637  // ringorder C for the second block
2638  r->order[1] = ringorder_C;
2639  r->block0[1] = 1;
2640  r->block1[1] = nv;
2641 
2642 
2643 // ringorder C for the third block: var 1..nv
2644  r->order[2] = ringorder_C;
2645  r->block0[2] = 1;
2646  r->block1[2] = nv;
2647 
2648 
2649  // the last block: everything is 0
2650  r->order[3] = 0;
2651 
2652  // polynomial ring
2653  r->OrdSgn = 1;
2654 
2655  // complete ring intializations
2656 
2657  rComplete(r);
2658 
2659  //rChangeCurrRing(r);
2660  return r;
2661 }
Definition: lists.h:22
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char * char_ptr
Definition: structs.h:56
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
Definition: tok.h:96
int * int_ptr
Definition: structs.h:57
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263
static ring VMatrRefine ( intvec va,
intvec vb 
)
static

Definition at line 2666 of file walk.cc.

2667 {
2668 
2669  if ((currRing->ppNoether)!=NULL)
2670  {
2671  pDelete(&(currRing->ppNoether));
2672  }
2675  {
2677  }
2678 
2679  ring r = (ring) omAlloc0Bin(sip_sring_bin);
2680  int i, nv = currRing->N;
2681  int nvs = nv*nv;
2682  r->cf = currRing->cf;
2683  r->N = currRing->N;
2684 
2685  int nb = 4;
2686 
2687  //names
2688  char* Q; // In order to avoid the corrupted memory, do not change.
2689  r->names = (char **) omAlloc0(nv * sizeof(char_ptr));
2690  for(i=0; i<nv; i++)
2691  {
2692  Q = currRing->names[i];
2693  r->names[i] = omStrDup(Q);
2694  }
2695 
2696  /*weights: entries for 3 blocks: NULL Made:???*/
2697  r->wvhdl = (int **)omAlloc0(nb * sizeof(int_ptr));
2698  r->wvhdl[0] = (int*) omAlloc(nv*sizeof(int));
2699  r->wvhdl[1] = (int*) omAlloc(nvs*sizeof(int));
2700  r->wvhdl[2]=NULL;
2701  r->wvhdl[3]=NULL;
2702  for(i=0; i<nvs; i++)
2703  {
2704  r->wvhdl[1][i] = (*va)[i];
2705  }
2706  for(i=0; i<nv; i++)
2707  {
2708  r->wvhdl[0][i] = (*vb)[i];
2709  }
2710  /* order: a,lp,C,0 */
2711  r->order = (int *) omAlloc(nb * sizeof(int *));
2712  r->block0 = (int *)omAlloc0(nb * sizeof(int *));
2713  r->block1 = (int *)omAlloc0(nb * sizeof(int *));
2714 
2715  // ringorder a for the first block: var 1..nv
2716  r->order[0] = ringorder_a;
2717  r->block0[0] = 1;
2718  r->block1[0] = nv;
2719 
2720  // ringorder M for the second block: var 1..nv
2721  r->order[1] = ringorder_M;
2722  r->block0[1] = 1;
2723  r->block1[1] = nv;
2724 
2725  // ringorder C for the third block: var 1..nv
2726  r->order[2] = ringorder_C;
2727  r->block0[2] = 1;
2728  r->block1[2] = nv;
2729 
2730 
2731  // the last block: everything is 0
2732  r->order[3] = 0;
2733 
2734  // polynomial ring
2735  r->OrdSgn = 1;
2736 
2737  // complete ring intializations
2738 
2739  rComplete(r);
2740 
2741  //rChangeCurrRing(r);
2742  return r;
2743 }
Definition: lists.h:22
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char * char_ptr
Definition: structs.h:56
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
Definition: tok.h:96
int * int_ptr
Definition: structs.h:57
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263
static ring VMrDefault ( intvec va)
static

Definition at line 2360 of file walk.cc.

2361 {
2362 
2363  if ((currRing->ppNoether)!=NULL)
2364  {
2365  pDelete(&(currRing->ppNoether));
2366  }
2369  {
2371  }
2372 
2373  ring r = (ring) omAlloc0Bin(sip_sring_bin);
2374  int i, nv = currRing->N;
2375 
2376  r->cf = currRing->cf;
2377  r->N = currRing->N;
2378 
2379  int nb = 4;
2380 
2381  //names
2382  char* Q; // In order to avoid the corrupted memory, do not change.
2383  r->names = (char **) omAlloc0(nv * sizeof(char_ptr));
2384  for(i=0; i<nv; i++)
2385  {
2386  Q = currRing->names[i];
2387  r->names[i] = omStrDup(Q);
2388  }
2389 
2390  /*weights: entries for 3 blocks: NULL Made:???*/
2391  r->wvhdl = (int **)omAlloc0(nb * sizeof(int_ptr));
2392  r->wvhdl[0] = (int*) omAlloc(nv*sizeof(int));
2393  for(i=0; i<nv; i++)
2394  r->wvhdl[0][i] = (*va)[i];
2395 
2396  /* order: a,lp,C,0 */
2397  r->order = (int *) omAlloc(nb * sizeof(int *));
2398  r->block0 = (int *)omAlloc0(nb * sizeof(int *));
2399  r->block1 = (int *)omAlloc0(nb * sizeof(int *));
2400 
2401  // ringorder a for the first block: var 1..nv
2402  r->order[0] = ringorder_a;
2403  r->block0[0] = 1;
2404  r->block1[0] = nv;
2405 
2406  // ringorder lp for the second block: var 1..nv
2407  r->order[1] = ringorder_lp;
2408  r->block0[1] = 1;
2409  r->block1[1] = nv;
2410 
2411  // ringorder C for the third block
2412  // it is very important within "idLift",
2413  // especially, by ring syz_ring=rCurrRingAssure_SyzComp();
2414  // therefore, nb must be (nBlocks(currRing) + 1)
2415  r->order[2] = ringorder_C;
2416 
2417  // the last block: everything is 0
2418  r->order[3] = 0;
2419 
2420  // polynomial ring
2421  r->OrdSgn = 1;
2422 
2423  // complete ring intializations
2424 
2425  rComplete(r);
2426  return r;
2427  //rChangeCurrRing(r);
2428 }
Definition: lists.h:22
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char * char_ptr
Definition: structs.h:56
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
Definition: tok.h:96
int * int_ptr
Definition: structs.h:57
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263
static ring VMrDefault1 ( intvec va)
static

Definition at line 2430 of file walk.cc.

2431 {
2432 
2433  if ((currRing->ppNoether)!=NULL)
2434  {
2435  pDelete(&(currRing->ppNoether));
2436  }
2439  {
2441  }
2442 
2443  ring r = (ring) omAlloc0Bin(sip_sring_bin);
2444  int i, nv = currRing->N;
2445 
2446  r->cf = currRing->cf;
2447  r->N = currRing->N;
2448 
2449  int nb = 4;
2450 
2451  //names
2452  char* Q; // In order to avoid the corrupted memory, do not change.
2453  r->names = (char **) omAlloc0(nv * sizeof(char_ptr));
2454  for(i=0; i<nv; i++)
2455  {
2456  Q = currRing->names[i];
2457  r->names[i] = omStrDup(Q);
2458  }
2459 
2460  /*weights: entries for 3 blocks: NULL Made:???*/
2461  r->wvhdl = (int **)omAlloc0(nb * sizeof(int_ptr));
2462  r->wvhdl[0] = (int*) omAlloc(nv*sizeof(int));
2463  for(i=0; i<nv; i++)
2464  r->wvhdl[0][i] = (*va)[i];
2465 
2466  /* order: a,lp,C,0 */
2467  r->order = (int *) omAlloc(nb * sizeof(int *));
2468  r->block0 = (int *)omAlloc0(nb * sizeof(int *));
2469  r->block1 = (int *)omAlloc0(nb * sizeof(int *));
2470 
2471  // ringorder a for the first block: var 1..nv
2472  r->order[0] = ringorder_a;
2473  r->block0[0] = 1;
2474  r->block1[0] = nv;
2475 
2476  // ringorder lp for the second block: var 1..nv
2477  r->order[1] = ringorder_lp;
2478  r->block0[1] = 1;
2479  r->block1[1] = nv;
2480 
2481  // ringorder C for the third block
2482  // it is very important within "idLift",
2483  // especially, by ring syz_ring=rCurrRingAssure_SyzComp();
2484  // therefore, nb must be (nBlocks(currRing) + 1)
2485  r->order[2] = ringorder_C;
2486 
2487  // the last block: everything is 0
2488  r->order[3] = 0;
2489 
2490  // polynomial ring
2491  r->OrdSgn = 1;
2492 
2493  // complete ring intializations
2494 
2495  rComplete(r);
2496 
2497  //rChangeCurrRing(r);
2498  return r;
2499 }
Definition: lists.h:22
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char * char_ptr
Definition: structs.h:56
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
Definition: tok.h:96
int * int_ptr
Definition: structs.h:57
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263
static void VMrDefaultlp ( void  )
static

Definition at line 2748 of file walk.cc.

2749 {
2750 
2751  if ((currRing->ppNoether)!=NULL)
2752  {
2753  pDelete(&(currRing->ppNoether));
2754  }
2757 
2758  {
2760  }
2761 
2762  ring r = (ring) omAlloc0Bin(sip_sring_bin);
2763  int i, nv = currRing->N;
2764 
2765  r->cf = currRing->cf;
2766  r->N = currRing->N;
2767  int nb = rBlocks(currRing) + 1;
2768 
2769  // names
2770  char* Q; // to avoid the corrupted memory, do not change!!
2771  r->names = (char **) omAlloc0(nv * sizeof(char_ptr));
2772  for(i=0; i<nv; i++)
2773  {
2774  Q = currRing->names[i];
2775  r->names[i] = omStrDup(Q);
2776  }
2777 
2778  /*weights: entries for 3 blocks: NULL Made:???*/
2779 
2780  r->wvhdl = (int **)omAlloc0(nb * sizeof(int_ptr));
2781 
2782  /* order: lp,C,0 */
2783  r->order = (int *) omAlloc(nb * sizeof(int *));
2784  r->block0 = (int *)omAlloc0(nb * sizeof(int *));
2785  r->block1 = (int *)omAlloc0(nb * sizeof(int *));
2786 
2787  /* ringorder lp for the first block: var 1..nv */
2788  r->order[0] = ringorder_lp;
2789  r->block0[0] = 1;
2790  r->block1[0] = nv;
2791 
2792  /* ringorder C for the second block */
2793  r->order[1] = ringorder_C;
2794 
2795  /* the last block: everything is 0 */
2796  r->order[2] = 0;
2797 
2798  /*polynomial ring*/
2799  r->OrdSgn = 1;
2800 
2801  /* complete ring intializations */
2802 
2803  rComplete(r);
2804 
2805  rChangeCurrRing(r);
2806 }
Definition: lists.h:22
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char * char_ptr
Definition: structs.h:56
static int rBlocks(ring r)
Definition: ring.h:516
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
void rChangeCurrRing(ring r)
Definition: polys.cc:14
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
Definition: tok.h:96
int * int_ptr
Definition: structs.h:57
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263
static ring VMrRefine ( intvec va,
intvec vb 
)
static

Definition at line 2505 of file walk.cc.

2506 {
2507 
2508  if ((currRing->ppNoether)!=NULL)
2509  {
2510  pDelete(&(currRing->ppNoether));
2511  }
2514  {
2516  }
2517 
2518  ring r = (ring) omAlloc0Bin(sip_sring_bin);
2519  int i, nv = currRing->N;
2520 
2521  r->cf = currRing->cf;
2522  r->N = currRing->N;
2523  //int nb = nBlocks(currRing) + 1;
2524  int nb = 4;
2525 
2526  //names
2527  char* Q; // In order to avoid the corrupted memory, do not change.
2528  r->names = (char **) omAlloc0(nv * sizeof(char_ptr));
2529  for(i=0; i<nv; i++)
2530  {
2531  Q = currRing->names[i];
2532  r->names[i] = omStrDup(Q);
2533  }
2534 
2535  //weights: entries for 3 blocks: NULL Made:???
2536  r->wvhdl = (int **)omAlloc0(nb * sizeof(int_ptr));
2537  r->wvhdl[0] = (int*) omAlloc(nv*sizeof(int));
2538  r->wvhdl[1] = (int*) omAlloc(nv*sizeof(int));
2539 
2540  for(i=0; i<nv; i++)
2541  {
2542  r->wvhdl[0][i] = (*va)[i];
2543  r->wvhdl[1][i] = (*vb)[i];
2544  }
2545  r->wvhdl[2]=NULL;
2546  r->wvhdl[3]=NULL;
2547 
2548  // order: (1..1),a,lp,C
2549  r->order = (int *) omAlloc(nb * sizeof(int *));
2550  r->block0 = (int *)omAlloc0(nb * sizeof(int *));
2551  r->block1 = (int *)omAlloc0(nb * sizeof(int *));
2552 
2553  // ringorder a for the first block: var 1..nv
2554  r->order[0] = ringorder_a;
2555  r->block0[0] = 1;
2556  r->block1[0] = nv;
2557 
2558  // ringorder Wp for the second block: var 1..nv
2559  r->order[1] = ringorder_Wp;
2560  r->block0[1] = 1;
2561  r->block1[1] = nv;
2562 
2563  // ringorder lp for the third block: var 1..nv
2564  r->order[2] = ringorder_C;
2565  r->block0[2] = 1;
2566  r->block1[2] = nv;
2567 
2568  // ringorder C for the 4th block
2569  // it is very important within "idLift",
2570  // especially, by ring syz_ring=rCurrRingAssure_SyzComp();
2571  // therefore, nb must be (nBlocks(currRing) + 1)
2572  r->order[3] = 0;
2573 
2574  // polynomial ring
2575  r->OrdSgn = 1;
2576 
2577  // complete ring intializations
2578 
2579  rComplete(r);
2580 
2581  //rChangeCurrRing(r);
2582  return r;
2583 }
Definition: lists.h:22
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char * char_ptr
Definition: structs.h:56
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
Definition: tok.h:96
int * int_ptr
Definition: structs.h:57
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263

Variable Documentation

int ngleich

Definition at line 4282 of file walk.cc.

int nnflow

Definition at line 6105 of file walk.cc.

int nstep

kstd2.cc

Definition at line 88 of file walk.cc.

BOOLEAN Overflow_Error = FALSE

Definition at line 96 of file walk.cc.

BOOLEAN pSetm_error

Definition at line 155 of file p_polys.cc.

clock_t to

Definition at line 99 of file walk.cc.

int Xcall

Definition at line 6106 of file walk.cc.

clock_t xftinput

Definition at line 99 of file walk.cc.

clock_t xftostd

Definition at line 99 of file walk.cc.

intvec* Xivinput

Definition at line 4286 of file walk.cc.

intvec* Xivlp

Definition at line 4287 of file walk.cc.

intvec* XivNull

Definition at line 6090 of file walk.cc.

int xn

Definition at line 4285 of file walk.cc.

int Xngleich

Definition at line 6107 of file walk.cc.

int Xnlev

Definition at line 1491 of file walk.cc.

intvec* Xsigma

Definition at line 4283 of file walk.cc.

intvec* Xtau

Definition at line 4284 of file walk.cc.

clock_t xtextra

Definition at line 99 of file walk.cc.

clock_t xtif

Definition at line 98 of file walk.cc.

clock_t xtlift

Definition at line 98 of file walk.cc.

clock_t xtnw

Definition at line 98 of file walk.cc.

clock_t xtred

Definition at line 98 of file walk.cc.

clock_t xtstd

Definition at line 98 of file walk.cc.