Changeset 8e682d in git


Ignore:
Timestamp:
Dec 3, 2014, 5:18:10 PM (10 years ago)
Author:
Stephan Oberfranz <oberfran@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b52fc4b2495505785981d640dcf7eb3e456778ef')
Children:
8af63a71de0015f0413204e1a7a8620a8d37cc7a
Parents:
41c9e458d3df4f560848651c9fc0710d72f703dc
Message:
---
Location:
Singular
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/grwalk.lib

    r41c9e4 r8e682d  
    346346}
    347347
    348 proc fwalk(ideal Go, int reduction, list #)
     348proc fwalk(ideal Go, int reduction, int printout, list #)
    349349"SYNTAX: fwalk(ideal i,int reductioin);
    350350         fwalk(ideal i, int reduction intvec v, intvec w);
     
    372372
    373373   ideal G = fetch(xR, Go);
    374    G = system("Mfwalk", G, curr_weight, target_weight, reduction);
     374   G = system("Mfwalk", G, curr_weight, target_weight, reduction, printout);
    375375
    376376   setring xR;
     
    388388    ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
    389389    int reduction = 1;
    390     fwalk(I,reduction);
     390    int printout = 1;
     391    fwalk(I,reduction,printout);
    391392}
    392393
  • Singular/LIB/rwalk.lib

    r41c9e4 r8e682d  
    1010rwalk(ideal,int,int[,intvec,intvec]);   standard basis of ideal via Random Walk algorithm
    1111rwalk(ideal,int[,intvec,intvec]);       standard basis of ideal via Random Perturbation Walk algorithm
    12 frwalk(ideal,int[,intvec,intvec]);      standard basis of ideal via Random Fractal Walk algorithm
     12frandwalk(ideal,int[,intvec,intvec]);      standard basis of ideal via Random Fractal Walk algorithm
    1313";
    1414
     
    270270 * Fractal Walk with random element *
    271271 ************************************/
    272 proc frandwalk(ideal Go, int radius, list #)
    273 "SYNTAX: frwalk(ideal i, int radius);
    274          frwalk(ideal i, int radius, intvec v, intvec w);
     272proc frandwalk(ideal Go, int radius, int reduction, int printout, list #)
     273"SYNTAX: frwalk(ideal i, int radius, int reduction, int printout);
     274         frwalk(ideal i, int radius, int reduction, int printout, intvec v, intvec w);
    275275TYPE:    ideal
    276276PURPOSE: compute the standard basis of the ideal, calculated via
     
    306306   ideal G = fetch(xR, Go);
    307307   int pert_deg = 2;
    308    G = system("Mfrwalk", G, curr_weight, target_weight, radius);
     308
     309   G = system("Mfrwalk", G, curr_weight, target_weight, radius, reduction, printout);
    309310
    310311   setring xR;
     
    322323    ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
    323324    int reduction = 0;
    324     frandwalk(I,2,0);
    325 }
     325    frandwalk(I,2,0,1);
     326}
  • Singular/extra.cc

    r41c9e4 r8e682d  
    19361936    if (strcmp(sys_cmd, "Mfwalk") == 0)
    19371937    {
    1938       const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
     1938      const short t[]={5,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD};
    19391939      if (!iiCheckTypes(h,t,1)) return TRUE;
    19401940      if (((intvec*) h->next->Data())->length() != currRing->N &&
     
    19431943        Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
    19441944                 currRing->N);
    1945         return TRUE;
    1946       }
    1947       ideal arg1 = (ideal) h->Data();
    1948       intvec* arg2 = (intvec*) h->next->Data();
    1949       intvec* arg3 = (intvec*) h->next->next->Data();
    1950       int arg4 = (int)(long) h->next->next->next->Data();
    1951       ideal result = (ideal) Mfwalk(arg1, arg2, arg3, arg4);
    1952       res->rtyp = IDEAL_CMD;
    1953       res->data =  result;
    1954       return FALSE;
    1955     }
    1956     else
    1957   #endif
    1958   /*==================== Mfrwalk =================*/
    1959   #ifdef HAVE_WALK
    1960     if (strcmp(sys_cmd, "Mfrwalk") == 0)
    1961     {
    1962       const short t[]={5,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD};
    1963       if (!iiCheckTypes(h,t,1)) return TRUE;
    1964       if (((intvec*) h->next->Data())->length() != currRing->N &&
    1965           ((intvec*) h->next->next->Data())->length() != currRing->N)
    1966       {
    1967         Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N);
    19681945        return TRUE;
    19691946      }
     
    19731950      int arg4 = (int)(long) h->next->next->next->Data();
    19741951      int arg5 = (int)(long) h->next->next->next->next->Data();
    1975       ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4, arg5);
     1952      ideal result = (ideal) Mfwalk(arg1, arg2, arg3, arg4, arg5);
     1953      res->rtyp = IDEAL_CMD;
     1954      res->data =  result;
     1955      return FALSE;
     1956    }
     1957    else
     1958  #endif
     1959  /*==================== Mfrwalk =================*/
     1960  #ifdef HAVE_WALK
     1961    if (strcmp(sys_cmd, "Mfrwalk") == 0)
     1962    {
     1963      const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD};
     1964      if (!iiCheckTypes(h,t,1)) return TRUE;
     1965/*
     1966      if (((intvec*) h->next->Data())->length() != currRing->N &&
     1967          ((intvec*) h->next->next->Data())->length() != currRing->N)
     1968      {
     1969        Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N);
     1970        return TRUE;
     1971      }
     1972*/
     1973      if((((intvec*) h->next->Data())->length() != currRing->N &&
     1974         ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
     1975         (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
     1976         ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
     1977      {
     1978        Werror("system(\"Mfrwalk\" ...) intvecs not of length %d or %d\n",
     1979               currRing->N,(currRing->N)*(currRing->N));
     1980        return TRUE;
     1981      }
     1982
     1983      ideal arg1 = (ideal) h->Data();
     1984      intvec* arg2 = (intvec*) h->next->Data();
     1985      intvec* arg3 = (intvec*) h->next->next->Data();
     1986      int arg4 = (int)(long) h->next->next->next->Data();
     1987      int arg5 = (int)(long) h->next->next->next->next->Data();
     1988      int arg6 = (int)(long) h->next->next->next->next->next->Data();
     1989      ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4, arg5, arg6);
    19761990      res->rtyp = IDEAL_CMD;
    19771991      res->data =  result;
  • Singular/walk.cc

    r41c9e4 r8e682d  
    985985}
    986986
    987 /*****************************************************************************
    988 * create a weight matrix order as intvec of an extra weight vector (a(iv),lp)*
    989 ******************************************************************************/
     987/*********************************************************************************
     988* create a weight matrix order as intvec of an extra weight vector (a(iv),M(iw)) *
     989**********************************************************************************/
    990990intvec* MivMatrixOrderRefine(intvec* iv, intvec* iw)
    991991{
    992   assume(iv->length() == iw->length());
    993   int i, nR = iv->length();
     992  assume((iv->length())*(iv->length()) == iw->length());
     993  int i,j, nR = iv->length();
    994994 
    995995  intvec* ivm = new intvec(nR*nR);
     
    998998  {
    999999    (*ivm)[i] = (*iv)[i];
    1000     (*ivm)[i+nR] = (*iw)[i];
    1001   }
    1002   for(i=2; i<nR; i++)
    1003   {
    1004     (*ivm)[i*nR+i-2] = 1;
     1000  }
     1001  for(i=1; i<nR; i++)
     1002  {
     1003    for(j=0; j<nR; j++)
     1004    {
     1005      (*ivm)[j+i*nR] = (*iw)[j+i*nR];
     1006    }
    10051007  }
    10061008  return ivm;
     
    24542456  //rChangeCurrRing(r);
    24552457}
    2456 
     2458//unused
     2459#if 0
    24572460static ring VMrDefault1(intvec* va)
    24582461{
     
    25252528  return r;
    25262529}
    2527 
     2530#endif
    25282531/****************************************************************
    25292532 * define and execute a new ring with ordering (a(va),Wp(vb),C) *
     
    43144317intvec* Xivlp;
    43154318
    4316 #if 0
    4317 /********************************
    4318  * compute a next weight vector *
    4319  ********************************/
    4320 static intvec* MWalkRandomNextWeight(ideal G, intvec* curr_weight, intvec* target_weight, int weight_rad, int pert_deg)
    4321 {
    4322   int i, weight_norm;
    4323   int nV = currRing->N;
    4324   intvec* next_weight2;
    4325   intvec* next_weight22 = new intvec(nV);
    4326   intvec* next_weight = MwalkNextWeightCC(curr_weight,target_weight, G);
    4327   if(MivComp(next_weight, target_weight) == 1)
    4328   {
    4329     return(next_weight);
    4330   }
    4331   else
    4332   {
    4333     //compute a perturbed next weight vector "next_weight1"
    4334     intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G, MivMatrixOrder(curr_weight), pert_deg), target_weight, G);
    4335     //Print("\n // size of next_weight1 = %d", sizeof((*next_weight1)));
    4336 
    4337     //compute a random next weight vector "next_weight2"
    4338     while(1)
    4339     {
    4340       weight_norm = 0;
    4341       while(weight_norm == 0)
    4342       {
    4343         for(i=0; i<nV; i++)
    4344         {
    4345           //Print("\n//  next_weight[%d]  = %d", i, (*next_weight)[i]);
    4346           (*next_weight22)[i] = rand() % 60000 - 30000;
    4347           weight_norm = weight_norm + (*next_weight22)[i]*(*next_weight22)[i];
    4348         }
    4349         weight_norm = 1 + floor(sqrt(weight_norm));
    4350       }
    4351 
    4352       for(i=nV-1; i>=0; i--)
    4353       {
    4354         if((*next_weight22)[i] < 0)
    4355         {
    4356           (*next_weight22)[i] = 1 + (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);
    4357         }
    4358         else
    4359         {
    4360           (*next_weight22)[i] = (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);
    4361         }
    4362       //Print("\n//  next_weight22[%d]  = %d", i, (*next_weight22)[i]);
    4363       }
    4364 
    4365       if(test_w_in_ConeCC(G, next_weight22) == 1)
    4366       {
    4367         //Print("\n//MWalkRandomNextWeight: next_weight2 im Kegel\n");
    4368         next_weight2 = MkInterRedNextWeight(next_weight22, target_weight, G);
    4369         delete next_weight22;
    4370         break;
    4371       }
    4372     }
    4373     intvec* result = new intvec(nV);
    4374     ideal G_test = MwalkInitialForm(G, next_weight);
    4375     ideal G_test1 = MwalkInitialForm(G, next_weight1);
    4376     ideal G_test2 = MwalkInitialForm(G, next_weight2);
    4377 
    4378     // compare next_weights
    4379     if(IDELEMS(G_test1) < IDELEMS(G_test))
    4380     {
    4381       if(IDELEMS(G_test2) <= IDELEMS(G_test1)) // |G_test2| <= |G_test1| < |G_test|
    4382       {
    4383         for(i=0; i<nV; i++)
    4384         {
    4385           (*result)[i] = (*next_weight2)[i];
    4386         }
    4387       }
    4388       else // |G_test1| < |G_test|, |G_test1| < |G_test2|
    4389       {
    4390         for(i=0; i<nV; i++)
    4391         {
    4392           (*result)[i] = (*next_weight1)[i];
    4393         }
    4394       }
    4395     }
    4396     else
    4397     {
    4398       if(IDELEMS(G_test2) <= IDELEMS(G_test)) // |G_test2| <= |G_test| <= |G_test1|
    4399       {
    4400         for(i=0; i<nV; i++)
    4401         {
    4402           (*result)[i] = (*next_weight2)[i];
    4403         }
    4404       }
    4405       else // |G_test| <= |G_test1|, |G_test| < |G_test2|
    4406       {
    4407         for(i=0; i<nV; i++)
    4408         {
    4409           (*result)[i] = (*next_weight)[i];
    4410         }
    4411       }
    4412     }
    4413     delete next_weight;
    4414     delete next_weight1;
    4415     idDelete(&G_test);
    4416     idDelete(&G_test1);
    4417     idDelete(&G_test2);
    4418     if(test_w_in_ConeCC(G, result) == 1)
    4419     {
    4420       delete next_weight2;
    4421       return result;
    4422     }
    4423     else
    4424     {
    4425       delete result;
    4426       return next_weight2;
    4427     }
    4428   }
    4429 }
    4430 #endif
    44314319
    44324320/********************************
     
    44434331
    44444332  //compute a perturbed next weight vector "next_weight1"
    4445   //intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G,MivMatrixOrderRefine(curr_weight,target_weight),pert_deg),target_weight,G);
    44464333  intvec* next_weight1 =MkInterRedNextWeight(curr_weight,target_weight,G);
    44474334  //compute a random next weight vector "next_weight2"
     
    51114998            ring baseRing, int reduction, int printout)
    51124999{
    5113   BITSET save1 = si_opt_1; // save current options
     5000  // save current options
     5001  BITSET save1 = si_opt_1;
    51145002  if(reduction == 0)
    51155003  {
    5116     si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
    5117     //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     5004    // no reduced Groebner basis
     5005    si_opt_1 &= (~Sy_bit(OPT_REDSB));
     5006    // not tail reductions
     5007    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL));
    51185008  }
    51195009  Set_Error(FALSE);
     
    51665056  to = clock();
    51675057#endif
    5168      if(orig_M->length() == nV)
    5169       {
    5170         newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
    5171       }
    5172       else
    5173       {
    5174         newRing = VMatrDefault(orig_M);
    5175       }
     5058  if(orig_M->length() == nV)
     5059  {
     5060    // define a new ring with ordering "(a(curr_weight),lp)
     5061    newRing = VMrDefault(curr_weight);
     5062  }
     5063  else
     5064  {
     5065    newRing = VMatrDefault(orig_M);
     5066  }
    51765067  rChangeCurrRing(newRing);
    51775068  ideal G = MstdCC(idrMoveR(Go,baseRing,currRing));
     
    51955086    }
    51965087//#endif
    5197     Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
     5088    // compute an initial form ideal of <G> w.r.t. "curr_vector"
     5089    Gomega = MwalkInitialForm(G, curr_weight);
    51985090#ifdef TIME_TEST
    5199     tif = tif + clock()-to; //time for computing initial form ideal
     5091    //time for computing initial form ideal
     5092    tif = tif + clock()-to;
    52005093#endif
    52015094//#ifdef CHECK_IDEAL_MWALK
     
    52195112      if(orig_M->length() == nV)
    52205113      {
    5221         newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
     5114        // define a new ring with ordering "(a(curr_weight),lp)
     5115        newRing = VMrDefault(curr_weight);
    52225116      }
    52235117      else
     
    52305124     if(target_M->length() == nV)
    52315125     {
    5232        newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
     5126       //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
     5127       newRing = VMrRefine(curr_weight,target_weight);
    52335128     }
    52345129     else
    52355130     {
     5131       //define a new ring with matrix ordering
    52365132       newRing = VMatrRefine(target_M,curr_weight);
    52375133     }
     
    52695165    to = clock();
    52705166#endif
    5271     // 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
     5167    // compute a representation of the generators of submod (M) with respect to those of mod (Gomega),
     5168    // where Gomega is a reduced Groebner basis w.r.t. the current ring
    52725169    F = MLifttwoIdeal(Gomega2, M1, G);
    52735170#ifdef TIME_TEST
     
    52895186    to = clock();
    52905187#endif
    5291     //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);
     5188
    52925189#ifdef TIME_TEST
    52935190    tstd = tstd + clock() - to;
     
    53135210    }
    53145211//#endif
    5315     if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1
    5316     {
    5317 #ifdef CHECK_IDEAL_MWALK
    5318       PrintS("\n//** Mwalk: entering last cone.\n");
    5319 #endif
     5212    if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1 || test_w_in_ConeCC(G, target_weight) == 1)
     5213    {
     5214//#ifdef CHECK_IDEAL_MWALK
     5215      if(printout > 0)
     5216      {
     5217        PrintS("\n//** Mwalk: entering last cone.\n");
     5218      }
     5219//#endif
    53205220      Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
    53215221      if(target_M->length() == nV)
     
    53665266      to = clock();
    53675267#endif
    5368 //   if(si_opt_1 == (Sy_bit(OPT_REDSB))){
    5369       G = kInterRedCC(G,NULL); //interreduce the Groebner basis <G> w.r.t. currRing
    5370 //  }
     5268      //interreduce the Groebner basis <G> w.r.t. currRing
     5269      G = kInterRedCC(G,NULL);
    53715270#ifdef TIME_TEST
    53725271      tred = tred + clock() - to;
     
    53865285  ideal result = idrMoveR(G,baseRing,currRing);
    53875286  idDelete(&G);
    5388 /*#ifdef CHECK_IDEAL_MWALK
    5389   pDelete(&p);
    5390 #endif*/
    53915287  delete tmp_weight;
    53925288  delete ivNull;
     
    54045300}
    54055301
    5406 // 07.11.2012
    54075302// THE RANDOM WALK ALGORITHM
    54085303ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg,
     
    66516546 * Perturb the start weight vector at the top level, i.e. nlev = 1     *
    66526547 ***********************************************************************/
    6653 static ideal rec_fractal_call(ideal G, int nlev, intvec* omtmp)
     6548static ideal rec_fractal_call(ideal G, int nlev, intvec* ivtarget, int printout)
    66546549{
    66556550  Overflow_Error =  FALSE;
     
    66686563  intvec* next_vect;
    66696564  intvec* omega2 = new intvec(nV);
     6565  intvec* omtmp = new intvec(nV);
    66706566  intvec* altomega = new intvec(nV);
    66716567
     6568  for(i = nV -1; i>0; i--)
     6569  {
     6570    (*omtmp)[i] = (*ivtarget)[i];
     6571  }
    66726572  //BOOLEAN isnewtarget = FALSE;
    66736573
     
    67106610    NEXT_VECTOR_FRACTAL:
    67116611    to=clock();
    6712     /* determine the next border */
     6612    // determine the next border
    67136613    next_vect = MkInterRedNextWeight(omega,omega2,G);
    67146614    xtnw=xtnw+clock()-to;
    6715 #ifdef PRINT_VECTORS
    6716     MivString(omega, omega2, next_vect);
    6717 #endif
     6615
    67186616    oRing = currRing;
    67196617
    6720     /* We only perturb the current target vector at the recursion  level 1 */
     6618    // We only perturb the current target vector at the recursion  level 1
    67216619    if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3
    67226620      if (MivComp(next_vect, omega2) == 1)
    67236621      {
    6724         /* to dispense with taking initial (and lifting/interreducing
    6725            after the call of recursion */
    6726         //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev);
    6727         //idElements(G, "G");
     6622        // to dispense with taking initial (and lifting/interreducing
     6623        // after the call of recursion
     6624        if(printout > 0)
     6625        {
     6626          Print("\n//** rec_fractal_call: Perturb the both vectors with degree %d.",nlev);
     6627          //idElements(G, "G");
     6628        }
    67286629
    67296630        Xngleich = 1;
    67306631        nlev +=1;
    67316632
    6732         if (rParameter(currRing) != NULL)
    6733           DefRingPar(omtmp);
     6633        if(ivtarget->length() == nV)
     6634        {
     6635          if (rParameter(currRing) != NULL)
     6636            DefRingPar(omtmp);
     6637          else
     6638            rChangeCurrRing(VMrDefault(omtmp));
     6639        }
    67346640        else
    6735           rChangeCurrRing(VMrDefault1(omtmp));
    6736 
     6641        {
     6642          rChangeCurrRing(VMatrDefault(ivtarget));
     6643        }
    67376644        testring = currRing;
    67386645        Gt = idrMoveR(G, oRing,currRing);
    67396646
    6740         /* perturb the original target vector w.r.t. the current GB */
    6741         delete Xtau;
    6742         Xtau = NewVectorlp(Gt);
     6647        // perturb the original target vector w.r.t. the current GB
     6648        if(ivtarget->length() == nV)
     6649        {
     6650          delete Xtau;
     6651          Xtau = NewVectorlp(Gt);
     6652        }
     6653        else
     6654        {
     6655          delete Xtau;
     6656          Xtau = Mfpertvector(Gt,ivtarget);
     6657        }
    67436658
    67446659        rChangeCurrRing(oRing);
    67456660        G = idrMoveR(Gt, testring,currRing);
    67466661
    6747         /* perturb the current vector w.r.t. the current GB */
     6662        // perturb the current vector w.r.t. the current GB
    67486663        Mwlp = MivWeightOrderlp(omega);
    67496664        Xsigma = Mfpertvector(G, Mwlp);
     
    67636678        next_vect = MkInterRedNextWeight(omega,omega2,G);
    67646679        xtnw=xtnw+clock()-to;
    6765 
    6766 #ifdef PRINT_VECTORS
     6680      }
     6681//#ifdef PRINT_VECTORS
     6682      if(printout > 0)
     6683      {
    67676684        MivString(omega, omega2, next_vect);
    6768 #endif
    6769       }
    6770 
     6685      }
     6686//#endif
    67716687
    67726688    /* check whether the the computed vector is in the correct cone */
     
    67776693    {
    67786694      delete next_vect;
    6779       if (rParameter(currRing) != NULL)
    6780       {
    6781         DefRingPar(omtmp);
     6695      if(ivtarget->length() == nV)
     6696      {
     6697        if (rParameter(currRing) != NULL)
     6698          DefRingPar(omtmp);
     6699        else
     6700          rChangeCurrRing(VMrDefault(omtmp));
    67826701      }
    67836702      else
    67846703      {
    6785         rChangeCurrRing(VMrDefault1(omtmp));
     6704        rChangeCurrRing(VMatrDefault(ivtarget));
    67866705      }
    67876706#ifdef TEST_OVERFLOW
     
    67896708      Gt = NULL; return(Gt);
    67906709#endif
    6791 
    6792       //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing));
     6710      if(printout > 0)
     6711      {
     6712        Print("\n//** rec_fractal_call: applying Buchberger's algorithm in ring r = %s;",
     6713              rString(currRing));
     6714      }
    67936715      to=clock();
    67946716      Gt = idrMoveR(G, oRing,currRing);
     
    67996721      delete omega2;
    68006722      delete altomega;
    6801 
    6802       //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks);
    6803       //Print("  ** Overflow_Error? (%d)", Overflow_Error);
     6723      if(printout > 0)
     6724      {
     6725        Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     6726              nlev, nwalks);
     6727        //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     6728      }
     6729
    68046730      nnflow ++;
    68056731
     
    68186744    if (MivComp(next_vect, XivNull) == 1)
    68196745    {
    6820       if (rParameter(currRing) != NULL)
    6821         DefRingPar(omtmp);
     6746      if(ivtarget->length() == nV)
     6747      {
     6748        if (rParameter(currRing) != NULL)
     6749          DefRingPar(omtmp);
     6750        else
     6751          rChangeCurrRing(VMrDefault(omtmp));
     6752      }
    68226753      else
    6823         rChangeCurrRing(VMrDefault1(omtmp));
     6754      {
     6755        rChangeCurrRing(VMatrDefault(ivtarget));
     6756      }
    68246757
    68256758      testring = currRing;
     
    68306763        delete next_vect;
    68316764        delete altomega;
    6832         //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks);
    6833         //Print(" ** Overflow_Error? (%d)", Overflow_Error);
    6834 
     6765        if(printout > 0)
     6766        {
     6767          Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     6768              nlev, nwalks);
     6769          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     6770        }
    68356771        return (Gt);
    68366772      }
     
    68436779        //07.08.03
    68446780        //ivString(Xtau, "old Xtau");
    6845         intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     6781        intvec* Xtautmp;
     6782        if(ivtarget->length() == nV)
     6783        {
     6784          Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     6785        }
     6786        else
     6787        {
     6788          Xtautmp = Mfpertvector(Gt, ivtarget);
     6789        }
    68466790#ifdef TEST_OVERFLOW
    68476791      if(Overflow_Error == TRUE)
     
    68716815
    68726816      FRACTAL_MSTDCC:
    6873         //Print("\n//  apply BB-Alg in ring = %s;", rString(currRing));
     6817        if(printout > 0)
     6818        {
     6819          Print("\n//** rec_fractal_call: apply Buchberger's algorithm in ring = %s.\n",
     6820                rString(currRing));
     6821        }
    68746822        to=clock();
    68756823        G = MstdCC(Gt);
     
    68796827
    68806828        // update the original target vector w.r.t. the current GB
    6881         if(MivSame(Xivinput, Xivlp) == 1)
    6882           if (rParameter(currRing) != NULL)
    6883             DefRingParlp();
     6829        if(ivtarget->length() == nV)
     6830        {
     6831          if(MivSame(Xivinput, Xivlp) == 1)
     6832            if (rParameter(currRing) != NULL)
     6833              DefRingParlp();
     6834            else
     6835              VMrDefaultlp();
    68846836          else
    6885             VMrDefaultlp();
     6837            if (rParameter(currRing) != NULL)
     6838              DefRingPar(Xivinput);
     6839            else
     6840              rChangeCurrRing(VMrDefault(Xivinput));
     6841        }
    68866842        else
    6887           if (rParameter(currRing) != NULL)
    6888             DefRingPar(Xivinput);
    6889           else
    6890             rChangeCurrRing(VMrDefault1(Xivinput));
    6891 
     6843        {
     6844          rChangeCurrRing(VMatrRefine(ivtarget,Xivinput));
     6845        }
    68926846        testring = currRing;
    68936847        Gt = idrMoveR(G, oRing,currRing);
     
    69026856        delete next_vect;
    69036857        delete altomega;
    6904         /*
    6905           Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks);
    6906           Print(" ** Overflow_Error? (%d)", Overflow_Error);
    6907         */
     6858        if(printout > 0)
     6859        {
     6860          Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     6861              nlev, nwalks);
     6862          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     6863        }
    69086864        if(Overflow_Error == TRUE)
    69096865          nnflow ++;
     
    69246880    Gomega = MwalkInitialForm(G, omega);
    69256881    xtif=xtif+clock()-to;
    6926 
     6882    if(printout > 1)
     6883    {
     6884      idString(Gomega,"//** rec_fractal_call: Gomega");
     6885    }
    69276886#ifndef  BUCHBERGER_ALG
    69286887    if(isNolVector(omega) == 0)
     
    69316890      hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
    69326891#endif // BUCHBERGER_ALG
    6933 
    6934     if (rParameter(currRing) != NULL)
    6935       DefRingPar(omega);
     6892    if(ivtarget->length() == nV)
     6893    {
     6894      if (rParameter(currRing) != NULL)
     6895        DefRingPar(omega);
     6896      else
     6897        rChangeCurrRing(VMrDefault(omega));
     6898    }
    69366899    else
    6937       rChangeCurrRing(VMrDefault1(omega));
    6938 
     6900    {
     6901      rChangeCurrRing(VMatrRefine(ivtarget,omega));
     6902    }
    69396903    Gomega1 = idrMoveR(Gomega, oRing,currRing);
    69406904
    6941     /* Maximal recursion depth, to compute a red. GB */
    6942     /* Fractal walk with the alternative recursion */
    6943     /* alternative recursion */
     6905    // Maximal recursion depth, to compute a red. GB
     6906    // Fractal walk with the alternative recursion
     6907    // alternative recursion
    69446908    // if(nlev == nV || lengthpoly(Gomega1) == 0)
    69456909    if(nlev == Xnlev || lengthpoly(Gomega1) == 0)
    69466910      //if(nlev == nV) // blind recursion
    69476911    {
    6948       /*
    6949       if(Xnlev != nV)
    6950       {
    6951         Print("\n// ** Xnlev = %d", Xnlev);
    6952         ivString(Xtau, "Xtau");
    6953       }
    6954       */
    69556912      to=clock();
    69566913#ifdef  BUCHBERGER_ALG
     
    69626919      xtstd=xtstd+clock()-to;
    69636920    }
    6964     else {
     6921    else
     6922    {
    69656923      rChangeCurrRing(oRing);
    69666924      Gomega1 = idrMoveR(Gomega1, oRing,currRing);
    6967       Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega);
    6968     }
    6969 
    6970     //convert a Groebner basis from a ring to another ring,
     6925      Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega,printout);
     6926    }
     6927    if(printout > 2)
     6928    {
     6929      idString(Gresult,"//** rec_fractal_call: M");
     6930    }
     6931    //convert a Groebner basis from a ring to another ring
    69716932    new_ring = currRing;
    69726933
     
    69766937
    69776938    to=clock();
    6978     /* Lifting process */
     6939    // Lifting process
    69796940    F = MLifttwoIdeal(Gomega2, Gresult1, G);
    69806941    xtlift=xtlift+clock()-to;
     6942    if(printout > 2)
     6943    {
     6944      idString(F,"//** rec_fractal_call: F");
     6945    }
    69816946    idDelete(&Gresult1);
    69826947    idDelete(&Gomega2);
     
    69976962 * Perturb the start weight vector at the top level with random element *
    69986963 ************************************************************************/
    6999 static ideal rec_r_fractal_call(ideal G, int nlev, intvec* omtmp, int weight_rad)
     6964static ideal rec_r_fractal_call(ideal G, int nlev, intvec* ivtarget,
     6965                int weight_rad, int printout)
    70006966{
    70016967  Overflow_Error =  FALSE;
    70026968  //Print("\n\n// Entering the %d-th recursion:", nlev);
    70036969
    7004   int i, nV = currRing->N;
     6970  int i, polylength, nV = currRing->N;
    70056971  ring new_ring, testring;
    70066972  //ring extoRing;
     
    70146980  intvec* next_vect;
    70156981  intvec* omega2 = new intvec(nV);
     6982  intvec* omtmp = new intvec(nV);
    70166983  intvec* altomega = new intvec(nV);
    70176984
    70186985  //BOOLEAN isnewtarget = FALSE;
    70196986
     6987  for(i = nV -1; i>0; i--)
     6988  {
     6989    (*omtmp)[i] = (*ivtarget)[i];
     6990  }
    70206991  // to avoid (1,0,...,0) as the target vector (Hans)
    70216992  intvec* last_omega = new intvec(nV);
     
    70577028    to=clock();
    70587029    /* determine the next border */
    7059     next_vect = MWalkRandomNextWeight(G, omega,omega2, weight_rad, 1+nlev);
    7060     if(isNolVector(next_vect))
    7061     {
    7062       next_vect = MkInterRedNextWeight(omega,omega2,G);
     7030    next_vect = MkInterRedNextWeight(omega,omega2,G);
     7031    if(polylength > 0)
     7032    {
     7033      //there is a polynomial in Gomega with at least 3 monomials,
     7034      //low-dimensional facet of the cone
     7035      delete next_vect;
     7036      next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,1+nlev);
     7037      if(isNolVector(next_vect))
     7038      {
     7039        delete next_vect;
     7040        next_vect = MkInterRedNextWeight(omega,omega2,G);
     7041      }
    70637042    }
    70647043    xtnw=xtnw+clock()-to;
    7065 #ifdef PRINT_VECTORS
    7066     MivString(omega, omega2, next_vect);
    7067 #endif
     7044
    70687045    oRing = currRing;
    70697046
    7070     /* We only perturb the current target vector at the recursion  level 1 */
     7047    // We only perturb the current target vector at the recursion  level 1
    70717048    if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3
    70727049      if (MivComp(next_vect, omega2) == 1)
    70737050      {
    7074         /* to dispense with taking initial (and lifting/interreducing
    7075            after the call of recursion */
    7076         //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev);
    7077         //idElements(G, "G");
    7078 
     7051        // to dispense with taking initials and lifting/interreducing
     7052        // after the call of recursion.
     7053        if(printout > 0)
     7054        {
     7055          Print("\n//** rec_r_fractal_call: Perturb the both vectors with degree %d.",nlev);
     7056          //idElements(G, "G");
     7057        }
    70797058        Xngleich = 1;
    70807059        nlev +=1;
    7081 
    7082         if (rParameter(currRing) != NULL)
    7083           DefRingPar(omtmp);
     7060        if(ivtarget->length() == nV)
     7061        {
     7062          if (rParameter(currRing) != NULL)
     7063            DefRingPar(omtmp);
     7064          else
     7065            rChangeCurrRing(VMrDefault(omtmp));
     7066        }
    70847067        else
    7085           rChangeCurrRing(VMrDefault1(omtmp));
    7086 
     7068        {
     7069          rChangeCurrRing(VMatrDefault(ivtarget));
     7070        }
    70877071        testring = currRing;
    70887072        Gt = idrMoveR(G, oRing,currRing);
    70897073
    7090         /* perturb the original target vector w.r.t. the current GB */
    7091         delete Xtau;
    7092         Xtau = NewVectorlp(Gt);
     7074        // perturb the original target vector w.r.t. the current GB
     7075        if(ivtarget->length() == nV)
     7076        {
     7077          delete Xtau;
     7078          Xtau = NewVectorlp(Gt);
     7079        }
     7080        else
     7081        {
     7082          delete Xtau;
     7083          Xtau = Mfpertvector(Gt,ivtarget);
     7084        }
    70937085
    70947086        rChangeCurrRing(oRing);
    7095         G = idrMoveR(Gt, testring,currRing);
    7096 
    7097         /* perturb the current vector w.r.t. the current GB */
     7087        G = idrMoveR(Gt,testring,currRing);
     7088
     7089        // perturb the current vector w.r.t. the current GB
    70987090        Mwlp = MivWeightOrderlp(omega);
     7091        if(ivtarget->length() > nV)
     7092        {
     7093          delete Mwlp;
     7094          Mwlp = MivMatrixOrderRefine(omega,ivtarget);
     7095        }
    70997096        Xsigma = Mfpertvector(G, Mwlp);
    71007097        delete Mwlp;
     
    71127109
    71137110        next_vect = MkInterRedNextWeight(omega,omega2,G);
     7111        if(polylength > 0)
     7112        {
     7113          //there is a polynomial in Gomega with at least 3 monomials,
     7114          //low-dimensional facet of the cone
     7115          delete next_vect;
     7116          next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,1+nlev);
     7117          if(isNolVector(next_vect))
     7118          {
     7119            delete next_vect;
     7120            next_vect = MkInterRedNextWeight(omega,omega2,G);
     7121          }
     7122        }
    71147123        xtnw=xtnw+clock()-to;
    7115 
    7116 #ifdef PRINT_VECTORS
     7124      }
     7125//#ifdef PRINT_VECTORS
     7126      if(printout > 0)
     7127      {
    71177128        MivString(omega, omega2, next_vect);
    7118 #endif
    7119       }
    7120 
    7121 
    7122     /* check whether the the computed vector is in the correct cone */
    7123     /* If no, the reduced GB of an omega-homogeneous ideal will be
     7129      }
     7130//#endif
     7131
     7132    /* check whether the the computed vector is in the correct cone
     7133       If no, the reduced GB of an omega-homogeneous ideal will be
    71247134       computed by Buchberger algorithm and stop this recursion step*/
    71257135    //if(test_w_in_ConeCC(G, next_vect) != 1) //e.g. Example s7, cyc6
     
    71277137    {
    71287138      delete next_vect;
    7129       if (rParameter(currRing) != NULL)
    7130       {
    7131         DefRingPar(omtmp);
     7139      if(ivtarget->length() == nV)
     7140      {
     7141        if (rParameter(currRing) != NULL)
     7142        {
     7143          DefRingPar(omtmp);
     7144        }
     7145        else
     7146        {
     7147          rChangeCurrRing(VMrDefault(omtmp));
     7148        }
    71327149      }
    71337150      else
    71347151      {
    7135         rChangeCurrRing(VMrDefault1(omtmp));
     7152        rChangeCurrRing(VMatrDefault(ivtarget));
    71367153      }
    71377154#ifdef TEST_OVERFLOW
    71387155      Gt = idrMoveR(G, oRing,currRing);
    7139       Gt = NULL; return(Gt);
    7140 #endif
    7141 
    7142       //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing));
     7156      Gt = NULL;
     7157      return(Gt);
     7158#endif
     7159      if(printout > 0)
     7160      {
     7161        Print("\n//** rec_r_fractal_call: applying Buchberger's algorithm in ring r = %s;",
     7162              rString(currRing));
     7163      }
    71437164      to=clock();
    71447165      Gt = idrMoveR(G, oRing,currRing);
     
    71497170      delete omega2;
    71507171      delete altomega;
    7151 
    7152       //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks);
    7153       //Print("  ** Overflow_Error? (%d)", Overflow_Error);
     7172      if(printout > 0)
     7173      {
     7174        Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     7175              nlev, nwalks);
     7176        //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     7177      }
    71547178      nnflow ++;
    7155 
    71567179      Overflow_Error = FALSE;
    71577180      return (G1);
    71587181    }
    7159 
    7160 
    7161     /* If the perturbed target vector stays in the correct cone,
    7162        return the current GB,
    7163        otherwise, return the computed  GB by the Buchberger-algorithm.
    7164        Then we update the perturbed target vectors w.r.t. this GB. */
    7165 
    7166     /* the computed vector is equal to the origin vector, since
    7167        t is not defined */
     7182    /*
     7183       If the perturbed target vector stays in the correct cone,
     7184       return the current Groebner basis.
     7185       Otherwise, return the Groebner basis computed with Buchberger's
     7186       algorithm.
     7187       Then we update the perturbed target vectors w.r.t. this GB.
     7188    */
    71687189    if (MivComp(next_vect, XivNull) == 1)
    71697190    {
    7170       if (rParameter(currRing) != NULL)
    7171         DefRingPar(omtmp);
     7191      // The computed vector is equal to the origin vector,
     7192      // because t is not defined
     7193      if(ivtarget->length() == nV)
     7194      {
     7195        if (rParameter(currRing) != NULL)
     7196          DefRingPar(omtmp);
     7197        else
     7198          rChangeCurrRing(VMrDefault(omtmp));
     7199      }
    71727200      else
    7173         rChangeCurrRing(VMrDefault1(omtmp));
    7174 
     7201      {
     7202        rChangeCurrRing(VMatrDefault(ivtarget));
     7203      }
    71757204      testring = currRing;
    71767205      Gt = idrMoveR(G, oRing,currRing);
    71777206
    7178       if(test_w_in_ConeCC(Gt, omega2) == 1) {
     7207      if(test_w_in_ConeCC(Gt, omega2) == 1)
     7208      {
    71797209        delete omega2;
    71807210        delete next_vect;
    71817211        delete altomega;
    7182         //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks);
    7183         //Print(" ** Overflow_Error? (%d)", Overflow_Error);
    7184 
     7212        if(printout > 0)
     7213        {
     7214          Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     7215                nlev, nwalks);
     7216          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     7217        }
    71857218        return (Gt);
    71867219      }
    71877220      else
    7188       {
    7189         //ivString(omega2, "tau'");
    7190         //Print("\n//  tau' doesn't stay in the correct cone!!");
    7191 
     7221      {
     7222        if(printout > 0)
     7223        {
     7224          Print("\n//** rec_r_fractal_call: target weight doesn't stay in the correct cone.\n");
     7225        }
    71927226#ifndef  MSTDCC_FRACTAL
    7193         //07.08.03
    71947227        //ivString(Xtau, "old Xtau");
    7195         intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     7228        intvec* Xtautmp;
     7229        if(ivtarget->length() == nV)
     7230        {
     7231          Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     7232        }
     7233        else
     7234        {
     7235          Xtautmp = Mfpertvector(Gt, ivtarget);
     7236        }
    71967237#ifdef TEST_OVERFLOW
    71977238      if(Overflow_Error == TRUE)
     
    72217262
    72227263      FRACTAL_MSTDCC:
    7223         //Print("\n//  apply BB-Alg in ring = %s;", rString(currRing));
     7264        if(printout > 0)
     7265        {
     7266          Print("\n//** rec_r_fractal_call: apply Buchberge's algorithm in ring = %s.\n",
     7267                rString(currRing));
     7268        }
    72247269        to=clock();
    72257270        G = MstdCC(Gt);
     
    72297274
    72307275        // update the original target vector w.r.t. the current GB
    7231         if(MivSame(Xivinput, Xivlp) == 1)
    7232           if (rParameter(currRing) != NULL)
    7233             DefRingParlp();
     7276        if(ivtarget->length() == nV)
     7277        {
     7278          if(MivSame(Xivinput, Xivlp) == 1)
     7279            if (rParameter(currRing) != NULL)
     7280              DefRingParlp();
     7281            else
     7282              VMrDefaultlp();
    72347283          else
    7235             VMrDefaultlp();
     7284            if (rParameter(currRing) != NULL)
     7285              DefRingPar(Xivinput);
     7286            else
     7287              rChangeCurrRing(VMrDefault(Xivinput));
     7288        }
    72367289        else
    7237           if (rParameter(currRing) != NULL)
    7238             DefRingPar(Xivinput);
    7239           else
    7240             rChangeCurrRing(VMrDefault1(Xivinput));
    7241 
     7290        {
     7291          rChangeCurrRing(VMatrRefine(ivtarget,Xivinput));
     7292        }
    72427293        testring = currRing;
    72437294        Gt = idrMoveR(G, oRing,currRing);
     
    72527303        delete next_vect;
    72537304        delete altomega;
    7254         /*
    7255           Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks);
    7256           Print(" ** Overflow_Error? (%d)", Overflow_Error);
    7257         */
     7305        if(printout > 0)
     7306        {
     7307          Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     7308                nlev,nwalks);
     7309          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     7310        }
    72587311        if(Overflow_Error == TRUE)
    72597312          nnflow ++;
     
    72717324
    72727325    to=clock();
    7273     /* Take the initial form of <G> w.r.t. omega */
     7326    // Take the initial form of <G> w.r.t. omega
    72747327    Gomega = MwalkInitialForm(G, omega);
    72757328    xtif=xtif+clock()-to;
    7276 
     7329    //polylength = 1 if there is a polynomial in Gomega with at least 3 monomials and 0 otherwise
     7330    polylength = lengthpoly(Gomega);
     7331    if(printout > 1)
     7332    {
     7333      idString(Gomega,"//** rec_r_fractal_call: Gomega");
     7334    }
    72777335#ifndef  BUCHBERGER_ALG
    72787336    if(isNolVector(omega) == 0)
     
    72807338    else
    72817339      hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
    7282 #endif // BUCHBERGER_ALG
    7283 
    7284     if (rParameter(currRing) != NULL)
    7285       DefRingPar(omega);
     7340#endif
     7341    if(ivtarget->length() == nV)
     7342    {
     7343      if (rParameter(currRing) != NULL)
     7344        DefRingPar(omega);
     7345      else
     7346        rChangeCurrRing(VMrDefault(omega));
     7347    }
    72867348    else
    7287       rChangeCurrRing(VMrDefault1(omega));
    7288 
     7349    {
     7350      rChangeCurrRing(VMatrRefine(ivtarget,omega));
     7351    }
    72897352    Gomega1 = idrMoveR(Gomega, oRing,currRing);
    72907353
    7291     /* Maximal recursion depth, to compute a red. GB */
    7292     /* Fractal walk with the alternative recursion */
    7293     /* alternative recursion */
    7294     // if(nlev == nV || lengthpoly(Gomega1) == 0)
     7354    // Maximal recursion depth, to compute a red. GB
     7355    // Fractal walk with the alternative recursion
     7356    // alternative recursion
    72957357    if(nlev == Xnlev || lengthpoly(Gomega1) == 0)
    7296       //if(nlev == nV) // blind recursion
    7297     {
    7298       /*
    7299       if(Xnlev != nV)
    7300       {
    7301         Print("\n// ** Xnlev = %d", Xnlev);
    7302         ivString(Xtau, "Xtau");
    7303       }
    7304       */
     7358    {
    73057359      to=clock();
    73067360#ifdef  BUCHBERGER_ALG
     
    73097363      Gresult =kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,omega);
    73107364      delete hilb_func;
    7311 #endif // BUCHBERGER_ALG
     7365#endif
    73127366      xtstd=xtstd+clock()-to;
    73137367    }
    7314     else {
     7368    else
     7369    {
    73157370      rChangeCurrRing(oRing);
    73167371      Gomega1 = idrMoveR(Gomega1, oRing,currRing);
    7317       Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega);
    7318     }
    7319 
    7320     //convert a Groebner basis from a ring to another ring,
     7372      Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega,printout);
     7373    }
     7374    if(printout > 2)
     7375    {
     7376      idString(Gresult,"//** rec_r_fractal_call: M");
     7377    }
     7378    //convert a Groebner basis from a ring to another ring
    73217379    new_ring = currRing;
    73227380
     
    73267384
    73277385    to=clock();
    7328     /* Lifting process */
     7386    // Lifting process
    73297387    F = MLifttwoIdeal(Gomega2, Gresult1, G);
    73307388    xtlift=xtlift+clock()-to;
     7389
     7390    if(printout > 2)
     7391    {
     7392      idString(F,"//** rec_r_fractal_call: F");
     7393    }
     7394
    73317395    idDelete(&Gresult1);
    73327396    idDelete(&Gomega2);
     
    73377401
    73387402    to=clock();
    7339     /* Interreduce G */
     7403    // Interreduce G
    73407404    G = kInterRedCC(F1, NULL);
    73417405    xtred=xtred+clock()-to;
     
    73437407  }
    73447408}
    7345 
    7346 
    73477409
    73487410
     
    73517413 *                                                                             *
    73527414 * The main procedur Mfwalk calls the recursive Subroutine                     *
    7353  * rec_fractal_call to compute the wanted Grï¿œbner basis.                       *
    7354  * At the main procedur we compute the reduced Grï¿œbner basis w.r.t. a "fast"   *
     7415 * rec_fractal_call to compute the wanted Groebner basis.                      *
     7416 * At the main procedur we compute the reduced Groebner basis w.r.t. a "fast"  *
    73557417 * order, e.g. "dp" and a sequence of weight vectors which are row vectors     *
    73567418 * of a matrix. This matrix defines the given monomial order, e.g. "lp"        *
    73577419 *******************************************************************************/
    7358 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, int reduction)
     7420ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget,
     7421             int reduction, int printout)
    73597422{
    73607423  BITSET save1 = si_opt_1; // save current options
     
    73637426    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
    73647427    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
    7365     //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
    73667428  }
    73677429  Set_Error(FALSE);
     
    73997461      intvec* iv_dp = MivUnit(nV); // define (1,1,...,1)
    74007462      intvec* Mdp;
    7401 
    7402       if(MivSame(ivstart, iv_dp) != 1)
    7403         Mdp = MivWeightOrderdp(ivstart);
     7463      if(ivstart->length() == nV)
     7464      {
     7465        if(MivSame(ivstart, iv_dp) != 1)
     7466          Mdp = MivWeightOrderdp(ivstart);
     7467        else
     7468          Mdp = MivMatrixOrderdp(nV);
     7469      }
    74047470      else
    7405         Mdp = MivMatrixOrderdp(nV);
     7471      {
     7472        Mdp = ivstart;
     7473      }
    74067474
    74077475      Xsigma = Mfpertvector(I, Mdp);
     
    74207488  Xivlp = Mivlp(nV);
    74217489
    7422   if(MivComp(ivtarget, Xivlp)  != 1)
    7423   {
    7424     if (rParameter(currRing) != NULL)
    7425       DefRingPar(ivtarget);
     7490  if(ivtarget->length() == nV)
     7491  {
     7492    if(MivComp(ivtarget, Xivlp)  != 1)
     7493    {
     7494      if (rParameter(currRing) != NULL)
     7495        DefRingPar(ivtarget);
     7496      else
     7497        rChangeCurrRing(VMrDefault(ivtarget));
     7498
     7499      I1 = idrMoveR(I, oldRing,currRing);
     7500      Mlp = MivWeightOrderlp(ivtarget);
     7501      Xtau = Mfpertvector(I1, Mlp);
     7502    }
    74267503    else
    7427       rChangeCurrRing(VMrDefault1(ivtarget));
    7428 
    7429     I1 = idrMoveR(I, oldRing,currRing);
    7430     Mlp = MivWeightOrderlp(ivtarget);
    7431     Xtau = Mfpertvector(I1, Mlp);
     7504    {
     7505      if (rParameter(currRing) != NULL)
     7506        DefRingParlp();
     7507      else
     7508        VMrDefaultlp();
     7509
     7510      I1 = idrMoveR(I, oldRing,currRing);
     7511      Mlp =  MivMatrixOrderlp(nV);
     7512      Xtau = Mfpertvector(I1, Mlp);
     7513    }
    74327514  }
    74337515  else
    74347516  {
    7435     if (rParameter(currRing) != NULL)
    7436       DefRingParlp();
    7437     else
    7438       VMrDefaultlp();
    7439 
    7440     I1 = idrMoveR(I, oldRing,currRing);
    7441     Mlp =  MivMatrixOrderlp(nV);
     7517    rChangeCurrRing(VMatrDefault(ivtarget));
     7518    I1 = idrMoveR(I,oldRing,currRing);
     7519    Mlp =  ivtarget;
    74427520    Xtau = Mfpertvector(I1, Mlp);
    74437521  }
     
    74507528  id_Delete(&I, oldRing);
    74517529  ring tRing = currRing;
    7452 
    7453   if (rParameter(currRing) != NULL)
    7454     DefRingPar(ivstart);
     7530  if(ivtarget->length() == nV)
     7531  {
     7532    if (rParameter(currRing) != NULL)
     7533      DefRingPar(ivstart);
     7534    else
     7535      rChangeCurrRing(VMrDefault(ivstart));
     7536  }
    74557537  else
    7456     rChangeCurrRing(VMrDefault1(ivstart));
     7538  {
     7539    rChangeCurrRing(VMatrDefault(ivstart));
     7540  }
    74577541
    74587542  I = idrMoveR(I1,tRing,currRing);
     
    74657549  ring helpRing = currRing;
    74667550
    7467   J = rec_fractal_call(J, 1, ivtarget);
     7551  J = rec_fractal_call(J,1,ivtarget,printout);
    74687552
    74697553  rChangeCurrRing(oldRing);
     
    74957579 * The main procedur Mfwalk calls the recursive Subroutine                     *
    74967580 * rec_r_fractal_call to compute the wanted Groebner basis.                    *
    7497  * At the main procedur we compute the reduced Groebner basis w.r.t. a "fast" *
     7581 * At the main procedure we compute the reduced Groebner basis w.r.t. a "fast" *
    74987582 * order, e.g. "dp" and a sequence of weight vectors which are row vectors     *
    74997583 * of a matrix. This matrix defines the given monomial order, e.g. "lp"        *
    75007584 *******************************************************************************/
    75017585ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget,
    7502               int weight_rad, int reduction)
     7586              int weight_rad, int reduction, int printout)
    75037587{
    75047588  BITSET save1 = si_opt_1; // save current options
     
    75427626      intvec* iv_dp = MivUnit(nV); // define (1,1,...,1)
    75437627      intvec* Mdp;
    7544 
    7545       if(MivSame(ivstart, iv_dp) != 1)
    7546         Mdp = MivWeightOrderdp(ivstart);
     7628      if(ivstart->length() == nV)
     7629      {
     7630        if(MivSame(ivstart, iv_dp) != 1)
     7631          Mdp = MivWeightOrderdp(ivstart);
     7632        else
     7633          Mdp = MivMatrixOrderdp(nV);
     7634      }
    75477635      else
    7548         Mdp = MivMatrixOrderdp(nV);
     7636      {
     7637        Mdp = ivstart;
     7638      }
    75497639
    75507640      Xsigma = Mfpertvector(I, Mdp);
     
    75637653  Xivlp = Mivlp(nV);
    75647654
    7565   if(MivComp(ivtarget, Xivlp)  != 1)
    7566   {
    7567     if (rParameter(currRing) != NULL)
    7568       DefRingPar(ivtarget);
     7655  if(ivtarget->length() == nV)
     7656  {
     7657    if(MivComp(ivtarget, Xivlp)  != 1)
     7658    {
     7659      if (rParameter(currRing) != NULL)
     7660        DefRingPar(ivtarget);
     7661      else
     7662        rChangeCurrRing(VMrDefault(ivtarget));
     7663
     7664      I1 = idrMoveR(I, oldRing,currRing);
     7665      Mlp = MivWeightOrderlp(ivtarget);
     7666      Xtau = Mfpertvector(I1, Mlp);
     7667    }
    75697668    else
    7570       rChangeCurrRing(VMrDefault1(ivtarget));
    7571 
    7572     I1 = idrMoveR(I, oldRing,currRing);
    7573     Mlp = MivWeightOrderlp(ivtarget);
    7574     Xtau = Mfpertvector(I1, Mlp);
     7669    {
     7670      if (rParameter(currRing) != NULL)
     7671        DefRingParlp();
     7672      else
     7673        VMrDefaultlp();
     7674
     7675      I1 = idrMoveR(I, oldRing,currRing);
     7676      Mlp =  MivMatrixOrderlp(nV);
     7677      Xtau = Mfpertvector(I1, Mlp);
     7678    }
    75757679  }
    75767680  else
    75777681  {
    7578     if (rParameter(currRing) != NULL)
    7579       DefRingParlp();
    7580     else
    7581       VMrDefaultlp();
    7582 
    7583     I1 = idrMoveR(I, oldRing,currRing);
    7584     Mlp =  MivMatrixOrderlp(nV);
     7682    rChangeCurrRing(VMatrDefault(ivtarget));
     7683    I1 = idrMoveR(I,oldRing,currRing);
     7684    Mlp =  ivtarget;
    75857685    Xtau = Mfpertvector(I1, Mlp);
    75867686  }
     
    75937693  id_Delete(&I, oldRing);
    75947694  ring tRing = currRing;
    7595 
    7596   if (rParameter(currRing) != NULL)
    7597     DefRingPar(ivstart);
     7695  if(ivtarget->length() == nV)
     7696  {
     7697    if (rParameter(currRing) != NULL)
     7698      DefRingPar(ivstart);
     7699    else
     7700      rChangeCurrRing(VMrDefault(ivstart));
     7701  }
    75987702  else
    7599     rChangeCurrRing(VMrDefault1(ivstart));
     7703  {
     7704    rChangeCurrRing(VMatrDefault(ivstart));
     7705  }
    76007706
    76017707  I = idrMoveR(I1,tRing,currRing);
     
    76087714  ring helpRing = currRing;
    76097715
    7610   J = rec_r_fractal_call(J, 1, ivtarget,weight_rad);
     7716  J = rec_r_fractal_call(J,1,ivtarget,weight_rad,printout);
    76117717
    76127718  rChangeCurrRing(oldRing);
  • Singular/walk.h

    r41c9e4 r8e682d  
    6868
    6969/* The fractal walk algorithm */
    70 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, int reduction);
     70ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, int reduction, int printout);
    7171
    7272/* The fractal walk algorithm with random element */
    73 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget, int weight_rad, int reduction);
     73ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget, int weight_rad, int reduction, int printout);
    7474
    7575/* Implement Tran's idea */
Note: See TracChangeset for help on using the changeset viewer.