Changeset 4083fa in git for Singular/walk.cc


Ignore:
Timestamp:
Dec 23, 2014, 1:24:01 PM (9 years ago)
Author:
Stephan Oberfranz <oberfran@…>
Branches:
(u'spielwiese', '6e5adcba05493683b94648c659a729c189812c77')
Children:
ca38640ca6928ad815ae7b2bd1f3516f383315af
Parents:
11d9d00209c06444540d1707f2976c99061746a9f533f6f7667328bccb271b19b2f603aaebe41596
Message:
---
Merge branch 'spielwiese' of github.com:Singular/Sources into spielwiese

Conflicts:
	Singular/LIB/grwalk.lib
	Singular/LIB/modwalk.lib
	Singular/walk.cc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/walk.cc

    r11d9d00 r4083fa  
    4242#include <Singular/ipshell.h>
    4343#include <Singular/ipconv.h>
    44 #include <coeffs/ffields.h>
    4544#include <coeffs/coeffs.h>
    4645#include <Singular/subexpr.h>
    47 #include <polys/templates/p_Procs.h>
    4846
    4947#include <polys/monomials/maps.h>
     
    990988intvec* MivMatrixOrderRefine(intvec* iv, intvec* iw)
    991989{
     990<<<<<<< HEAD
    992991  assume((iv->length())*(iv->length()) == iw->length());
    993992  int i,j, nR = iv->length();
    994993 
     994=======
     995  assume(iv->length() == iw->length());
     996  int i, nR = iv->length();
     997
     998>>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596
    995999  intvec* ivm = new intvec(nR*nR);
    9961000
     
    26062610
    26072611  // complete ring intializations
    2608  
     2612
    26092613  rComplete(r);
    26102614
     
    44034407          (*result)[i] = (*next_weight1)[i];
    44044408        }
    4405       }   
     4409      }
    44064410    }
    44074411    else
     
    51025106    {
    51035107      hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
    5104     }   
     5108    }
    51055109    else
    51065110    {
     
    54015405    {
    54025406      hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
    5403     }   
     5407    }
    54045408    else
    54055409    {
     
    89128916
    89138917  //Print("\n// \"Mpwalk\" (1,%d) took %d steps and %.2f sec. Overflow_Error (%d)", tp_deg, nwalk, ((double) clock()-tinput)/1000000, nOverflow_Error);
     8918<<<<<<< HEAD
     8919=======
     8920
     8921  return(result);
     8922}
     8923
     8924/*******************************************************
     8925 * THE PERTURBATION WALK ALGORITHM WITH RANDOM ELEMENT *
     8926 *******************************************************/
     8927ideal Mprwalk(ideal Go, intvec* curr_weight, intvec* target_weight, int weight_rad, int op_deg, int tp_deg, ring baseRing)
     8928{
     8929  BITSET save1 = si_opt_1; // save current options
     8930  si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     8931  Set_Error(FALSE);
     8932  Overflow_Error = FALSE;
     8933#ifdef TIME_TEST
     8934  clock_t tinput=0, tostd=0, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
     8935  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
     8936  tinput = clock();
     8937  clock_t tim;
     8938#endif
     8939  int i,nwalk,nV = baseRing->N;
     8940
     8941  ideal G, Gomega, M, F, Gomega1, Gomega2, M1;
     8942  ring newRing;
     8943  ring XXRing = baseRing;
     8944  intvec* exivlp = Mivlp(nV);
     8945  intvec* orig_target = target_weight;
     8946  intvec* pert_target_vector = target_weight;
     8947  intvec* ivNull = new intvec(nV);
     8948  intvec* tmp_weight = new intvec(nV);
     8949#ifdef CHECK_IDEAL_MWALK
     8950  poly p;
     8951#endif
     8952  for(i=0; i<nV; i++)
     8953  {
     8954    (*tmp_weight)[i] = (*curr_weight)[i];
     8955  }
     8956#ifndef BUCHBERGER_ALG
     8957  intvec* hilb_func;
     8958   // to avoid (1,0,...,0) as the target vector
     8959  intvec* last_omega = new intvec(nV);
     8960  for(i=0 i<nV; i++)
     8961  {
     8962    (*last_omega)[i] = 1;
     8963  }
     8964  (*last_omega)[0] = 10000;
     8965#endif
     8966  baseRing = currRing;
     8967  newRing = VMrDefault(curr_weight);
     8968  rChangeCurrRing(newRing);
     8969  G = idrMoveR(Go,baseRing,currRing);
     8970#ifdef TIME_TEST
     8971  to = clock();
     8972#endif
     8973  G = kStd(G,NULL,testHomog,NULL,NULL,0,0,NULL);
     8974  idSkipZeroes(G);
     8975#ifdef TIME_TEST
     8976  tostd = tostd + to - clock();
     8977#endif
     8978#ifdef CHECK_IDEAL_MWALK
     8979  idString(G,"G");
     8980#endif
     8981  if(op_deg >1)
     8982  {
     8983    if(MivComp(curr_weight,MivUnit(nV)) == 1) //ring order is "dp"
     8984    {
     8985      curr_weight = MPertVectors(G, MivMatrixOrderdp(nV), op_deg);
     8986    }
     8987    else //ring order is not "dp"
     8988    {
     8989      curr_weight = MPertVectors(G, MivMatrixOrder(curr_weight), op_deg);
     8990    }
     8991  }
     8992  baseRing = currRing;
     8993  if(tp_deg > 1 && tp_deg <= nV)
     8994  {
     8995    pert_target_vector = target_weight;
     8996  }
     8997#ifdef CHECK_IDEAL_MWALK
     8998  ivString(curr_weight, "new curr_weight");
     8999  ivString(target_weight, "new target_weight");
     9000#endif
     9001  nwalk = 0;
     9002  while(1)
     9003  {
     9004    nwalk ++;
     9005#ifdef TIME_TEST
     9006    to = clock();
     9007#endif
     9008    Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
     9009#ifdef TIME_TEST
     9010    tif = tif + clock()-to; //time for computing initial form ideal
     9011#endif
     9012#ifdef CHECK_IDEAL_MWALK
     9013    idString(Gomega,"Gomega");
     9014#endif
     9015#ifndef  BUCHBERGER_ALG
     9016    if(isNolVector(curr_weight) == 0)
     9017    {
     9018      hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
     9019    }
     9020    else
     9021    {
     9022      hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
     9023    }
     9024#endif
     9025    if(nwalk == 1)
     9026    {
     9027      newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
     9028    }
     9029    else
     9030    {
     9031      newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
     9032    }
     9033    rChangeCurrRing(newRing);
     9034    Gomega1 = idrMoveR(Gomega, baseRing,currRing);
     9035    idDelete(&Gomega);
     9036    // compute a Groebner basis of <Gomega> w.r.t. "newRing"
     9037#ifdef TIME_TEST
     9038    to = clock();
     9039#endif
     9040#ifndef  BUCHBERGER_ALG
     9041    M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
     9042    delete hilb_func;
     9043#else
     9044    M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
     9045#endif
     9046    idSkipZeroes(M);
     9047#ifdef TIME_TEST
     9048    tstd = tstd + clock() - to;
     9049#endif
     9050#ifdef CHECK_IDEAL_MWALK
     9051    idString(M, "M");
     9052#endif
     9053    //change the ring to baseRing
     9054    rChangeCurrRing(baseRing);
     9055    M1 =  idrMoveR(M, newRing,currRing);
     9056    idDelete(&M);
     9057    Gomega2 = idrMoveR(Gomega1, newRing,currRing);
     9058    idDelete(&Gomega1);
     9059    to = clock();
     9060    // 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
     9061    F = MLifttwoIdeal(Gomega2, M1, G);
     9062    idSkipZeroes(F);
     9063#ifdef TIME_TEST
     9064    tlift = tlift + clock() - to;
     9065#endif
     9066#ifdef CHECK_IDEAL_MWALK
     9067    idString(F,"F");
     9068#endif
     9069    rChangeCurrRing(newRing); // change the ring to newRing
     9070    G = idrMoveR(F,baseRing,currRing);
     9071    idDelete(&F);
     9072    baseRing = currRing; // set baseRing equal to newRing
     9073#ifdef CHECK_IDEAL_MWALK
     9074    idString(G,"G");
     9075#endif
     9076#ifdef TIME_TEST
     9077    to = clock();
     9078#endif
     9079    intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, op_deg);
     9080#ifdef TIME_TEST
     9081    tnw = tnw + clock() - to;
     9082#endif
     9083#ifdef PRINT_VECTORS
     9084    MivString(curr_weight, target_weight, next_weight);
     9085#endif
     9086    if(Overflow_Error == TRUE)
     9087    {
     9088      PrintS("\n//**Mprwalk: OVERFLOW: The computed vector does not stay in cone, the result may be wrong.\n");
     9089      delete next_weight;
     9090      break;
     9091    }
     9092
     9093    if(test_w_in_ConeCC(G,target_weight) == 1 || MivComp(next_weight, ivNull) == 1)
     9094    {
     9095      delete next_weight;
     9096      break;
     9097    }
     9098    //update tmp_weight and curr_weight
     9099    for(i=nV-1; i>=0; i--)
     9100    {
     9101      (*tmp_weight)[i] = (*curr_weight)[i];
     9102      (*curr_weight)[i] = (*next_weight)[i];
     9103    }
     9104    delete next_weight;
     9105  } //end of while-loop
     9106>>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596
    89149107  Print("\n// Mprwalk took %d steps. Ring= %s;\n", nwalk, rString(currRing));
    89159108  return(result);
Note: See TracChangeset for help on using the changeset viewer.