Ignore:
Timestamp:
Mar 12, 2014, 9:08:50 AM (10 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'spielwiese', 'ec94ef7a30b928574c0c3daf41f6804dff5f6b69')
Children:
7aa26b206f76709abff0bab4adaac2dfc4ddb4ef
Parents:
c890142d6921b9d30b396af149a3df2fbc57981a
git-author:
Yue Ren <ren@mathematik.uni-kl.de>2014-03-12 10:08:50+02:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:03+01:00
Message:
status updated 11.03.
File:
1 edited

Legend:

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

    rc89014 r9abcc6  
    66#include <neighbours.h>
    77#include <tropicalStrategy.h>
    8 
    9 /***
    10  * Given a general ring r with any ordering,
    11  * changes the ordering to a(v),ws(-w)
    12  **/
    13 bool changetoAWSRing(ring r, gfan::ZVector v, gfan::ZVector w)
    14 {
    15   omFree(r->order);
    16   r->order  = (int*) omAlloc0(4*sizeof(int));
    17   omFree(r->block0);
    18   r->block0 = (int*) omAlloc0(4*sizeof(int));
    19   omFree(r->block1);
    20   r->block1 = (int*) omAlloc0(4*sizeof(int));
    21   for (int i=0; r->wvhdl[i]; i++)
    22   { omFree(r->wvhdl[i]); }
    23   omFree(r->wvhdl);
    24   r->wvhdl  = (int**) omAlloc0(4*sizeof(int*));
    25 
    26   bool ok = false;
    27   r->order[0]  = ringorder_a;
    28   r->block0[0] = 1;
    29   r->block1[0] = r->N;
    30   r->wvhdl[0]  = ZVectorToIntStar(v,ok);
    31   r->order[1]  = ringorder_ws;
    32   r->block0[1] = 1;
    33   r->block1[1] = r->N;
    34   r->wvhdl[1]  = ZVectorToIntStar(w,ok);
    35   r->order[2]  = ringorder_C;
    36   return ok;
    37 }
     8#include <tropicalCurves.h>
     9#include <bbcone.h>
     10#include <tropicalVariety.h>
    3811
    3912
    40 /***
    41  * Given a ring with ordering a(v'),ws(w'),
    42  * changes the weights to v,w
    43  **/
    44 bool changeAWSWeights(ring r, gfan::ZVector v, gfan::ZVector w)
    45 {
    46   omFree(r->wvhdl[0]);
    47   omFree(r->wvhdl[1]);
    48   bool ok = false;
    49   r->wvhdl[0]  = ZVectorToIntStar(v,ok);
    50   r->wvhdl[1]  = ZVectorToIntStar(w,ok);
    51   return ok;
    52 }
     13// /***
     14// * Given a ring with ordering a(v'),ws(w'),
     15// * changes the weights to v,w
     16// **/
     17// bool changeAWSWeights(ring r, gfan::ZVector v, gfan::ZVector w)
     18// {
     19//   omFree(r->wvhdl[0]);
     20//   omFree(r->wvhdl[1]);
     21//   bool ok = false;
     22//   r->wvhdl[0]  = ZVectorToIntStar(v,ok);
     23//   r->wvhdl[1]  = ZVectorToIntStar(w,ok);
     24//   return ok;
     25// }
    5326
    5427
     
    6740    if (s == NULL)
    6841    {
    69       // std::cout << "found no monomial in initial ideal!" << std::endl;
    7042      p_Delete(&s,r);
    7143      return R[i];
    72     }
    73     p_Delete(&s,r);
    74   }
    75   gfan::ZMatrix L = zc.generatorsOfLinealitySpace();
    76   for (int i=0; i<L.getHeight(); i++)
    77   {
    78     ideal inI = initial(I,r,L[i]);
    79     poly s = checkForMonomialViaSuddenSaturation(inI,r);
    80     id_Delete(&inI,r);
    81     if (s == NULL)
    82     {
    83       // std::cout << "found no monomial in initial ideal!" << std::endl;
    84       p_Delete(&s,r);
    85       return L[i];
    8644    }
    8745    p_Delete(&s,r);
     
    9351gfan::ZVector tropicalStartingPoint(const ideal I, const ring r, const tropicalStrategy currentCase)
    9452{
     53  bool (*red)(ideal I, ring r);
     54  red = currentCase.reduce; red(I,r);
     55
    9556  groebnerConeData sigma = maximalGroebnerConeData(id_Copy(I,r),rCopy(r));
    9657  gfan::ZVector startingPoint = findTropicalPoint(sigma);
    97   while (startingPoint.size()==0)
     58  if (startingPoint.size() > 0)
     59    return startingPoint;
     60  setOfGroebnerConeData groebnerFan;
     61  setOfGroebnerConeData workingList;
     62  workingList.insert(sigma);
     63
     64  while (!workingList.empty())
    9865  {
     66    sigma = *(workingList.begin());
    9967    setOfGroebnerConeData neighbours = groebnerNeighbours(sigma,currentCase);
    100     setOfGroebnerConeData::iterator tau = neighbours.begin();
    101     for (; tau!=neighbours.end(); tau++)
     68    for (setOfGroebnerConeData::iterator tau = neighbours.begin(); tau!=neighbours.end(); tau++)
    10269    {
    103       startingPoint = findTropicalPoint(*tau);
    104       if (startingPoint.size() > 0) break;
     70      if (groebnerFan.count(*tau) == 0)
     71      {
     72        if (workingList.count(*tau) == 0)
     73        {
     74          startingPoint = findTropicalPoint(*tau);
     75          if (startingPoint.size() > 0)
     76            return startingPoint;
     77        }
     78        workingList.insert(*tau);
     79      }
    10580    }
    106     tau = neighbours.begin();
    107     sigma = *tau;
     81    groebnerFan.insert(groebnerConeData(sigma));
     82    workingList.erase(sigma);
    10883  }
    10984  return startingPoint;
    11085}
    111 
    11286
    11387BOOLEAN tropicalStartingPoint0(leftv res, leftv args)
     
    133107}
    134108
     109gfan::ZCone tropicalStartingCone(const ideal I, const ring r, const tropicalStrategy currentCase)
     110{
     111  // groebnerConeData sigma = maximalGroebnerConeData(I,r);
     112  // gfan::ZCone zc = sigma.getCone();
     113  // if (zc.dimensionOfLinealitySpace == d)
     114  //   return zc.linealitySpace();
     115  // gfan::ZVector w = tropicalStartingPoint(I,r,currentCase);
     116  // ideal inI = initial(I,w,r);
     117  // gfan::ZCone zd =
    135118
    136 // gfan::ZCone* tropicalStartingCone(const ideal &I, ring r)
    137 // {
    138 //   gfan::ZVector* w = tropicalStartingPoint(I,r);
    139 //   return groebnerCone(I,r,w);
    140 // }
     119  gfan::ZVector w = tropicalStartingPoint(I,r,currentCase);
     120  if (w.size() == 0)
     121  {
     122    gfan::ZCone zc = fullGroebnerCone(I,r);
     123    return zc.linealitySpace();
     124  }
     125  ideal inI = initial(I,r,w);
     126  std::set<gfan::ZCone> T = tropicalCurve(inI,r,0,currentCase);
     127  return *T.begin();
     128}
     129
     130BOOLEAN tropicalStartingCone0(leftv res, leftv args)
     131{
     132  leftv u = args;
     133  ideal I = (ideal) u->CopyD();
     134  gfan::ZCone startingCone = tropicalStartingCone(I,currRing,nonValuedCase);
     135  id_Delete(&I, currRing);
     136  res->rtyp = coneID;
     137  res->data = (char*) new gfan::ZCone(startingCone);
     138  return FALSE;
     139}
     140
     141BOOLEAN tropicalStartingCone1(leftv res, leftv args)
     142{
     143  leftv u = args;
     144  ideal I = (ideal) u->CopyD();
     145  gfan::ZCone startingCone = tropicalStartingCone(I,currRing,valuedCase);
     146  id_Delete(&I, currRing);
     147  res->rtyp = coneID;
     148  res->data = (char*) new gfan::ZCone(startingCone);
     149  return FALSE;
     150}
Note: See TracChangeset for help on using the changeset viewer.