Changeset 9c0326 in git


Ignore:
Timestamp:
Sep 10, 2014, 5:43:31 PM (10 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'fc741b6502fd8a97288eaa3eba6e5220f3c3df87')
Children:
b71400abefd0c9c66c0009063f40ddd5b1f1c4c7
Parents:
eacb78146504ca284c1888c739cb1aade67c8520
git-author:
Yue Ren <ren@mathematik.uni-kl.de>2014-09-10 17:43:31+02:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:04+01:00
Message:
chg: status update 12.09.
Files:
1 deleted
14 edited

Legend:

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

    reacb781 r9c0326  
    16071607  WerrorS("facetContaining: unexpected parameters");
    16081608  return TRUE;
     1609}
     1610
     1611
     1612BOOLEAN memleaktest(leftv res, leftv args)
     1613{
     1614  bigintmat* ineq = NULL;
     1615  if (args->Typ() == INTMAT_CMD)
     1616  {
     1617    intvec* ineq0 = (intvec*) args->Data();
     1618    ineq = iv2bim(ineq0,coeffs_BIGINT);
     1619  }
     1620  else
     1621    ineq = (bigintmat*) args->Data();
     1622  gfan::ZMatrix* zm = bigintmatToZMatrix(ineq);
     1623  gfan::ZCone* zc = new gfan::ZCone(*zm, gfan::ZMatrix(0, zm->getWidth()));
     1624  delete zm;
     1625  if (args->Typ() == INTMAT_CMD)
     1626    delete ineq;
     1627  res->rtyp = coneID;
     1628  res->data = (void*) zc;
     1629  return FALSE;
    16091630}
    16101631
     
    16641685  p->iiAddCproc("","listOfFacets",FALSE,listOfFacets);
    16651686  p->iiAddCproc("","facetContaining",FALSE,facetContaining);
     1687  p->iiAddCproc("","memleaktest",FALSE,memleaktest);
    16661688  coneID=setBlackboxStuff(b,"cone");
    16671689}
  • Singular/dyn_modules/gfanlib/flip.cc

    reacb781 r9c0326  
    3838 *  (2) Is is a Groebner basis of the same ideal with respect to the ordering on s
    3939 **/
    40 std::pair<ideal,ring> flip0(const ideal I, const ring r,
    41                             const gfan::ZVector interiorPoint,
    42                             const gfan::ZVector facetNormal,
    43                             const gfan::ZVector adjustedInteriorPoint,
    44                             const gfan::ZVector adjustedFacetNormal)
     40std::pair<ideal,ring> flip(const ideal I, const ring r,
     41                           const gfan::ZVector interiorPoint,
     42                           const gfan::ZVector facetNormal,
     43                           const gfan::ZVector adjustedInteriorPoint,
     44                           const gfan::ZVector adjustedFacetNormal)
    4545{
    4646  /* create a ring with weighted ordering  */
     
    7878  rChangeCurrRing(sAdjusted);
    7979  ideal inIsAdjustedGB = kStd(inIsAdjusted,currRing->qideal,testHomog,&nullVector);
     80  ideal IsAdjustedGB = lift(I,r,inIsAdjustedGB,sAdjusted);
    8081  id_Delete(&inIsAdjusted,sAdjusted);
    81   ideal IsAdjustedGB = lift(I,r,inIsAdjustedGB,sAdjusted);
    8282  id_Delete(&inIsAdjustedGB,sAdjusted);
    8383
  • Singular/dyn_modules/gfanlib/flip.h

    reacb781 r9c0326  
    66#include <gfanlib/gfanlib_vector.h>
    77
    8 std::pair<ideal,ring> flip0(const ideal I, const ring r,
    9                             const gfan::ZVector interiorPoint,
    10                             const gfan::ZVector facetNormal,
    11                             const gfan::ZVector adjustedInteriorPoint,
    12                             const gfan::ZVector adjustedFacetNormal);
     8std::pair<ideal,ring> flip(const ideal I, const ring r,
     9                           const gfan::ZVector interiorPoint,
     10                           const gfan::ZVector facetNormal,
     11                           const gfan::ZVector adjustedInteriorPoint,
     12                           const gfan::ZVector adjustedFacetNormal);
    1313
    1414#endif
  • Singular/dyn_modules/gfanlib/groebnerCone.cc

    reacb781 r9c0326  
    1212#include <gfanlib/gfanlib_matrix.h>
    1313
     14#include <initial.h>
    1415#include <tropicalStrategy.h>
    1516#include <groebnerCone.h>
     
    5758groebnerCone::groebnerCone():
    5859  polynomialIdeal(NULL),
     60  reducedPolynomialIdeal(NULL),
     61  initialPolynomialIdeal(NULL),
    5962  polynomialRing(NULL),
    6063  polyhedralCone(gfan::ZCone(0)),
     
    6669groebnerCone::groebnerCone(const ideal I, const ring r, const tropicalStrategy& currentCase):
    6770  polynomialIdeal(NULL),
     71  reducedPolynomialIdeal(NULL),
     72  initialPolynomialIdeal(NULL),
    6873  polynomialRing(NULL),
    6974  currentStrategy(&currentCase)
    7075{
    7176  assume(checkPolynomialInput(I,r));
    72   if (I) polynomialIdeal = id_Copy(I,r);
     77  if (I)
     78  {
     79    polynomialIdeal = id_Copy(I,r);
     80    reducedPolynomialIdeal = id_Copy(I,r);
     81  }
    7382  if (r) polynomialRing = rCopy(r);
    74   currentCase.reduce(I,r);
     83  currentCase.reduce(reducedPolynomialIdeal,polynomialRing);
    7584
    7685  int n = rVar(polynomialRing);
     
    8190  gfan::ZVector tailexpw = gfan::ZVector(n);
    8291  gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
    83   for (int i=0; i<idSize(polynomialIdeal); i++)
    84   {
    85     g = I->m[i];
     92  for (int i=0; i<idSize(reducedPolynomialIdeal); i++)
     93  {
     94    g = reducedPolynomialIdeal->m[i];
    8695    if (g)
    8796    {
     
    110119  polyhedralCone.canonicalize();
    111120  interiorPoint = polyhedralCone.getRelativeInteriorPoint();
     121  initialPolynomialIdeal = sloppyInitial(reducedPolynomialIdeal,polynomialRing,interiorPoint);
    112122  assume(checkOrderingAndCone(polynomialRing,polyhedralCone));
    113123}
     
    122132groebnerCone::groebnerCone(const ideal I, const ring r, const gfan::ZVector& w, const tropicalStrategy& currentCase):
    123133  polynomialIdeal(NULL),
     134  reducedPolynomialIdeal(NULL),
     135  initialPolynomialIdeal(NULL),
    124136  polynomialRing(NULL),
    125137  currentStrategy(&currentCase)
    126138{
    127139  assume(checkPolynomialInput(I,r));
    128   if (I) polynomialIdeal = id_Copy(I,r);
     140  if (I)
     141  {
     142    polynomialIdeal = id_Copy(I,r);
     143    reducedPolynomialIdeal = id_Copy(I,r);
     144  }
    129145  if (r) polynomialRing = rCopy(r);
    130   currentCase.reduce(I,r);
    131 
    132   int n = rVar(r);
     146  currentCase.reduce(reducedPolynomialIdeal,polynomialRing);
     147
     148  int n = rVar(polynomialRing);
    133149  gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
    134150  gfan::ZMatrix equations = gfan::ZMatrix(0,n);
    135151  int* expv = (int*) omAlloc((n+1)*sizeof(int));
    136   for (int i=0; i<idSize(polynomialIdeal); i++)
    137   {
    138     poly g = polynomialIdeal->m[i];
     152  for (int i=0; i<idSize(reducedPolynomialIdeal); i++)
     153  {
     154    poly g = reducedPolynomialIdeal->m[i];
    139155    if (g)
    140156    {
     
    167183  polyhedralCone.canonicalize();
    168184  interiorPoint = polyhedralCone.getRelativeInteriorPoint();
     185  initialPolynomialIdeal = sloppyInitial(reducedPolynomialIdeal,polynomialRing,interiorPoint);
    169186  assume(checkOrderingAndCone(polynomialRing,polyhedralCone));
    170187}
     
    176193groebnerCone::groebnerCone(const ideal I, const ring r, const gfan::ZVector& u, const gfan::ZVector& w, const tropicalStrategy& currentCase):
    177194  polynomialIdeal(NULL),
     195  reducedPolynomialIdeal(NULL),
     196  initialPolynomialIdeal(NULL),
    178197  polynomialRing(NULL),
    179198  currentStrategy(&currentCase)
    180199{
    181200  assume(checkPolynomialInput(I,r));
    182   if (I) polynomialIdeal = id_Copy(I,r);
     201  if (I)
     202  {
     203    polynomialIdeal = id_Copy(I,r);
     204    reducedPolynomialIdeal = id_Copy(I,r);
     205  }
    183206  if (r) polynomialRing = rCopy(r);
    184   currentCase.reduce(I,r);
    185 
    186   int n = rVar(r);
     207  currentCase.reduce(reducedPolynomialIdeal,polynomialRing);
     208
     209  int n = rVar(polynomialRing);
    187210  gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
    188211  gfan::ZMatrix equations = gfan::ZMatrix(0,n);
    189212  int* expv = (int*) omAlloc((n+1)*sizeof(int));
    190   for (int i=0; i<idSize(polynomialIdeal); i++)
    191   {
    192     poly g = polynomialIdeal->m[i];
     213  for (int i=0; i<idSize(reducedPolynomialIdeal); i++)
     214  {
     215    poly g = reducedPolynomialIdeal->m[i];
    193216    if (g)
    194217    {
     
    222245  polyhedralCone.canonicalize();
    223246  interiorPoint = polyhedralCone.getRelativeInteriorPoint();
     247  initialPolynomialIdeal = sloppyInitial(reducedPolynomialIdeal,polynomialRing,interiorPoint);
    224248  assume(checkOrderingAndCone(polynomialRing,polyhedralCone));
    225249}
     
    228252groebnerCone::groebnerCone(const ideal I, const ideal inI, const ring r, const tropicalStrategy& currentCase):
    229253  polynomialIdeal(id_Copy(I,r)),
     254  reducedPolynomialIdeal(id_Copy(I,r)),
     255  initialPolynomialIdeal(id_Copy(inI,r)),
    230256  polynomialRing(rCopy(r)),
    231257  currentStrategy(&currentCase)
     
    233259  assume(checkPolynomialInput(I,r));
    234260  assume(checkPolynomialInput(inI,r));
     261  currentStrategy->reduce(reducedPolynomialIdeal,polynomialRing);
     262  // currentStrategy->reduce(initialPolynomialIdeal,polynomialRing);
     263
    235264  int n = rVar(r);
    236265  gfan::ZMatrix equations = gfan::ZMatrix(0,n);
    237266  int* expv = (int*) omAlloc((n+1)*sizeof(int));
    238   for (int i=0; i<idSize(inI); i++)
    239   {
    240     poly g = inI->m[i];
     267  for (int i=0; i<idSize(initialPolynomialIdeal); i++)
     268  {
     269    poly g = initialPolynomialIdeal->m[i];
    241270    if (g)
    242271    {
     
    252281  }
    253282  gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
    254   for (int i=0; i<idSize(I); i++)
    255   {
    256     poly g = I->m[i];
     283  for (int i=0; i<idSize(reducedPolynomialIdeal); i++)
     284  {
     285    poly g = reducedPolynomialIdeal->m[i];
    257286    if (g)
    258287    {
     
    283312groebnerCone::groebnerCone(const groebnerCone &sigma):
    284313  polynomialIdeal(NULL),
     314  reducedPolynomialIdeal(NULL),
     315  initialPolynomialIdeal(NULL),
    285316  polynomialRing(NULL),
    286317  polyhedralCone(gfan::ZCone(sigma.getPolyhedralCone())),
     
    292323  assume(checkPolyhedralInput(sigma.getPolyhedralCone(),sigma.getInteriorPoint()));
    293324  if (sigma.getPolynomialIdeal()) polynomialIdeal = id_Copy(sigma.getPolynomialIdeal(),sigma.getPolynomialRing());
     325  if (sigma.getReducedPolynomialIdeal()) reducedPolynomialIdeal = id_Copy(sigma.getReducedPolynomialIdeal(),sigma.getPolynomialRing());
     326  if (sigma.getInitialPolynomialIdeal()) initialPolynomialIdeal = id_Copy(sigma.getInitialPolynomialIdeal(),sigma.getPolynomialRing());
    294327  if (sigma.getPolynomialRing()) polynomialRing = rCopy(sigma.getPolynomialRing());
    295328}
     
    333366  {
    334367    assume(!currentStrategy->restrictToLowerHalfSpace() || R[i][0].sign()<=0);
     368    if (currentStrategy->restrictToLowerHalfSpace() && R[i][0].sign()==0)
     369      continue;
    335370    poly s = currentStrategy->checkInitialIdealForMonomial(I,r,R[i]);
    336371    if (s==NULL)
     
    355390    return false;
    356391  }
     392  if (polyhedralCone.containsRelatively(interiorPoint))
     393  {
     394    std::cout << "ERROR: interiorPoint is contained in the interior of the maximal Groebner cone!" << std::endl
     395              << "cone: " << std::endl
     396              << toString(&polyhedralCone)
     397              << "interiorPoint:" << std::endl
     398              << interiorPoint << std::endl;
     399    return false;
     400  }
    357401  gfan::ZCone hopefullyAFacet = polyhedralCone.faceContaining(interiorPoint);
    358402  if (hopefullyAFacet.dimension()!=(polyhedralCone.dimension()-1))
     
    379423}
    380424
    381 /***
     425/**
    382426 * Given an interior point on the facet and the outer normal factor on the facet,
    383427 * returns the adjacent groebnerCone sharing that facet
    384  **/
     428 */
    385429groebnerCone groebnerCone::flipCone(const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const
    386430{
     
    391435   *   to obtain an initial form with respect to interiorPoint+e*facetNormal,
    392436   *   for e>0 sufficiently small */
    393   std::pair<ideal,ring> flipped = currentStrategy->flip(polynomialIdeal,polynomialRing,interiorPoint,facetNormal);
    394   std::cout << "finished flip" << std::endl;
     437  std::pair<ideal,ring> flipped = currentStrategy->flip(reducedPolynomialIdeal,polynomialRing,interiorPoint,facetNormal);
    395438  assume(checkPolynomialInput(flipped.first,flipped.second));
    396439  groebnerCone flippedCone(flipped.first, flipped.second, interiorPoint, facetNormal, *currentStrategy);
     
    464507  for (int i=0; i<interiorPoints.getHeight(); i++)
    465508  {
    466     std::cout << "performing flip " << i << " out of " << interiorPoints.getHeight() << std::endl;
     509    gfan::ZVector w = interiorPoints[i];
     510    gfan::ZVector v = facetNormals[i];
     511    if (currentStrategy->restrictToLowerHalfSpace())
     512    {
     513      assume(w[0].sign()<=0);
     514      if (w[0].sign()==0 && v[0].sign()>0)
     515        continue;
     516    }
    467517    neighbours.insert(this->flipCone(interiorPoints[i],facetNormals[i]));
    468518  }
  • Singular/dyn_modules/gfanlib/groebnerCone.h

    reacb781 r9c0326  
    3535  ideal polynomialIdeal;
    3636  /**
     37   * reduced form of the ideal from which the equations and inequalities can be read
     38   */
     39  ideal reducedPolynomialIdeal;
     40  /**
     41   * generators of the initial ideal
     42   */
     43  ideal initialPolynomialIdeal;
     44  /**
    3745   * ring in which the ideal exists
    3846   */
     
    4048  gfan::ZCone polyhedralCone;
    4149  gfan::ZVector interiorPoint;
    42   gfan::ZVector negativePointInLineality;
    4350  const tropicalStrategy* currentStrategy;
    4451
     
    6774
    6875  ideal getPolynomialIdeal() const { return polynomialIdeal; };
     76  ideal getReducedPolynomialIdeal() const { return reducedPolynomialIdeal; };
     77  ideal getInitialPolynomialIdeal() const { return initialPolynomialIdeal; };
    6978  ring getPolynomialRing() const { return polynomialRing; };
    7079  gfan::ZCone getPolyhedralCone() const { return polyhedralCone; };
    7180  gfan::ZVector getInteriorPoint() const { return interiorPoint; };
    72   gfan::ZVector getNegativePointInLineality() const { return negativePointInLineality; };
    7381  const tropicalStrategy* getTropicalStrategy() const {return currentStrategy; };
    7482
  • Singular/dyn_modules/gfanlib/initial.cc

    reacb781 r9c0326  
    3939}
    4040
    41 /***
     41/**
    4242 * Checks if p is sorted with respect to w.
    43  **/
     43 */
    4444static bool checkSloppyInput(const poly p, const ring r, const gfan::ZVector w)
    4545{
  • Singular/dyn_modules/gfanlib/lift.cc

    reacb781 r9c0326  
    99 * the ordering of s.
    1010 **/
    11 ideal lift(const ideal I, const ring r, const ideal inI, const ring s)
     11// ideal lift(const ideal I, const ring r, const ideal inI, const ring s)
     12// {
     13//   nMapFunc identity = n_SetMap(r->cf,s->cf);
     14//   int k = idSize(I); ideal Is = idInit(k);
     15//   for (int i=0; i<k; i++)
     16//     Is->m[i] = p_PermPoly(I->m[i],NULL,r,s,identity,NULL,0);
     17//   ideal J = idInit(k);
     18//   for (int i=0; i<k; i++)
     19//     J->m[i] = witness(inI->m[i],Is,inI,s);
     20//   id_Delete(&Is,s);
     21//   return J;
     22// }
     23
     24ideal lift(const ideal J, const ring r, const ideal inI, const ring s)
    1225{
    13   nMapFunc identity = n_SetMap(r->cf,s->cf);
    14   int k = idSize(I); ideal Is = idInit(k);
     26  nMapFunc identity = n_SetMap(s->cf,r->cf);
     27  int k = idSize(inI); ideal inIr = idInit(k);
    1528  for (int i=0; i<k; i++)
    16     Is->m[i] = p_PermPoly(I->m[i],NULL,r,s,identity,NULL,0);
    17   ideal J = idInit(k);
     29    inIr->m[i] = p_PermPoly(inI->m[i],NULL,s,r,identity,NULL,0);
     30  ideal Ir = witness(inIr,J,r);
     31
     32  identity = n_SetMap(r->cf,s->cf);
     33  ideal Is = idInit(k);
    1834  for (int i=0; i<k; i++)
    19     J->m[i] = witness(inI->m[i],Is,inI,s);
    20   id_Delete(&Is,s);
    21   return J;
     35    Is->m[i] = p_PermPoly(Ir->m[i],NULL,r,s,identity,NULL,0);
     36
     37  id_Delete(&inIr,r);
     38  id_Delete(&Ir,r);
     39  return Is;
    2240}
  • Singular/dyn_modules/gfanlib/startingCone.cc

    reacb781 r9c0326  
    457457
    458458    ideal J = lift(I,r,inI,s);
     459    // currentStrategy.reduce(J,s);
    459460    groebnerCone startingCone(J,inI,s,currentStrategy);
    460461    id_Delete(&inI,s);
  • Singular/dyn_modules/gfanlib/tropicalStrategy.cc

    reacb781 r9c0326  
    44#include <ttinitialReduction.h>
    55#include <tropical.h>
     6#include <std_wrapper.h>
    67
    78// for various commands in dim(ideal I, ring r):
     
    2324  {
    2425    int i = idPosConstant(I);
    25     if ((i != -1) && (n_IsUnit(pGetCoeff(I->m[i]),currRing->cf)))
     26    if ((i != -1) && (n_IsUnit(p_GetCoeff(I->m[i],currRing->cf),currRing->cf)))
    2627      return -1;
    2728    ideal vv = id_Head(I,currRing);
     
    6667{
    6768  assume(rField_is_Q(r) || rField_is_Zp(r));
     69  startingIdeal = gfanlib_kStd_wrapper(startingIdeal,startingRing);
    6870  if (!completelyHomogeneous)
    6971  {
     
    174176    startingIdeal->m[i+1] = p_PermPoly(J->m[i],shiftByOne,originalRing,startingRing,nMap,NULL,0);
    175177  omFreeSize(shiftByOne,(n+1)*sizeof(int));
     178  startingIdeal = gfanlib_kStd_wrapper(startingIdeal,startingRing);
    176179
    177180  linealitySpace = homogeneitySpace(startingIdeal,startingRing);
     
    247250  return *this;
    248251}
     252
     253bool tropicalStrategy::reduce(ideal I, const ring r) const
     254{
     255  rTest(r);
     256  id_Test(I,r);
     257  nMapFunc nMap = n_SetMap(startingRing->cf,r->cf);
     258  number p = nMap(uniformizingParameter,startingRing->cf,r->cf);
     259  bool b = this->extraReductionAlgorithm(I,r,p);
     260  n_Delete(&p,r->cf);
     261  return b;
     262}
     263
     264ring tropicalStrategy::getShortcutRingPrependingWeight(const ring r, const gfan::ZVector v) const
     265{
     266  ring rShortcut = rCopy0(r);
     267
     268  // save old ordering
     269  int* order = rShortcut->order;
     270  int* block0 = rShortcut->block0;
     271  int* block1 = rShortcut->block1;
     272  int** wvhdl = rShortcut->wvhdl;
     273
     274  // adjust weight and create new ordering
     275  gfan::ZVector w = adjustWeightForHomogeneity(v);
     276  int h = rBlocks(r); int n = rVar(r);
     277  rShortcut->order = (int*) omAlloc0((h+1)*sizeof(int));
     278  rShortcut->block0 = (int*) omAlloc0((h+1)*sizeof(int));
     279  rShortcut->block1 = (int*) omAlloc0((h+1)*sizeof(int));
     280  rShortcut->wvhdl = (int**) omAlloc0((h+1)*sizeof(int*));
     281  rShortcut->order[0] = ringorder_a;
     282  rShortcut->block0[0] = 1;
     283  rShortcut->block1[0] = n;
     284  bool overflow;
     285  rShortcut->wvhdl[0] = ZVectorToIntStar(w,overflow);
     286  for (int i=1; i<=h; i++)
     287  {
     288    rShortcut->order[i] = order[i-1];
     289    rShortcut->block0[i] = block0[i-1];
     290    rShortcut->block1[i] = block1[i-1];
     291    rShortcut->wvhdl[i] = wvhdl[i-1];
     292  }
     293
     294  // if valuation non-trivial, change coefficient ring to residue field
     295  if (valuationIsNonTrivial())
     296  {
     297    nKillChar(rShortcut->cf);
     298    rShortcut->cf = nCopyCoeff(shortcutRing->cf);
     299  }
     300  rComplete(rShortcut);
     301  rTest(rShortcut);
     302
     303  // delete old ordering
     304  omFree(order);
     305  omFree(block0);
     306  omFree(block1);
     307  omFree(wvhdl);
     308
     309  return rShortcut;
     310}
     311
     312poly tropicalStrategy::checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector w) const
     313{
     314  // prepend extra weight for homogeneity
     315  // switch to residue field if valuation is non trivial
     316  ring rShortcut = getShortcutRingPrependingWeight(r,w);
     317
     318  // compute the initial ideal and map it into the constructed ring
     319  // if switched to residue field, remove possibly 0 elements
     320  ideal inI = initial(I,r,w);
     321  int k = idSize(inI);
     322  ideal inIShortcut = idInit(k);
     323  nMapFunc intoShortcut = n_SetMap(r->cf,rShortcut->cf);
     324  for (int i=0; i<k; i++)
     325    inIShortcut->m[i] = p_PermPoly(inI->m[i],NULL,r,rShortcut,intoShortcut,NULL,0);
     326  if (isValuationNonTrivial())
     327    idSkipZeroes(inIShortcut);
     328
     329  // check initial ideal for monomial and
     330  // if it exsists, return a copy of the monomial in the input ring
     331  poly p = checkForMonomialViaSuddenSaturation(inIShortcut,rShortcut);
     332  poly monomial = NULL;
     333  if (p!=NULL)
     334  {
     335    monomial=p_One(r);
     336    for (int i=1; i<n; i++)
     337      p_SetExp(monomial,i,p_GetExp(p,i,rShortcut),r);
     338    p_Delete(&p,rShortcut);
     339  }
     340  id_Delete(&inI,r);
     341  id_Delete(&inIShortcut,rShortcut);
     342  rDelete(rShortcut);
     343  return monomial;
     344}
     345
     346ring tropicalStrategy::copyAndChangeCoefficientRing(const ring r) const
     347{
     348  ring rShortcut = rCopy0(r);
     349  nKillChar(rShortcut->cf);
     350  rShortcut->cf = nCopyCoeff(shortcutRing->cf);
     351  rComplete(rShortcut);
     352  rTest(rShortcut);
     353  return rShortcut;
     354}
     355
     356ideal getWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const
     357{
     358  // if the valuation is trivial and the ring and ideal have not been extended,
     359  // then it is sufficient to return the difference between the elements of inJ
     360  // and their normal forms with respect to I and r
     361  if (isValuationTrivial())
     362    return witness(inJ,I,r);
     363  // if the valuation is non-trivial and the ring and ideal have been extended,
     364  // then we can make a shortcut through the residue field
     365  else
     366  {
     367    checkFirstGenerator(I,r);
     368    assume(idSize(inI)==idSize(I));
     369    /**
     370     * change ground ring into finite field
     371     * and map the data into it
     372     */
     373    ring rShortcut = copyAndChangeCoefficientRing(r);
     374
     375    int k = idSize(inI);
     376    int l = idSize(I);
     377    ideal inJShortcut = idInit(k);
     378    ideal inIShortcut = idInit(l);
     379    nMapFunc takingResidues = n_SetMap(r->cf,rShortcut->cf);
     380    for (int i=0; i<k; i++)
     381      inJShortcut->m[i] = p_PermPoly(inJ->m[i],NULL,r,rShortcut,takingResidues,NULL,0);
     382    for (int j=0; j<l; j++)
     383      inIShortcut->m[j] = p_PermPoly(inI->m[j],NULL,r,rShortcut,takingResidues,NULL,0);
     384    id_Test(inJShortcut,rShortcut);
     385    id_Test(inIShortcut,rShortcut);
     386
     387    /**
     388     * Compute a division with remainder over the finite field
     389     * and map the result back to r
     390     */
     391    matrix QShortcut = divisionDiscardingRemainder(inJShortcut,inIShortcut,rShortcut);
     392    matrix Q = mpNew(k,l);
     393    nMapFunc takingRepresentatives = n_SetMap(rShortcut->cf,r->cf);
     394    for (int ij=k*l-1; ij>=0; ij--)
     395      Q->m[ij] = p_PermPoly(Q->m[ij],NULL,rShortcut,r,takingRepresentatives,NULL,0);
     396
     397    /**
     398     * Compute the normal forms
     399     */
     400    ideal J = idInit(k);
     401    for (int j=0; j<l; j++)
     402    {
     403      poly q0 = p_Copy(inJ->m[j],r);
     404      for (int i=1; i<k; i++)
     405        q0 = p_Add_q(q0,p_Neg(p_Mult_q(p_Copy(MATELEM(Q,i,j),r),p_Copy(inI->m[i],r),r),r),r);
     406      J->m[j] = p_Mult_q(q0,p_Copy(J->m[0],r),r);
     407      q0 = NULL;
     408      for (int i=1; i<k; i++)
     409        J->m[j] = p_Add_q(I->m[j],p_Mult_q(p_Copy(MATELEM(Q,i,j),r),p_Copy(I->m[i],r),r),r);
     410    }
     411
     412    return J;
     413  }
     414}
     415
     416ideal tropicalStrategy::getStdOfInitialIdeal(const ideal inI, const ring r) const
     417{
     418  ideal inJ;
     419  if (isValuationTrivial())
     420    // if valuation trivial, then compute std as usual
     421    inJ = gfanlib_kStd_wrapper(inI,r);
     422  else
     423  {
     424    // if valuation non-trivial, then uniformizing parameter is in ideal
     425    // so switch to residue field first and compute standard basis over the residue field
     426    ring rShortcut = copyAndChangeCoefficientRing(r);
     427    nMapFunc takingResidues = n_SetMap(r->cf,rShortcut->cf);
     428    int k = idSize(inI);
     429    ideal inIShortcut = idInit(k);
     430    for (int i=0; i<k; i++)
     431      inIShortcut->m[i] = p_PermPoly(inI->m[i],NULL,r,rShortcut,takingResidues,NULL,0);
     432    ideal inJShortcut = gfanlib_kStd_wrapper(inIShortcut,rShortcut);
     433
     434    // and lift the result back to the ring with valuation
     435    nMapFunc takingRepresentatives = n_SetMap(rShortcut->cf,r->cf);
     436    k = idSize(inJShortcut);
     437    inJ = idInit(k+1);
     438    inJ->m[0] = p_One(r);
     439    p_SetCoeff(inJ->m[0],nMap(uniformizingParameter,startingRing->cf,r->cf),r);
     440    for (int i=0; i<k; i++)
     441      inJ->m[i+1] = p_PermPoly(inJShortcut->m[i],NULL,rShortcut,r,takingRepresentatives,NULL,0);
     442  }
     443  return inJ;
     444}
     445
     446ring tropicalStrategy::copyAndChangeOrderingWP(const ring r, const gfan::ZVector w, const gfan::ZVector v)
     447{
     448  // copy shortcutRing and change to desired ordering
     449  bool ok;
     450  ring s = rCopy0(r);
     451  int n = rVar(s);
     452  deleteOrdering(s);
     453  gfan::ZVector wAdjusted = adjustWeightForHomogeneity(w);
     454  gfan::ZVector vAdjusted = adjustWeightUnderHomogeneity(wAdjusted,v);
     455  s->order = (int*) omAlloc0(4*sizeof(int));
     456  s->block0 = (int*) omAlloc0(4*sizeof(int));
     457  s->block1 = (int*) omAlloc0(4*sizeof(int));
     458  s->wvhdl = (int**) omAlloc0(4*sizeof(int**));
     459  s->order[0] = ringorder_a;
     460  s->block0[0] = 1;
     461  s->block1[0] = n;
     462  s->wvhdl[0] = ZVectorToIntStar(adjustedInteriorPoint,ok);
     463  s->order[1] = ringorder_wp;
     464  s->block0[1] = 1;
     465  s->block1[1] = n;
     466  s->wvhdl[1] = ZVectorToIntStar(adjustedFacetNormal,ok);
     467  s->order[2] = ringorder_C;
     468  rComplete(s);
     469  rTest(s);
     470
     471  return s;
     472}
     473
     474ring tropicalStrategy::copyAndChangeOrderingDP(const ring r, const gfan::ZVector w, const gfan::ZVector v)
     475{
     476  // copy shortcutRing and change to desired ordering
     477  bool ok;
     478  ring s = rCopy0(r);
     479  int n = rVar(s);
     480  deleteOrdering(s);
     481  gfan::ZVector wAdjusted = adjustWeightForHomogeneity(w);
     482  gfan::ZVector vAdjusted = adjustWeightUnderHomogeneity(wAdjusted,v);
     483  s->order = (int*) omAlloc0(5*sizeof(int));
     484  s->block0 = (int*) omAlloc0(5*sizeof(int));
     485  s->block1 = (int*) omAlloc0(5*sizeof(int));
     486  s->wvhdl = (int**) omAlloc0(5*sizeof(int**));
     487  s->order[0] = ringorder_a;
     488  s->block0[0] = 1;
     489  s->block1[0] = n;
     490  s->wvhdl[0] = ZVectorToIntStar(adjustedInteriorPoint,ok);
     491  s->order[1] = ringorder_a;
     492  s->block0[1] = 1;
     493  s->block1[1] = n;
     494  s->wvhdl[1] = ZVectorToIntStar(adjustedFacetNormal,ok);
     495  s->order[2] = ringorder_dp;
     496  s->block0[2] = 1;
     497  s->block1[2] = n;
     498  s->order[3] = ringorder_C;
     499  rComplete(s);
     500  rTest(s);
     501
     502  return s;
     503}
     504
     505
     506std::pair<ideal,ring> tropicalStrategy::getFlip(const ideal I, const ring r,
     507                                                const gfan::ZVector interiorPoint,
     508                                                const gfan::ZVector facetNormal) const
     509{
     510  assume(isValuationTrivial() || interiorPoint[0].sign()<0);
     511  assume(checkFirstGenerators(I,r));
     512
     513  // get a generating system of the initial ideal
     514  // and compute a standard basis with respect to adjacent ordering
     515  ideal inIr = initial(I,r,interiorPoint);
     516  ring sAdjusted = copyAndChangeOrderingWP(r,interiorPoint,facetNormal);
     517  nMapFunc identity = n_SetMap(r->cf,sAdjusted->cf);
     518  int k = idSize(I); ideal inIs = idInit(k);
     519  for (int i=0; i<k; i++)
     520    inIsAdjusted->m[i] = p_PermPoly(inIr->m[i],NULL,r,sAdjusted,identity,NULL,0);
     521  ideal inJsAdjusted = getStdOfInitialIdeal(inIsAdjusted,sShortcut);
     522
     523  // find witnesses of the new standard basis elements of the initial ideal
     524  // with the help of the old standard basis of the ideal
     525  k = idSize(inJsAdjusted);
     526  ideal inJr = idInit(k);
     527  identity = n_SetMap(sAdjusted->cf,r->cf);
     528  for (int i=0; i<k; i++)
     529    inJr->m[i] = p_PermPoly(inJsAdjusted->m[i],NULL,sAdjusted,r,identity,NULL,0);
     530
     531  ideal Jr = getWitness(inJr,inIr,I,r);
     532  ring s = copyAndChangeOrderingDP(r,interiorPoint,facetNormal);
     533  identity = n_SetMap(r->cf,s->cf);
     534  for (int i=0; i<k; i++)
     535    Js->m[i] = p_PermPoly(inJsAdjusted->m[i],NULL,r,s,identity,NULL,0);
     536
     537  return std::make_pair(Js,s);
     538}
  • Singular/dyn_modules/gfanlib/tropicalStrategy.h

    reacb781 r9c0326  
    1111#include <flip.h>
    1212#include <initial.h>
     13#include <witness.h>
    1314
    1415/** \file
     
    119120    return b;
    120121  }
     122  bool isValuationTrivial() const
     123  {
     124    bool b = (uniformizingParameter==NULL);
     125    return b;
     126  }
     127  bool isValuationNonTrivial() const
     128  {
     129    bool b = (uniformizingParameter!=NULL);
     130    return b;
     131  }
    121132
    122133  /**
     
    224235
    225236  /**
     237   * If valuation trivial, returns a copy of r with a positive weight prepended,
     238   * such that any ideal homogeneous with respect to w is homogeneous with respect to that weight.
     239   * If valuation non-trivial, changes the coefficient ring to the residue field.
     240   */
     241  ring getShortcutRingPrependingWeight(const ring r, const gfan::ZVector w) const;
     242
     243  /**
     244   * Returns a copy of the shortcutRing which is weighted with respect to w first and v second.
     245   * If valuation trivial, the coefficient ring will be the field with valuation.
     246   * If valuation non-trivial, the coefficient ring will be the residue field.
     247   */
     248  ring getShortcutRingDoublyWeighted(const gfan::ZVector w, const gfan::ZVector v) const;
     249
     250  /**
     251   * copies r and prepends extra weight w
     252   */
     253  ring copyAndPrependWeight(const ring r, const gfan::ZVector w) const;
     254
     255  /**
     256   * changes the coefficient ring of r to be the residue field
     257   */
     258  void changeCoefficientToResidueField(ring r) const;
     259
     260
     261
     262  /**
    226263   * reduces the generators of an ideal I so that
    227264   * the inequalities and equations of the Groebner cone can be read off.
    228265   */
    229   bool reduce(ideal I, const ring r) const
    230   {
    231     rTest(r);  id_Test(I,r);
    232     nMapFunc nMap = n_SetMap(startingRing->cf,r->cf);
    233     number p = nMap(uniformizingParameter,startingRing->cf,r->cf);
    234     bool b = this->extraReductionAlgorithm(I,r,p);
    235     n_Delete(&p,r->cf);
    236     return b;
    237   }
     266  bool reduce(ideal I, const ring r) const;
    238267
    239268  /**
     
    241270   * returns false otherwise.
    242271   **/
    243   poly checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector w) const
    244   {
    245     gfan::ZVector v = adjustWeightForHomogeneity(w);
    246     if (isConstantCoefficientCase())
    247     {
    248       ring rShortcut = rCopy0(r);
    249       bool overflow;
    250       /**
    251        * prepend extra weight vector for homogeneity
    252        */
    253       int* order = rShortcut->order;
    254       int* block0 = rShortcut->block0;
    255       int* block1 = rShortcut->block1;
    256       int** wvhdl = rShortcut->wvhdl;
    257       int h = rBlocks(r); int n = rVar(r);
    258       rShortcut->order = (int*) omAlloc0((h+1)*sizeof(int));
    259       rShortcut->block0 = (int*) omAlloc0((h+1)*sizeof(int));
    260       rShortcut->block1 = (int*) omAlloc0((h+1)*sizeof(int));
    261       rShortcut->wvhdl = (int**) omAlloc0((h+1)*sizeof(int*));
    262       rShortcut->order[0] = ringorder_a;
    263       rShortcut->block0[0] = 1;
    264       rShortcut->block1[0] = n;
    265       rShortcut->wvhdl[0] = ZVectorToIntStar(v,overflow);
    266       for (int i=1; i<=h; i++)
     272  poly checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector w) const;
     273
     274  /**
     275   * suppose w a weight in maximal groebner cone of >
     276   * suppose I (initially) reduced standard basis w.r.t. > and inI initial forms of its elements w.r.t. w
     277   * suppose inJ elements of initial ideal that are homogeneous w.r.t w
     278   * returns J elements of ideal whose initial form w.r.t. w are inI
     279   * in particular, if w lies also inthe maximal groebner cone of another ordering >'
     280   * and inJ is a standard basis of the initial ideal w.r.t. >'
     281   * then the returned J will be a standard baiss of the ideal w.r.t. >'
     282   */
     283  ideal getWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const;
     284
     285  /**
     286   * given generators of the initial ideal, computes its standard basis
     287   */
     288  ideal getStdOfInitialIdeal(const ideal inI, const ring r) const;
     289
     290  /**
     291   * given an interior point of a groebner cone
     292   * computes the groebner cone adjacent to it
     293   */
     294  std::pair<ideal,ring> getFlip(const ideal I, const ring r, const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const;
     295
     296  /**
     297   * checks whether the first elements of I is p-t
     298   */
     299  static bool checkFirstGenerator(ideal I, ring r)
     300  {
     301    // check for correct size of ideal and first generator
     302    if (idSize(I)==0)
     303    {
     304      WerrorS("checkFirstElement: ideal empty");
     305      return false;
     306    }
     307    poly p = I->m[0];
     308    if (size(p)!=2)
     309    {
     310      WerrorS("checkFirstElement: no binomial");
     311      return false;
     312    }
     313
     314    // check first term
     315    int n = rVar(r);
     316    if (!n_IsUnit(p_GetCoeff(p,r->cf),r->cf))
     317    {
     318      WerrorS("checkFirstElement: wrong coefficient");
     319      return false;
     320    }
     321    for (int i=1; i<=n; i++)
     322    {
     323      if (p_GetExp(p,i,r)!=0)
    267324      {
    268         rShortcut->order[i] = order[i-1];
    269         rShortcut->block0[i] = block0[i-1];
    270         rShortcut->block1[i] = block1[i-1];
    271         rShortcut->wvhdl[i] = wvhdl[i-1];
     325        WerrorS("checkFirstElement: wrong exponent vector");
     326        return false;
    272327      }
    273       rComplete(rShortcut);
    274       rTest(rShortcut);
    275       omFree(order);
    276       omFree(block0);
    277       omFree(block1);
    278       omFree(wvhdl);
    279 
    280       ideal inI = initial(I,r,w);
    281       int k = idSize(inI);
    282       ideal inIShortcut = idInit(k);
    283       nMapFunc identity = n_SetMap(r->cf,rShortcut->cf);
    284       for (int i=0; i<k; i++)
    285         inIShortcut->m[i] = p_PermPoly(inI->m[i],NULL,r,rShortcut,identity,NULL,0);
    286 
    287       poly p = checkForMonomialViaSuddenSaturation(inIShortcut,rShortcut);
    288       poly monomial = NULL;
    289       if (p!=NULL)
     328    }
     329
     330    // check second term
     331    pIter(p);
     332    if (!n_IsOne(p_GetCoeff(p,r->cf),r->cf))
     333    {
     334      WerrorS("checkFirstElement: wrong coefficient");
     335      return false;
     336    }
     337    if (p_GetExp(p,1,r)!=1)
     338    {
     339      WerrorS("checkFirstElement: wrong exponent vector");
     340      return false;
     341    }
     342    for (int i=2; i<=n; i++)
     343    {
     344      if (p_GetExp(p,i,r)!=0)
    290345      {
    291         monomial=p_One(r);
    292         for (int i=1; i<n; i++)
    293           p_SetExp(monomial,i,p_GetExp(p,i,rShortcut),r);
    294         p_Delete(&p,rShortcut);
     346        WerrorS("checkFirstElement: wrong exponent vector");
     347        return false;
    295348      }
    296       id_Delete(&inI,r);
    297       id_Delete(&inIShortcut,rShortcut);
    298       rDelete(rShortcut);
    299       return monomial;
    300     }
    301     else
    302     {
    303       ring rShortcut = rCopy0(r);
    304       bool overflow;
    305       /**
    306        * prepend extra weight vector for homogeneity
    307        */
    308       int* order = rShortcut->order;
    309       int* block0 = rShortcut->block0;
    310       int* block1 = rShortcut->block1;
    311       int** wvhdl = rShortcut->wvhdl;
    312       int h = rBlocks(r); int n = rVar(r);
    313       rShortcut->order = (int*) omAlloc0((h+1)*sizeof(int));
    314       rShortcut->block0 = (int*) omAlloc0((h+1)*sizeof(int));
    315       rShortcut->block1 = (int*) omAlloc0((h+1)*sizeof(int));
    316       rShortcut->wvhdl = (int**) omAlloc0((h+1)*sizeof(int*));
    317       rShortcut->order[0] = ringorder_a;
    318       rShortcut->block0[0] = 1;
    319       rShortcut->block1[0] = n;
    320       rShortcut->wvhdl[0] = ZVectorToIntStar(v,overflow);
    321       for (int i=1; i<=h; i++)
    322       {
    323         rShortcut->order[i] = order[i-1];
    324         rShortcut->block0[i] = block0[i-1];
    325         rShortcut->block1[i] = block1[i-1];
    326         rShortcut->wvhdl[i] = wvhdl[i-1];
    327       }
    328       omFree(order);
    329       omFree(block0);
    330       omFree(block1);
    331       omFree(wvhdl);
    332       /**
    333        * change ground domain into finite field
    334        */
    335       nKillChar(rShortcut->cf);
    336       rShortcut->cf = nCopyCoeff(shortcutRing->cf);
    337       rComplete(rShortcut);
    338       rTest(rShortcut);
    339 
    340       ideal inI = initial(I,r,w);
    341       int k = idSize(inI);
    342       ideal inIShortcut = idInit(k);
    343       nMapFunc takingResidues = n_SetMap(r->cf,rShortcut->cf);
    344       for (int i=0; i<k; i++)
    345         inIShortcut->m[i] = p_PermPoly(inI->m[i],NULL,r,rShortcut,takingResidues,NULL,0);
    346 
    347       idSkipZeroes(inIShortcut);
    348       poly p = checkForMonomialViaSuddenSaturation(inIShortcut,rShortcut);
    349       poly monomial = NULL;
    350       if (p!=NULL)
    351       {
    352         monomial=p_One(r);
    353         for (int i=1; i<n; i++)
    354           p_SetExp(monomial,i,p_GetExp(p,i,rShortcut),r);
    355         p_Delete(&p,rShortcut);
    356       }
    357       id_Delete(&inI,r);
    358       id_Delete(&inIShortcut,rShortcut);
    359       rDelete(rShortcut);
    360       return monomial;
    361     }
    362   }
    363   std::pair<ideal,ring> flip(const ideal I, const ring r,
    364                              const gfan::ZVector interiorPoint,
    365                              const gfan::ZVector facetNormal) const
    366   {
    367     gfan::ZVector adjustedInteriorPoint = adjustWeightForHomogeneity(interiorPoint);
    368     gfan::ZVector adjustedFacetNormal = adjustWeightUnderHomogeneity(facetNormal,adjustedInteriorPoint);
    369     return flip0(I,r,interiorPoint,facetNormal,adjustedInteriorPoint,adjustedFacetNormal);
     349    }
     350
     351    return true;
    370352  }
    371353};
  • Singular/dyn_modules/gfanlib/witness.cc

    reacb781 r9c0326  
    1414 * Returns an error if this is not possible.
    1515 **/
    16 static matrix divisionDiscardingRemainder(const poly f, const ideal G, const ring r)
     16matrix divisionDiscardingRemainder(const poly f, const ideal G, const ring r)
    1717{
    1818  ring origin = currRing;
     
    2020  ideal F = idInit(1); F->m[0]=f;
    2121  ideal m = idLift(G,F);
    22   // ideal m = idLift(G,F,NULL,FALSE,TRUE);
    2322  F->m[0]=NULL; id_Delete(&F, currRing);
     23  matrix Q = id_Module2formatedMatrix(m,IDELEMS(G),1,currRing);
     24  if (origin != r) rChangeCurrRing(origin);
     25  return Q;
     26}
     27
     28/**
     29 * Given F[0],...,F[l] and G[0],...,G[k],
     30 * computes Q[i,j] for i=0,..,k and j=0,...,l such that
     31 * F[j] = Q[0,j]*G[0]+...+Q[k,j]*G[k].
     32 */
     33matrix divisionDiscardingRemainder(const ideal F, const ideal G, const ring r)
     34{
     35  ring origin = currRing;
     36  if (origin != r) rChangeCurrRing(r);
     37  ideal m = idLift(G,F);
    2438  matrix Q = id_Module2formatedMatrix(m,IDELEMS(G),1,currRing);
    2539  if (origin != r) rChangeCurrRing(origin);
     
    89103}
    90104#endif
     105
     106/***
     107 * Let w be the uppermost weight vector in the matrix defining the ordering on r.
     108 * Let I be a Groebner basis of an ideal in r, inI its initial form with respect w.
     109 * Given an w-homogeneous element m of inI, computes a witness g of m in I,
     110 * i.e. g in I such that in_w(g)=m.
     111 **/
     112ideal witness(const ideal inI, const ideal J, const ring r)
     113{
     114  ring origin = currRing;
     115  if (origin!=r)
     116    rChangeCurrRing(r);
     117  ideal NFinI = kNF(J,r->qideal,inI);
     118  if (origin!=r)
     119    rChangeCurrRing(origin);
     120
     121  int k = idSize(inI);
     122  ideal I = idInit(k);
     123  for (int i=0; i<k; i++)
     124  {
     125    I->m[i] = p_Add_q(p_Copy(inI->m[i],r),p_Neg(NFinI->m[i],r),r);
     126    NFinI->m[i] = NULL;
     127  }
     128
     129  return I;
     130}
  • Singular/dyn_modules/gfanlib/witness.h

    reacb781 r9c0326  
    55#include <libpolys/polys/simpleideals.h>
    66
     7matrix divisionDiscardingRemainder(const poly f, const ideal G, const ring r);
     8matrix divisionDiscardingRemainder(const ideal F, const ideal G, const ring r);
    79poly witness(const poly m, const ideal I, const ideal inI, const ring r);
     10ideal witness(const ideal inI, const ideal J, const ring r);
    811
    912#ifndef NDEBUG
  • gfanlib/gfanlib_matrix.h

    reacb781 r9c0326  
    3939  {
    4040    Matrix ret(1,v.size());
    41     for(int i=0;i<v.size();i++)ret[0][i]=v[i];
     41    for(unsigned i=0;i<v.size();i++)ret[0][i]=v[i];
    4242    return ret;
    4343  }
     
    331331    int retSwaps=0;
    332332    int currentRow=0;
    333 
    334     if (height<2)
    335       return 0;
    336333
    337334    for(int i=0;i<width;i++)
  • gfanlib/gfanlib_vector.h

    reacb781 r9c0326  
    8585  unsigned int size()const{return v.size();};
    8686  void resize(int n){v.resize(n,typ());};
    87   void grow(int i){if(size()<i)resize(i);}
     87  void grow(int i){if((int)size()<i)resize(i);}
    8888  void push_back(typ a)
    8989  {
Note: See TracChangeset for help on using the changeset viewer.