Changeset bf83d3 in git


Ignore:
Timestamp:
Dec 14, 2014, 11:28:20 AM (9 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
e5618cd2798aac0cb8de02188d38a8971f2c51e0
Parents:
4b47563a73afa1ce8193b66caba4ddd88af4f706
git-author:
Yue Ren <ren@mathematik.uni-kl.de>2014-12-14 11:28:20+01:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:05+01:00
Message:
chg: status update 14.12.2014
Location:
Singular/dyn_modules/gfanlib
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/gfanlib/adjustWeights.cc

    r4b47563 rbf83d3  
    4848  for (unsigned i=1; i<w.size(); i++)
    4949    if (w[i]<min) min=w[i];
     50
     51  if (min.sign()>0)
     52    return w;
     53
    5054  /* compute w+(1-min)*(1,...,1) and return it */
    5155  gfan::ZVector v=gfan::ZVector(w.size());
    52   if (min<1)
    53   {
    54     for (unsigned i=0; i<w.size(); i++)
    55       v[i]=w[i]-min+1;
    56   }
     56  for (unsigned i=0; i<w.size(); i++)
     57    v[i]=w[i]-min+1;
    5758  assume(checkForNonPositiveEntries(v));
    5859  return v;
  • Singular/dyn_modules/gfanlib/bbcone.cc

    r4b47563 rbf83d3  
    959959gfan::ZVector randomPoint(const gfan::ZCone* zc)
    960960{
     961  gfan::ZVector rp = gfan::ZVector(zc->ambientDimension());
     962
    961963  gfan::ZMatrix rays = zc->extremeRays();
    962   gfan::ZVector rp = gfan::ZVector(zc->ambientDimension());
    963964  for (int i=0; i<rays.getHeight(); i++)
    964965  {
     
    966967    rp = rp + n * rays[i];
    967968  }
     969
     970  gfan::ZMatrix lins = zc->generatorsOfLinealitySpace();
     971  for (int i=0; i<lins.getHeight(); i++)
     972  {
     973    int n = siRand();
     974    rp = rp + n * lins[i];
     975  }
     976
    968977  return rp;
    969978}
  • Singular/dyn_modules/gfanlib/containsMonomial.cc

    r4b47563 rbf83d3  
    169169{
    170170  ring origin = currRing;
     171  if (currRing != r)
     172    rChangeCurrRing(r);
     173
    171174  ideal M = idInit(1);
    172175  M->m[0] = p_Init(r);
     
    176179  p_Setm(M->m[0],r); p_Test(M->m[0],r);
    177180
     181  // for (int i=1; i<100; i++)
     182  // {
     183  //   omUpdateInfo();
     184  //   Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);
     185  //   ideal J = id_Copy(I,r); bool b; int k = 0;
     186  //   intvec* nullVector = NULL;
     187  //   do
     188  //   {
     189  //     ideal Jstd = kStd(J,currRing->qideal,testHomog,&nullVector);
     190  //     ideal JquotM = idQuot(Jstd,M,true,true);
     191  //     ideal JquotMredJ = kNF(Jstd,currRing->qideal,JquotM);
     192  //     b = idIs0(JquotMredJ);
     193  //     id_Delete(&Jstd,r);
     194  //     id_Delete(&J,r);
     195  //     J = JquotM;
     196  //     id_Delete(&JquotMredJ,r);
     197  //     k++;
     198  //   } while (!b);
     199  //   id_Delete(&J,r);
     200  // }
     201
    178202  ideal J = id_Copy(I,r); bool b; int k = 0;
    179203  if (currRing != r) rChangeCurrRing(r);
     
    182206  {
    183207    ideal Jstd = kStd(J,currRing->qideal,testHomog,&nullVector);
    184     ideal JquotM = idQuot(Jstd,M,true,true); k++;
     208    ideal JquotM = idQuot(Jstd,M,true,true);
    185209    ideal JquotMredJ = kNF(Jstd,currRing->qideal,JquotM);
    186210    b = idIs0(JquotMredJ);
    187     id_Delete(&Jstd,r); id_Delete(&J,r); J = JquotM;
     211    id_Delete(&Jstd,r);
     212    id_Delete(&J,r);
     213    J = JquotM;
    188214    id_Delete(&JquotMredJ,r);
     215    k++;
    189216  } while (!b);
    190217
    191   if (currRing != origin) rChangeCurrRing(origin);
    192218  poly monom = NULL;
    193219  if (id_IsConstant(J,r))
     
    201227  id_Delete(&M,r);
    202228  id_Delete(&J,r);
     229
     230  if (currRing != origin)
     231    rChangeCurrRing(origin);
    203232  return monom;
    204233}
  • Singular/dyn_modules/gfanlib/groebnerCone.cc

    r4b47563 rbf83d3  
    339339  assume(checkPolyhedralInput(polyhedralCone,interiorPoint));
    340340  if (polynomialIdeal) id_Delete(&polynomialIdeal,polynomialRing);
     341  if (reducedPolynomialIdeal) id_Delete(&reducedPolynomialIdeal,polynomialRing);
     342  if (initialPolynomialIdeal) id_Delete(&initialPolynomialIdeal,polynomialRing);
    341343  if (polynomialRing) rDelete(polynomialRing);
    342344}
     
    440442   *   to obtain an initial form with respect to interiorPoint+e*facetNormal,
    441443   *   for e>0 sufficiently small */
    442   std::pair<ideal,ring> flipped = currentStrategy->getFlip(reducedPolynomialIdeal,polynomialRing,interiorPoint,facetNormal);
     444  std::pair<ideal,ring> flipped = currentStrategy->computeFlip(reducedPolynomialIdeal,polynomialRing,interiorPoint,facetNormal);
    443445  assume(checkPolynomialInput(flipped.first,flipped.second));
    444446  groebnerCone flippedCone(flipped.first, flipped.second, interiorPoint, facetNormal, *currentStrategy);
     447  id_Delete(&flipped.first,flipped.second);
     448  rDelete(flipped.second);
    445449  return flippedCone;
    446450}
     
    506510{
    507511  std::pair<gfan::ZMatrix, gfan::ZMatrix> facetsData = interiorPointsAndNormalsOfFacets(polyhedralCone);
     512
    508513  gfan::ZMatrix interiorPoints = facetsData.first;
    509514  gfan::ZMatrix facetNormals = facetsData.second;
     
    520525        continue;
    521526    }
    522     neighbours.insert(this->flipCone(interiorPoints[i],facetNormals[i]));
     527    neighbours.insert(flipCone(interiorPoints[i],facetNormals[i]));
    523528  }
    524529  return neighbours;
     
    597602          neighbours.insert(neighbour);
    598603        }
     604      id_Delete(&initialIdeal,polynomialRing);
    599605    }
    600606  }
     
    616622    return new gfan::ZFan(gfan::ZFan::fullFan(currRing->N));
    617623}
     624
     625
     626#ifndef NDEBUG
     627
     628BOOLEAN flipConeDebug(leftv res, leftv args)
     629{
     630  leftv u = args;
     631  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
     632  {
     633    leftv v = u->next;
     634    if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
     635    {
     636      leftv w = v->next;
     637      if ((w!=NULL) && (w->Typ()==BIGINTMAT_CMD))
     638      {
     639        leftv x = w->next;
     640        if ((x!=NULL) && (x->Typ()==BIGINTMAT_CMD))
     641        {
     642          omUpdateInfo();
     643          Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);
     644
     645          ideal I = (ideal) u->CopyD();
     646          number p = (number) v->CopyD();
     647          bigintmat* interiorPoint0 = (bigintmat*) w->CopyD();
     648          bigintmat* facetNormal0 = (bigintmat*) x->CopyD();
     649          tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing);
     650
     651          gfan::ZVector* interiorPoint = bigintmatToZVector(interiorPoint0);
     652          gfan::ZVector* facetNormal = bigintmatToZVector(facetNormal0);
     653
     654          groebnerCone sigma(I,currRing,debug);
     655          groebnerCone theta = sigma.flipCone(*interiorPoint,*facetNormal);
     656
     657          id_Delete(&I,currRing);
     658          n_Delete(&p,currRing->cf);
     659          delete interiorPoint0;
     660          delete facetNormal0;
     661          delete interiorPoint;
     662          delete facetNormal;
     663
     664          res->rtyp = NONE;
     665          res->data = NULL;
     666          return FALSE;
     667        }
     668      }
     669    }
     670  }
     671  WerrorS("computeFlipDebug: unexpected parameters");
     672  return TRUE;
     673}
     674
     675BOOLEAN groebnerNeighboursDebug(leftv res, leftv args)
     676{
     677  leftv u = args;
     678  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
     679  {
     680    leftv v = u->next;
     681    if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
     682    {
     683      omUpdateInfo();
     684      Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);
     685
     686      ideal I = (ideal) u->CopyD();
     687      number p = (number) v->CopyD();
     688
     689      tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing);
     690      groebnerCone sigma(I,currRing,debug);
     691      groebnerCones neighbours = sigma.groebnerNeighbours();
     692
     693      id_Delete(&I,currRing);
     694      n_Delete(&p,currRing->cf);
     695      res->rtyp = NONE;
     696      res->data = NULL;
     697      return FALSE;
     698    }
     699  }
     700  WerrorS("computeFlipDebug: unexpected parameters");
     701  return TRUE;
     702}
     703
     704BOOLEAN tropicalNeighboursDebug(leftv res, leftv args)
     705{
     706  leftv u = args;
     707  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
     708  {
     709    leftv v = u->next;
     710    if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
     711    {
     712      omUpdateInfo();
     713      Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);
     714
     715      ideal I = (ideal) u->CopyD();
     716      number p = (number) v->CopyD();
     717
     718      tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing);
     719      groebnerCone sigma(I,currRing,debug);
     720      groebnerCones neighbours = sigma.groebnerNeighbours();
     721
     722      id_Delete(&I,currRing);
     723      n_Delete(&p,currRing->cf);
     724      res->rtyp = NONE;
     725      res->data = NULL;
     726      return FALSE;
     727    }
     728  }
     729  WerrorS("computeFlipDebug: unexpected parameters");
     730  return TRUE;
     731}
     732#endif
  • Singular/dyn_modules/gfanlib/groebnerCone.h

    r4b47563 rbf83d3  
    121121gfan::ZFan* toFanStar(groebnerCones setOfCones);
    122122
     123#ifndef NDEBUG
     124BOOLEAN flipConeDebug(leftv res, leftv args);
     125BOOLEAN groebnerNeighboursDebug(leftv res, leftv args);
     126BOOLEAN tropicalNeighboursDebug(leftv res, leftv args);
    123127#endif
     128
     129#endif
  • Singular/dyn_modules/gfanlib/tropical.cc

    r4b47563 rbf83d3  
    174174{
    175175  leftv u = args;
    176   if ((u != NULL) && (u->Typ() == POLY_CMD) && (u->next == NULL))
     176  if ((u != NULL) && (u->Typ() == POLY_CMD))
    177177  {
    178178    leftv v = u->next;
     
    194194        weightVector = bigintmatToZVector(*w1);
    195195      }
    196       res->rtyp = IDEAL_CMD;
     196      res->rtyp = POLY_CMD;
    197197      res->data = (void*) initial(p, currRing, *weightVector);
    198198      delete weightVector;
     
    200200    }
    201201  }
    202   if ((u != NULL) && (u->Typ() == IDEAL_CMD) && (u->next == NULL))
     202  if ((u != NULL) && (u->Typ() == IDEAL_CMD))
    203203  {
    204204    leftv v = u->next;
     
    220220        weightVector = bigintmatToZVector(*w1);
    221221      }
    222       res->rtyp = POLY_CMD;
     222      res->rtyp = IDEAL_CMD;
    223223      res->data = (void*) initial(I, currRing, *weightVector);
    224224      delete weightVector;
     
    260260  // p->iiAddCproc("","tropicalCurve1",FALSE,tropicalCurve1);
    261261  p->iiAddCproc("","reduceInitiallyDebug",FALSE,reduceInitiallyDebug);
    262   p->iiAddCproc("","getWitnessDebug",FALSE,getWitnessDebug);
    263   p->iiAddCproc("","getFlipDebug",FALSE,getFlipDebug);
     262  p->iiAddCproc("","computeWitnessDebug",FALSE,computeWitnessDebug);
     263  p->iiAddCproc("","computeFlipDebug",FALSE,computeFlipDebug);
     264  p->iiAddCproc("","flipConeDebug",FALSE,flipConeDebug);
     265  p->iiAddCproc("","groebnerNeighboursDebug",FALSE,groebnerNeighboursDebug);
     266  p->iiAddCproc("","tropicalNeighboursDebug",FALSE,tropicalNeighboursDebug);
     267  p->iiAddCproc("","tropicalStarDebug",FALSE,tropicalStarDebug);
    264268  p->iiAddCproc("","tropicalStartingPoint",FALSE,tropicalStartingPoint);
    265269  p->iiAddCproc("","positiveTropicalStartingPoint",FALSE,positiveTropicalStartingPoint);
  • Singular/dyn_modules/gfanlib/tropicalCurves.cc

    r4b47563 rbf83d3  
    130130   * and compute the common refinement with its tropical variety.
    131131   * If all initial ideals are monomial free, then we have our tropical curve */
     132  // gfan::ZFan* zf = toFanStar(C);
     133  // std::cout << zf->toString();
     134  // delete zf;
    132135  for (std::set<gfan::ZCone>::iterator zc=C.begin(); zc!=C.end();)
    133136  {
     
    141144      inIs->m[j] = p_PermPoly(inI->m[j],NULL,r,s,identity,NULL,0);
    142145
    143     inIs = gfanlib_kStd_wrapper(inIs,s,isHomog);
    144     ideal ininIs = initial(inIs,s,w,W);
    145 
    146     poly mons = checkForMonomialViaSuddenSaturation(ininIs,s);
     146    ideal inIsSTD = gfanlib_kStd_wrapper(inIs,s,isHomog);
     147    ideal ininIs = initial(inIsSTD,s,w,W);
     148
     149    poly mons = currentStrategy.checkInitialIdealForMonomial(ininIs,s,w);
     150    // poly mons = checkForMonomialViaSuddenSaturation(ininIs,s);
    147151    if (mons)
    148152    {
    149       poly gs = witness(mons,inIs,ininIs,s);
     153      poly gs = witness(mons,inIsSTD,ininIs,s);
    150154      C = intersect(C,tropicalVariety(gs,s,currentStrategy),d);
    151155      nMapFunc mMap = n_SetMap(s->cf,r->cf);
     
    156160      p_Delete(&gs,s);
    157161      zc = C.begin();
     162      // gfan::ZFan* zf = toFanStar(C);
     163      // std::cout << zf->toString();
     164      // delete zf;
     165      id_Delete(&inIs,s);
     166      id_Delete(&inIsSTD,s);
     167      id_Delete(&ininIs,s);
     168      rDelete(s);
    158169    }
    159170    else
    160       zc++;
    161     id_Delete(&inIs,s);
    162     id_Delete(&ininIs,s);
    163     rDelete(s);
     171    {
     172      gfan::ZVector wNeg = -w;
     173      if (zc->contains(wNeg))
     174      {
     175        s = genericlyWeightedOrdering(r,u,wNeg,W,currentStrategy);
     176        identity = n_SetMap(r->cf,s->cf);
     177        inIs = idInit(k);
     178        for (int j=0; j<k; j++)
     179          inIs->m[j] = p_PermPoly(inI->m[j],NULL,r,s,identity,NULL,0);
     180
     181        inIsSTD = gfanlib_kStd_wrapper(inIs,s,isHomog);
     182        ininIs = initial(inIsSTD,s,wNeg,W);
     183
     184        mons = currentStrategy.checkInitialIdealForMonomial(ininIs,s,wNeg);
     185        // mons = checkForMonomialViaSuddenSaturation(ininIs,s);
     186        if (mons)
     187        {
     188          poly gs = witness(mons,inIsSTD,ininIs,s);
     189          C = intersect(C,tropicalVariety(gs,s,currentStrategy),d);
     190          nMapFunc mMap = n_SetMap(s->cf,r->cf);
     191          poly gr = p_PermPoly(gs,NULL,s,r,mMap,NULL,0);
     192          idInsertPoly(inI,gr);
     193          k++;
     194          p_Delete(&mons,s);
     195          p_Delete(&gs,s);
     196          zc = C.begin();
     197          // gfan::ZFan* zf = toFanStar(C);
     198          // std::cout << zf->toString();
     199          // delete zf;
     200        }
     201        else
     202          zc++;
     203        id_Delete(&inIs,s);
     204        id_Delete(&inIsSTD,s);
     205        id_Delete(&ininIs,s);
     206        rDelete(s);
     207      }
     208      else
     209        zc++;
     210    }
    164211  }
    165212  return C;
     
    170217{
    171218  std::set<gfan::ZCone> C = tropicalStar(I,r,u,currentStrategy);
     219  gfan::ZFan* zf = toFanStar(C);
     220  std::cout << zf->toString();
     221  delete zf;
    172222  gfan::ZMatrix raysOfC(0,u.size());
    173223  if (!currentStrategy.restrictToLowerHalfSpace())
     
    176226    {
    177227      assume(zc->dimensionOfLinealitySpace()+1 == zc->dimension());
    178       raysOfC.appendRow(zc->semiGroupGeneratorOfRay());
     228      gfan::ZMatrix ray = zc->extremeRays();
     229      raysOfC.appendRow(ray[0]);
    179230    }
    180231  }
     
    196247 **/
    197248#ifndef NDEBUG
    198 // BOOLEAN tropicalCurve0(leftv res, leftv args)
    199 // {
    200 //   leftv u = args;
    201 //   ideal I = (ideal) u->CopyD();
    202 //   leftv v = u->next;
    203 //   int d = (int)(long) v->CopyD();
    204 //   tropicalStrategy currentCase = nonValuedCase;
    205 //   std::set<gfan::ZCone> C = tropicalCurve(I,currRing,d,currentCase);
    206 //   id_Delete(&I,currRing);
    207 //   omUpdateInfo();
    208 //   Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);
    209 //   res->rtyp = fanID;
    210 //   res->data = (char*) toFanStar(C);
    211 //   return FALSE;
    212 // }
    213 // BOOLEAN tropicalCurve1(leftv res, leftv args)
    214 // {
    215 //   leftv u = args;
    216 //   ideal I = (ideal) u->CopyD();
    217 //   leftv v = u->next;
    218 //   int d = (int)(long) v->CopyD();
    219 //   tropicalStrategy currentCase = valuedCase;
    220 //   std::set<gfan::ZCone> C = tropicalCurve(I,currRing,d,currentCase);
    221 //   id_Delete(&I,currRing);
    222 //   omUpdateInfo();
    223 //   Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);
    224 //   res->rtyp = fanID;
    225 //   res->data = (char*) toFanStar(C);
    226 //   return FALSE;
    227 // }
     249BOOLEAN tropicalStarDebug(leftv res, leftv args)
     250{
     251  leftv u = args;
     252  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
     253  {
     254    leftv v = u->next;
     255    if ((v!=NULL) && (v->Typ()==BIGINTMAT_CMD))
     256    {
     257      omUpdateInfo();
     258      Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);
     259      ideal inI = (ideal) u->CopyD();
     260      bigintmat* u = (bigintmat*) v->CopyD();
     261      tropicalStrategy currentCase(inI,currRing);
     262      gfan::ZVector* v = bigintmatToZVector(u);
     263      std::set<gfan::ZCone> C = tropicalStar(inI,currRing,*v,currentCase);
     264      id_Delete(&inI,currRing);
     265      delete u;
     266      delete v;
     267      res->rtyp = fanID;
     268      res->data = (char*) toFanStar(C);
     269      return FALSE;
     270    }
     271  }
     272  WerrorS("tropicalStarDebug: unexpected parameters");
     273  return TRUE;
     274}
    228275#endif
  • Singular/dyn_modules/gfanlib/tropicalCurves.h

    r4b47563 rbf83d3  
    1313
    1414#ifndef NDEBUG
    15 BOOLEAN tropicalCurve0(leftv res, leftv args);
    16 BOOLEAN tropicalCurve1(leftv res, leftv args);
     15BOOLEAN tropicalStarDebug(leftv res, leftv args);
    1716#endif
    1817
  • Singular/dyn_modules/gfanlib/tropicalStrategy.cc

    r4b47563 rbf83d3  
    55#include <tropical.h>
    66#include <std_wrapper.h>
     7#include <tropicalCurves.h>
    78
    89// for various commands in dim(ideal I, ring r):
     
    4142}
    4243
    43 static bool noExtraReduction(ideal /*I*/, ring /*r*/, number /*p*/)
    44 {
     44static void swapElements(ideal I, ideal J)
     45{
     46  assume(idSize(I)==idSize(J));
     47
     48  for (int i=0; i<idSize(I); i++)
     49  {
     50    poly cache = I->m[i];
     51    I->m[i] = J->m[i];
     52    J->m[i] = cache;
     53  }
     54
     55  return;
     56}
     57
     58static bool noExtraReduction(ideal I, ring r, number /*p*/)
     59{
     60  int n = rVar(r);
     61  gfan::ZVector allOnes(n);
     62  for (int i=0; i<n; i++)
     63    allOnes[i] = 1;
     64  ring rShortcut = rCopy0(r);
     65
     66  int* order = rShortcut->order;
     67  int* block0 = rShortcut->block0;
     68  int* block1 = rShortcut->block1;
     69  int** wvhdl = rShortcut->wvhdl;
     70
     71  int h = rBlocks(r);
     72  rShortcut->order = (int*) omAlloc0((h+1)*sizeof(int));
     73  rShortcut->block0 = (int*) omAlloc0((h+1)*sizeof(int));
     74  rShortcut->block1 = (int*) omAlloc0((h+1)*sizeof(int));
     75  rShortcut->wvhdl = (int**) omAlloc0((h+1)*sizeof(int*));
     76  rShortcut->order[0] = ringorder_a;
     77  rShortcut->block0[0] = 1;
     78  rShortcut->block1[0] = n;
     79  bool overflow;
     80  rShortcut->wvhdl[0] = ZVectorToIntStar(allOnes,overflow);
     81  for (int i=1; i<=h; i++)
     82  {
     83    rShortcut->order[i] = order[i-1];
     84    rShortcut->block0[i] = block0[i-1];
     85    rShortcut->block1[i] = block1[i-1];
     86    rShortcut->wvhdl[i] = wvhdl[i-1];
     87  }
     88
     89  rComplete(rShortcut);
     90  rTest(rShortcut);
     91
     92  omFree(order);
     93  omFree(block0);
     94  omFree(block1);
     95  omFree(wvhdl);
     96
     97  int k = idSize(I);
     98  ideal IShortcut = idInit(k);
     99  nMapFunc intoShortcut = n_SetMap(r->cf,rShortcut->cf);
     100  for (int i=0; i<k; i++)
     101    IShortcut->m[i] = p_PermPoly(I->m[i],NULL,r,rShortcut,intoShortcut,NULL,0);
     102
     103  ideal JShortcut = gfanlib_kStd_wrapper(IShortcut,rShortcut);
     104
     105  ideal J = idInit(k);
     106  nMapFunc outofShortcut = n_SetMap(rShortcut->cf,r->cf);
     107  for (int i=0; i<k; i++)
     108    J->m[i] = p_PermPoly(JShortcut->m[i],NULL,rShortcut,r,outofShortcut,NULL,0);
     109
     110  swapElements(I,J);
     111  id_Delete(&IShortcut,rShortcut);
     112  id_Delete(&JShortcut,rShortcut);
     113  rDelete(rShortcut);
     114  id_Delete(&J,r);
    45115  return false;
    46116}
     
    313383  id_Test(I,r);
    314384
    315   if (isValuationTrivial())
    316     return false;
    317 
    318385  nMapFunc identity = n_SetMap(startingRing->cf,r->cf);
    319386  number p = identity(uniformizingParameter,startingRing->cf,r->cf);
     
    413480  {
    414481    monomial=p_One(r);
    415     for (int i=1; i<n; i++)
     482    for (int i=1; i<=n; i++)
    416483      p_SetExp(monomial,i,p_GetExp(p,i,rShortcut),r);
    417484    p_Delete(&p,rShortcut);
     
    433500}
    434501
    435 ideal tropicalStrategy::getWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const
     502ideal tropicalStrategy::computeWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const
    436503{
    437504  // if the valuation is trivial and the ring and ideal have not been extended,
     
    555622    inJr->m[i] = p_PermPoly(inJs->m[i],NULL,s,r,identitysr,NULL,0);
    556623
    557   ideal Jr = getWitness(inJr,inIr,Ir,r);
     624  ideal Jr = computeWitness(inJr,inIr,Ir,r);
    558625  nMapFunc identityrs = n_SetMap(r->cf,s->cf);
    559626  ideal Js = idInit(k);
     
    644711}
    645712
    646 std::pair<ideal,ring> tropicalStrategy::getFlip(const ideal Ir, const ring r,
    647                                                 const gfan::ZVector interiorPoint,
    648                                                 const gfan::ZVector facetNormal) const
     713std::pair<ideal,ring> tropicalStrategy::computeFlip(const ideal Ir, const ring r,
     714                                                    const gfan::ZVector interiorPoint,
     715                                                    const gfan::ZVector facetNormal) const
    649716{
    650717  assume(isValuationTrivial() || interiorPoint[0].sign()<0);
     
    670737    inJr->m[i] = p_PermPoly(inJsAdjusted->m[i],NULL,sAdjusted,r,identity,NULL,0);
    671738
    672   ideal Jr = getWitness(inJr,inIr,Ir,r);
     739  ideal Jr = computeWitness(inJr,inIr,Ir,r);
    673740  ring s = copyAndChangeOrderingLS(r,interiorPoint,facetNormal);
    674741  identity = n_SetMap(r->cf,s->cf);
     
    769836  return false;
    770837}
    771 
    772 
    773838
    774839#ifndef NDEBUG
     
    812877}
    813878
    814 BOOLEAN getWitnessDebug(leftv res, leftv args)
     879BOOLEAN computeWitnessDebug(leftv res, leftv args)
    815880{
    816881  leftv u = args;
     
    834899          number p = (number) x->CopyD();
    835900          tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing);
    836           ideal J = debug.getWitness(inJ,inI,I,currRing);
     901          ideal J = debug.computeWitness(inJ,inI,I,currRing);
    837902          id_Delete(&inJ,currRing);
    838903          id_Delete(&inI,currRing);
     
    849914}
    850915
    851 BOOLEAN getFlipDebug(leftv res, leftv args)
     916BOOLEAN computeFlipDebug(leftv res, leftv args)
    852917{
    853918  leftv u = args;
     
    874939          gfan::ZVector* interiorPoint = bigintmatToZVector(interiorPoint0);
    875940          gfan::ZVector* facetNormal = bigintmatToZVector(facetNormal0);
    876           std::pair<ideal,ring> Js = debug.getFlip(I,currRing,*interiorPoint,*facetNormal);
     941          std::pair<ideal,ring> Js = debug.computeFlip(I,currRing,*interiorPoint,*facetNormal);
    877942          ideal J = Js.first;
    878943          ring s = Js.second;
     
    895960    }
    896961  }
    897   WerrorS("getFlipDebug: unexpected parameters");
     962  WerrorS("computeFlipDebug: unexpected parameters");
    898963  return TRUE;
    899964}
  • Singular/dyn_modules/gfanlib/tropicalStrategy.h

    r4b47563 rbf83d3  
    136136#ifndef NDEBUG
    137137  tropicalStrategy();
    138 
    139138  static tropicalStrategy debugStrategy(const ideal startIdeal, number unifParameter, ring startRing);
    140139#endif
     
    233232
    234233  /**
    235    * returns the dimension of the homogeneity space
    236    */
    237   int getDimensionOfHomogeneitySpace() const
    238   {
    239     return linealitySpace.dimension();
    240   }
    241 
    242   /**
    243234   * returns true, if valuation non-trivial, false otherwise
    244235   */
     
    276267
    277268  /**
    278    * Returns a copy of the shortcutRing which is weighted with respect to w first and v second.
    279    * If valuation trivial, the coefficient ring will be the field with valuation.
    280    * If valuation non-trivial, the coefficient ring will be the residue field.
    281    */
    282   ring getShortcutRingDoublyWeighted(const gfan::ZVector w, const gfan::ZVector v) const;
    283 
    284   /**
    285    * copies r and prepends extra weight w
    286    */
    287   ring copyAndPrependWeight(const ring r, const gfan::ZVector w) const;
    288 
    289   /**
    290    * changes the coefficient ring of r to be the residue field
    291    */
    292   void changeCoefficientToResidueField(ring r) const;
    293 
    294   /**
    295269   * reduces the generators of an ideal I so that
    296270   * the inequalities and equations of the Groebner cone can be read off.
     
    301275
    302276  /**
    303    * returns true, if I contains a monomial.
    304    * returns false otherwise.
     277   * If given w, assuming w is in the Groebner cone of the ordering on r
     278   * and I is a standard basis with respect to that ordering,
     279   * checks whether the initial ideal of I with respect to w contains a monomial.
     280   * If no w is given, assuming that I is already an initial form of some ideal,
     281   * checks whether I contains a monomial.
     282   * In both cases returns a monomial, if it contains one, returns NULL otherwise.
    305283   **/
    306   poly checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector w) const;
     284  poly checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector w=0) const;
     285
     286  /**
     287   * given generators of the initial ideal, computes its standard basis
     288   */
     289  ideal computeStdOfInitialIdeal(const ideal inI, const ring r) const;
    307290
    308291  /**
     
    315298   * then the returned J will be a standard baiss of the ideal w.r.t. >'
    316299   */
    317   ideal getWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const;
     300  ideal computeWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const;
    318301
    319302  ideal computeLift(const ideal inJs, const ring s, const ideal inIr, const ideal Ir, const ring r) const;
    320 
    321   /**
    322    * given generators of the initial ideal, computes its standard basis
    323    */
    324   ideal computeStdOfInitialIdeal(const ideal inI, const ring r) const;
    325303
    326304  /**
     
    328306   * computes the groebner cone adjacent to it
    329307   */
    330   std::pair<ideal,ring> getFlip(const ideal Ir, const ring r, const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const;
     308  std::pair<ideal,ring> computeFlip(const ideal Ir, const ring r, const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const;
    331309};
    332310
    333 int dim(ideal I, ring r);
    334 
    335311#ifndef NDEBUG
    336 BOOLEAN getWitnessDebug(leftv res, leftv args);
    337 BOOLEAN getFlipDebug(leftv res, leftv args);
     312BOOLEAN computeWitnessDebug(leftv res, leftv args);
     313BOOLEAN computeFlipDebug(leftv res, leftv args);
    338314#endif
    339315
  • Singular/dyn_modules/gfanlib/tropicalVariety.cc

    r4b47563 rbf83d3  
    7878        number p = (number) v->Data();
    7979        tropicalStrategy currentStrategy(I,p,currRing);
    80         std::set<gfan::ZCone> maxCones = tropicalVariety(g,currRing,currentStrategy);
     80        ideal startingIdeal = currentStrategy.getStartingIdeal();
     81        ideal startingRing = currentStrategy.getStartingRing();
     82        poly gStart = startingIdeal->m[0];
     83        std::set<gfan::ZCone> maxCones = tropicalVariety(gStart,startingRing,currentStrategy);
    8184        res->rtyp = fanID;
    8285        res->data = (char*) toZFan(maxCones);
Note: See TracChangeset for help on using the changeset viewer.