Changeset 78abc7 in git


Ignore:
Timestamp:
Aug 18, 2014, 4:35:01 PM (10 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
eacb78146504ca284c1888c739cb1aade67c8520
Parents:
441944f17f356b9a04c768f8a43754bc29364747
git-author:
Yue Ren <ren@mathematik.uni-kl.de>2014-08-18 16:35:01+02:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:04+01:00
Message:
chg: status update 18.08.
Location:
Singular/dyn_modules/gfanlib
Files:
6 edited

Legend:

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

    r441944 r78abc7  
    3434    int n = rVar(r); int* w = r->wvhdl[0];
    3535    gfan::ZVector v = wvhdlEntryToZVector(n,w);
     36    if (r->order[0]==ringorder_ws)
     37      v = gfan::Integer((long)-1)*v;
    3638    if (!zc.contains(v))
    3739    {
  • Singular/dyn_modules/gfanlib/ppinitialReduction.cc

    r441944 r78abc7  
    1919static bool pReduce(poly &g, const number p, const ring r)
    2020{
     21  if (g==NULL)
     22    return false;
     23
    2124  poly toBeChecked = pNext(g);
    2225  pNext(g) = NULL; poly gEnd = g;
     
    107110bool ppreduceInitially(poly &h, const poly g, const ring r)
    108111{
     112  if (h==NULL || g==NULL)
     113    return false;
    109114  p_Test(h,r);
    110115  p_Test(g,r);
     
    204209    for (int j=i+1; j<m; j++)
    205210      if (ppreduceInitially(I->m[i], I->m[j],r) && pReduce(I->m[i],p,r)) return true;
     211
     212  /***
     213   * removes the elements of I which have been reduced to 0 in the previous two passes
     214   **/
     215  idSkipZeroes(I);
    206216  return false;
    207217}
     
    249259  int n=idSize(I);
    250260  idInsertPoly(I,g);
    251   poly cache; n++; int j;
    252   for (j=n-1; j>0; j--)
     261  int j;
     262  for (j=n; j>0; j--)
    253263  {
    254264    if (p_LmCmp(I->m[j], I->m[j-1],r)>0)
    255265    {
    256       cache = I->m[j];
     266      poly cache = I->m[j];
    257267      I->m[j] = I->m[j-1];
    258268      I->m[j-1] = cache;
     
    281291    if (ppreduceInitially(I->m[j], I->m[k], r) && pReduce(I->m[j],p,r)) return true;
    282292
     293  /***
     294   * removes the elements of I which have been reduced to 0 in the previous two passes
     295   **/
     296  idSkipZeroes(I);
    283297  return false;
    284298}
     
    475489
    476490
    477 /***
     491/**
    478492 * reduces I initially with respect to itself.
    479493 * assumes that the generators of I are homogeneous in x and that p-t is in I.
    480  **/
     494 */
    481495bool ppreduceInitially(ideal I, ring r, number p)
    482496{
     
    498512    else
    499513    {
    500       std::pair<std::map<long,ideal>::iterator,bool> ret;
    501       ret = H.insert(std::pair<long,ideal>(d,idInit(16)));
    502       idInsertPoly(ret.first->second,I->m[i]);
     514      std::pair<long,ideal> Hd(d,idInit(1));
     515      Hd.second->m[0] = I->m[i];
     516      H.insert(Hd);
    503517    }
    504518  }
     
    506520  std::map<long,ideal>::iterator it=H.begin();
    507521  ideal Hi = it->second;
     522  assume(idSize(Hi)==1);
     523  assume(pLength(Hi->m[0])==2);
     524  it++;
     525  Hi = it->second;
    508526
    509527  /***
     
    520538  {
    521539    int l=idSize(Hi); int k=l; poly cache;
     540    /**
     541     * sorts Hi according to degree in t in descending order
     542     * (lowest first, highest last)
     543     */
    522544    do
    523545    {
  • Singular/dyn_modules/gfanlib/startingCone.cc

    r441944 r78abc7  
    5252std::pair<gfan::ZVector,groebnerCone> tropicalStartingDataViaGroebnerFan(const ideal I, const ring r, const tropicalStrategy& currentStrategy)
    5353{
     54  std::cout << "computing starting cone" << std::endl;
    5455  currentStrategy.reduce(I,r);
     56  std::cout << "finished reduction" << std::endl;
    5557
    5658  const groebnerCone sigma(I,r,currentStrategy);
     59  std::cout << "finished first maximal Groebner cone" << std::endl;
    5760  gfan::ZVector startingPoint = sigma.tropicalPoint();
    5861  if (startingPoint.size() > 0)
     
    6467  while (!workingList.empty())
    6568  {
     69    std::cout << "traversing groebner fan..." << std::endl;
    6670    const groebnerCone sigma = *(workingList.begin());
    6771    groebnerCones neighbours = sigma.groebnerNeighbours();
  • Singular/dyn_modules/gfanlib/tropicalStrategy.cc

    r441944 r78abc7  
    88#include <kernel/ideals.h>
    99#include <kernel/GBEngine/stairc.h>
     10#include <Singular/ipshell.h> // for isPrime(int i)
    1011
    1112/***
     
    5657  startingIdeal(id_Copy(originalIdeal,originalRing)),
    5758  uniformizingParameter(NULL),
    58   shortcutRing(rCopy(originalRing)),
     59  shortcutRing(NULL),
    5960  onlyLowerHalfSpace(false),
    6061  weightAdjustingAlgorithm1(nonvalued_adjustWeightForHomogeneity),
     
    137138  originalRing = rCopy(s);
    138139
    139   /* replace Q with Z for the startingRing */
    140   startingRing = rCopy0(originalRing);
    141   nKillChar(startingRing->cf);
    142   startingRing->cf = nInitChar(n_Z,NULL);
    143   rComplete(startingRing);
    144 
    145   /* map p into the new coefficient domain */
     140  /* replace Q with Z for the startingRing
     141   * and add an extra variable for tracking the uniformizing parameter */
     142  startingRing = constructStartingRing(originalRing);
     143
     144  /* map the uniformizing parameter into the new coefficient domain */
    146145  nMapFunc nMap = n_SetMap(originalRing->cf,startingRing->cf);
    147146  uniformizingParameter = nMap(q,originalRing->cf,startingRing->cf);
    148147
    149   /* map J into the new polynomial ring */
     148  /* map the input ideal into the new polynomial ring */
    150149  int k = idSize(J);
    151   startingIdeal = idInit(k);
     150  startingIdeal = idInit(k+1);
     151  poly g = p_One(startingRing);
     152  p_SetCoeff(g,uniformizingParameter,startingRing);
     153  pNext(g) = p_One(startingRing);
     154  p_SetExp(pNext(g),1,1,startingRing);
     155  p_SetCoeff(pNext(g),n_Init(-1,startingRing->cf),startingRing);
     156  p_Setm(pNext(g),startingRing);
     157  startingIdeal->m[0] = g;
     158  int n = rVar(originalRing);
     159  int* shiftByOne = (int*) omAlloc((n+1)*sizeof(int));
     160  for (int i=1; i<=n; i++)
     161    shiftByOne[i]=i+1;
    152162  for (int i=0; i<k; i++)
    153     startingIdeal->m[i] = p_PermPoly(J->m[i],NULL,originalRing,startingRing,nMap,NULL,0);
     163    startingIdeal->m[i+1] = p_PermPoly(J->m[i],shiftByOne,originalRing,startingRing,nMap,NULL,0);
     164  omFreeSize(shiftByOne,(n+1)*sizeof(int));
     165
     166  /* construct the shorcut ring */
     167  shortcutRing = rCopy0(startingRing);
     168  nKillChar(shortcutRing->cf);
     169  shortcutRing->cf = nInitChar(n_Zp,(void*)(long)IsPrime(n_Int(uniformizingParameter,startingRing->cf)));
     170  rComplete(shortcutRing);
    154171
    155172  /* compute the dimension of the ideal in the original ring */
  • Singular/dyn_modules/gfanlib/tropicalStrategy.h

    r441944 r78abc7  
    207207    return b;
    208208  }
     209
     210  /**
     211   * returns true, if I contains a monomial.
     212   * returns false otherwise.
     213   **/
     214  bool containsMonomial(ideal I, ring r) const
     215  {
     216    ring rFinite = rCopy0(r);
     217    nKillChar(rFinite.coeffs());
     218    rFinite->cf =
     219  }
    209220};
    210221
  • Singular/dyn_modules/gfanlib/tropicalTraversal.cc

    r441944 r78abc7  
    88  while(!workingList.empty())
    99  {
     10    std::cout << "starting traversal" << std::endl;
    1011    const groebnerCone sigma=*(workingList.begin());
    1112    const groebnerCones neighbours = sigma.tropicalNeighbours();
Note: See TracChangeset for help on using the changeset viewer.