Changeset 4b47563 in git


Ignore:
Timestamp:
Nov 21, 2014, 6:04:44 PM (9 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'spielwiese', 'a719bcf0b8dbc648b128303a49777a094b57592c')
Children:
bf83d38c96216c127968a607729c0b2aa4b88985
Parents:
e4c54031d2902cbf09cf0ab7914602044e166cc0
git-author:
Yue Ren <ren@mathematik.uni-kl.de>2014-11-21 18:04:44+01:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:05+01:00
Message:
chg: minor fixes, mainly cleanup
Location:
Singular/dyn_modules/gfanlib
Files:
5 edited

Legend:

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

    re4c540 r4b47563  
    104104      delete zd;
    105105    }
    106     gfan::ZCone* zc = (gfan::ZCone*)r->Data();
    107     newZc = new gfan::ZCone(*zc);
     106    newZc = (gfan::ZCone*)r->CopyD();
    108107  }
    109108  else if (r->Typ()==INT_CMD)
  • Singular/dyn_modules/gfanlib/tropicalStrategy.cc

    re4c540 r4b47563  
    515515}
    516516
    517 ideal tropicalStrategy::getStdOfInitialIdeal(const ideal inI, const ring r) const
    518 {
    519   ideal inJ;
     517ideal tropicalStrategy::computeStdOfInitialIdeal(const ideal inI, const ring r) const
     518{
     519  // if valuation trivial, then compute std as usual
    520520  if (isValuationTrivial())
    521     // if valuation trivial, then compute std as usual
    522     inJ = gfanlib_kStd_wrapper(inI,r);
    523   else
    524   {
    525     // if valuation non-trivial, then uniformizing parameter is in ideal
    526     // so switch to residue field first and compute standard basis over the residue field
    527     ring rShortcut = copyAndChangeCoefficientRing(r);
    528     nMapFunc takingResidues = n_SetMap(r->cf,rShortcut->cf);
    529     int k = idSize(inI);
    530     ideal inIShortcut = idInit(k);
    531     for (int i=0; i<k; i++)
    532       inIShortcut->m[i] = p_PermPoly(inI->m[i],NULL,r,rShortcut,takingResidues,NULL,0);
    533     ideal inJShortcut = gfanlib_kStd_wrapper(inIShortcut,rShortcut);
    534 
    535     // and lift the result back to the ring with valuation
    536     nMapFunc takingRepresentatives = n_SetMap(rShortcut->cf,r->cf);
    537     k = idSize(inJShortcut);
    538     inJ = idInit(k+1);
    539     inJ->m[0] = p_One(r);
    540     nMapFunc identity = n_SetMap(startingRing->cf,r->cf);
    541     p_SetCoeff(inJ->m[0],identity(uniformizingParameter,startingRing->cf,r->cf),r);
    542     for (int i=0; i<k; i++)
    543       inJ->m[i+1] = p_PermPoly(inJShortcut->m[i],NULL,rShortcut,r,takingRepresentatives,NULL,0);
    544 
    545     id_Delete(&inIShortcut,rShortcut);
    546     rDelete(rShortcut);
    547   }
     521    return gfanlib_kStd_wrapper(inI,r);
     522
     523  // if valuation non-trivial, then uniformizing parameter is in ideal
     524  // so switch to residue field first and compute standard basis over the residue field
     525  ring rShortcut = copyAndChangeCoefficientRing(r);
     526  nMapFunc takingResidues = n_SetMap(r->cf,rShortcut->cf);
     527  int k = idSize(inI);
     528  ideal inIShortcut = idInit(k);
     529  for (int i=0; i<k; i++)
     530    inIShortcut->m[i] = p_PermPoly(inI->m[i],NULL,r,rShortcut,takingResidues,NULL,0);
     531  ideal inJShortcut = gfanlib_kStd_wrapper(inIShortcut,rShortcut);
     532
     533  // and lift the result back to the ring with valuation
     534  nMapFunc takingRepresentatives = n_SetMap(rShortcut->cf,r->cf);
     535  k = idSize(inJShortcut);
     536  ideal inJ = idInit(k+1);
     537  inJ->m[0] = p_One(r);
     538  nMapFunc identity = n_SetMap(startingRing->cf,r->cf);
     539  p_SetCoeff(inJ->m[0],identity(uniformizingParameter,startingRing->cf,r->cf),r);
     540  for (int i=0; i<k; i++)
     541    inJ->m[i+1] = p_PermPoly(inJShortcut->m[i],NULL,rShortcut,r,takingRepresentatives,NULL,0);
     542
     543  id_Delete(&inJShortcut,rShortcut);
     544  id_Delete(&inIShortcut,rShortcut);
     545  rDelete(rShortcut);
    548546  return inJ;
    549547}
     
    658656  ring sAdjusted = copyAndChangeOrderingWP(r,interiorPoint,facetNormal);
    659657  nMapFunc identity = n_SetMap(r->cf,sAdjusted->cf);
    660   int k = idSize(Ir); ideal inIsAdjusted = idInit(k);
     658  int k = idSize(Ir);
     659  ideal inIsAdjusted = idInit(k);
    661660  for (int i=0; i<k; i++)
    662661    inIsAdjusted->m[i] = p_PermPoly(inIr->m[i],NULL,r,sAdjusted,identity,NULL,0);
    663   ideal inJsAdjusted = getStdOfInitialIdeal(inIsAdjusted,sAdjusted);
     662  ideal inJsAdjusted = computeStdOfInitialIdeal(inIsAdjusted,sAdjusted);
    664663
    665664  // find witnesses of the new standard basis elements of the initial ideal
     
    680679  // this->reduce(Jr,r);
    681680  // cleanup
     681  id_Delete(&inIsAdjusted,sAdjusted);
    682682  id_Delete(&inJsAdjusted,sAdjusted);
    683683  rDelete(sAdjusted);
     684  id_Delete(&inIr,r);
    684685  id_Delete(&Jr,r);
    685686  id_Delete(&inJr,r);
  • Singular/dyn_modules/gfanlib/tropicalStrategy.h

    re4c540 r4b47563  
    322322   * given generators of the initial ideal, computes its standard basis
    323323   */
    324   ideal getStdOfInitialIdeal(const ideal inI, const ring r) const;
     324  ideal computeStdOfInitialIdeal(const ideal inI, const ring r) const;
    325325
    326326  /**
  • Singular/dyn_modules/gfanlib/tropicalTraversal.cc

    re4c540 r4b47563  
    88  while(!workingList.empty())
    99  {
    10     std::cout << "starting traversal" << std::endl;
     10    // std::cout << "starting traversal" << std::endl;
    1111    const groebnerCone sigma=*(workingList.begin());
    1212    const groebnerCones neighbours = sigma.tropicalNeighbours();
     
    1818    tropicalVariety.insert(sigma);
    1919    workingList.erase(sigma);
    20     std::cout << "tropicalVariety.size():" << tropicalVariety.size() << std::endl;
    21     std::cout << "workingList.size():" << workingList.size() << std::endl;
     20    // std::cout << "tropicalVariety.size():" << tropicalVariety.size() << std::endl;
     21    // std::cout << "workingList.size():" << workingList.size() << std::endl;
    2222  }
    2323  return tropicalVariety;
  • Singular/dyn_modules/gfanlib/tropicalVariety.cc

    re4c540 r4b47563  
    7676      if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
    7777      {
    78         number p = (number) v->CopyD();
     78        number p = (number) v->Data();
    7979        tropicalStrategy currentStrategy(I,p,currRing);
    8080        std::set<gfan::ZCone> maxCones = tropicalVariety(g,currRing,currentStrategy);
    8181        res->rtyp = fanID;
    8282        res->data = (char*) toZFan(maxCones);
    83         id_Delete(&I,currRing);
    84         n_Delete(&p,currRing->cf);
    8583        return FALSE;
    8684      }
     
    9088    {
    9189      setOptionRedSB();
     90      ideal stdI;
    9291      if (!hasFlag(u,FLAG_STD))
    93       {
    94         ideal stdI = gfanlib_kStd_wrapper(I,currRing);
    95         id_Delete(&I,currRing);
    96         I = stdI;
    97       }
     92        stdI = gfanlib_kStd_wrapper(I,currRing);
     93      else
     94        stdI = id_Copy(I,currRing);
    9895      tropicalStrategy currentStrategy(I,currRing);
    9996      gfan::ZFan* tropI = tropicalVariety(currentStrategy);
     
    10198      res->data = (char*) tropI;
    10299      undoSetOptionRedSB();
    103       id_Delete(&I,currRing);
     100      id_Delete(&stdI,currRing);
    104101      return FALSE;
    105102    }
    106103    if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
    107104    {
    108       number p = (number) v->CopyD();
     105      number p = (number) v->Data();
     106      ideal stdI;
    109107      if (!hasFlag(u,FLAG_STD))
    110       {
    111         ideal stdI = gfanlib_kStd_wrapper(I,currRing);
    112         id_Delete(&I,currRing);
    113         I = stdI;
    114       }
    115       tropicalStrategy currentStrategy(I,p,currRing);
     108        stdI = gfanlib_kStd_wrapper(I,currRing);
     109      else
     110        stdI = id_Copy(I,currRing);
     111      tropicalStrategy currentStrategy(stdI,p,currRing);
    116112      gfan::ZFan* tropI = tropicalVariety(currentStrategy);
    117113      res->rtyp = fanID;
    118114      res->data = (char*) tropI;
    119       id_Delete(&I,currRing);
     115      id_Delete(&stdI,currRing);
    120116      return FALSE;
    121117    }
Note: See TracChangeset for help on using the changeset viewer.