Changeset fb1872 in git


Ignore:
Timestamp:
Jul 22, 2014, 3:39:35 PM (10 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
3fe2153c36725d117f2ec7b959b05eb1cf5d0ac8
Parents:
06d5774722df3a09ae8f983da8c2b455d6224f31
git-author:
Yue Ren <ren@mathematik.uni-kl.de>2014-07-22 15:39:35+02:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:04+01:00
Message:
fix: error when calling tropicalStartingPoint in the trivial case
Location:
Singular/dyn_modules/gfanlib
Files:
7 edited

Legend:

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

    r06d5774 rfb1872  
    180180    ideal Jstd = kStd(J,currRing->qideal,testHomog,&nullVector);
    181181    ideal JquotM = idQuot(Jstd,M,true,true); k++;
    182     ideal JquotMredJ = kNF(JquotM,currRing->qideal,Jstd);
     182    ideal JquotMredJ = kNF(Jstd,currRing->qideal,JquotM);
    183183    b = idIs0(JquotMredJ);
    184184    id_Delete(&Jstd,r); id_Delete(&J,r); J = JquotM;
  • Singular/dyn_modules/gfanlib/groebnerCone.cc

    r06d5774 rfb1872  
    284284    ideal inI = initial(I,r,R[i]);
    285285    poly s = checkForMonomialViaSuddenSaturation(inI,r);
    286     id_Delete(&inI,r);
    287286    if (s == NULL)
    288287    {
     288      id_Delete(&inI,r);
    289289      p_Delete(&s,r);
    290290      return R[i];
    291291    }
     292    id_Delete(&inI,r);
    292293    p_Delete(&s,r);
    293294  }
  • Singular/dyn_modules/gfanlib/startingCone.cc

    r06d5774 rfb1872  
    8484    ideal I = (ideal) u->Data();
    8585    tropicalStrategy currentStrategy(I,currRing);
     86    if (currentStrategy.getDimensionOfIdeal()==currentStrategy.getDimensionOfHomogeneitySpace())
     87    {
     88      gfan::ZCone homogSpace = currentStrategy.getHomogeneitySpace();
     89      gfan::ZMatrix homogSpaceGenerators = homogSpace.generatorsOfLinealitySpace();
     90      assume(homogSpaceGenerators.getHeight()>0);
     91      res->rtyp = BIGINTMAT_CMD;
     92      res->data = (void*) zVectorToBigintmat(homogSpaceGenerators[0]);
     93      return FALSE;
     94    }
    8695    std::pair<gfan::ZVector,groebnerCone> startingData = tropicalStartingDataViaGroebnerFan(I,currRing,currentStrategy);
    8796    gfan::ZVector startingPoint = startingData.first;
  • Singular/dyn_modules/gfanlib/tropical.cc

    r06d5774 rfb1872  
    1616
    1717
     18gfan::ZCone homogeneitySpace(ideal I, ring r)
     19{
     20  int n = rVar(r);
     21  poly g;
     22  int* leadexpv = (int*) omAlloc((n+1)*sizeof(int));
     23  int* tailexpv = (int*) omAlloc((n+1)*sizeof(int));
     24  gfan::ZVector leadexpw = gfan::ZVector(n);
     25  gfan::ZVector tailexpw = gfan::ZVector(n);
     26  gfan::ZMatrix equations = gfan::ZMatrix(0,n);
     27  for (int i=0; i<IDELEMS(I); i++)
     28  {
     29    g = (poly) I->m[i]; pGetExpV(g,leadexpv);
     30    leadexpw = intStar2ZVector(n, leadexpv);
     31    pIter(g);
     32    while (g != NULL)
     33    {
     34      pGetExpV(g,tailexpv);
     35      tailexpw = intStar2ZVector(n, tailexpv);
     36      equations.appendRow(leadexpw-tailexpw);
     37      pIter(g);
     38    }
     39  }
     40  omFreeSize(leadexpv,(n+1)*sizeof(int));
     41  omFreeSize(tailexpv,(n+1)*sizeof(int));
     42  return gfan::ZCone(gfan::ZMatrix(0, equations.getWidth()),equations);
     43}
     44
     45
    1846BOOLEAN homogeneitySpace(leftv res, leftv args)
    1947{
     
    2452    if (v == NULL)
    2553    {
    26       int n = currRing->N;
    2754      ideal I = (ideal) u->Data();
    28       poly g;
    29       int* leadexpv = (int*) omAlloc((n+1)*sizeof(int));
    30       int* tailexpv = (int*) omAlloc((n+1)*sizeof(int));
    31       gfan::ZVector leadexpw = gfan::ZVector(n);
    32       gfan::ZVector tailexpw = gfan::ZVector(n);
    33       gfan::ZMatrix equations = gfan::ZMatrix(0,n);
    34       for (int i=0; i<IDELEMS(I); i++)
    35       {
    36         g = (poly) I->m[i]; pGetExpV(g,leadexpv);
    37         leadexpw = intStar2ZVector(n, leadexpv);
    38         pIter(g);
    39         while (g != NULL)
    40         {
    41           pGetExpV(g,tailexpv);
    42           tailexpw = intStar2ZVector(n, tailexpv);
    43           equations.appendRow(leadexpw-tailexpw);
    44           pIter(g);
    45         }
    46       }
    47       gfan::ZCone* gCone = new gfan::ZCone(gfan::ZMatrix(0, equations.getWidth()),equations);
    48       omFreeSize(leadexpv,(n+1)*sizeof(int));
    49       omFreeSize(tailexpv,(n+1)*sizeof(int));
    50 
    5155      res->rtyp = coneID;
    52       res->data = (void*) gCone;
     56      res->data = (void*) new gfan::ZCone(homogeneitySpace(I,currRing));
    5357      return FALSE;
    5458    }
  • Singular/dyn_modules/gfanlib/tropical.h

    r06d5774 rfb1872  
    44#include "Singular/ipid.h"
    55
     6gfan::ZCone homogeneitySpace(ideal I, ring r);
    67void tropical_setup(SModulFunctions* p);
    78
  • Singular/dyn_modules/gfanlib/tropicalStrategy.cc

    r06d5774 rfb1872  
    33#include <ppinitialReduction.h>
    44#include <ttinitialReduction.h>
     5#include <tropical.h>
    56
    67// for various commands in dim(ideal I, ring r):
     
    1213 * Copied from jjDim in iparith.cc
    1314 **/
    14 static int dim(ideal I, ring r)
     15int dim(ideal I, ring r)
    1516{
    1617  ring origin = currRing;
     
    7374  weightAdjustingAlgorithm1 = valued_adjustWeightForHomogeneity;
    7475  weightAdjustingAlgorithm2 = valued_adjustWeightUnderHomogeneity;
    75   reductionAlgorithm = ppreduceInitially;
     76  extraReductionAlgorithm = ppreduceInitially;
    7677}
    7778
    78 static bool doNothing(ideal /*I*/, ring /*r*/, number /*p*/)
     79static bool nothing(ideal /*I*/, ring /*r*/, number /*p*/)
    7980{
    8081  return false;
     
    8990  /* assume that the ground field of the originalRing is Q */
    9091  assume(rField_is_Q(r));
     92
     93  onlyLowerHalfSpace = false;                         // convex computations in the whole vector space
    9194  originalRing = rCopy(r);
     95  originalIdeal = id_Copy(I,r);
     96  dimensionOfIdeal = dim(originalIdeal,originalRing); // compute dimension of ideal
     97  startingRing = rCopy(originalRing);                 // starting ring is the original ring
     98  startingIdeal = id_Copy(I,startingRing);
     99  uniformizingParameter = NULL;                       // no uniformizing parameter
     100  linealitySpace = homogeneitySpace(I,startingRing);  // compute lineality space of tropical variety
    92101
    93   /* the starting ring is the originaRing */
    94   startingRing = rCopy(originalRing);
    95 
    96   /* the uniformizing parameter is non-existant*/
    97   uniformizingParameter = NULL;
    98 
    99   /* set the startingIdeal */
    100   startingIdeal = id_Copy(I,startingRing);
    101 
    102   /* compute the dimension of the ideal */
    103   dimensionOfIdeal = dim(startingIdeal,startingRing);
    104 
    105   /* set the flag that convex computations only occur in the lower half space to false */
    106   onlyLowerHalfSpace = false;
    107 
    108   /* set the function pointers to the appropiate functions */
     102  /* set function pointers to the appropiate functions */
    109103  weightAdjustingAlgorithm1 = nonvalued_adjustWeightForHomogeneity;
    110104  weightAdjustingAlgorithm2 = nonvalued_adjustWeightUnderHomogeneity;
    111   reductionAlgorithm = doNothing;
     105  extraReductionAlgorithm = nothing;
    112106}
    113107
     
    121115  weightAdjustingAlgorithm1(currentStrategy.getWeightAdjustingAlgorithm1()),
    122116  weightAdjustingAlgorithm2(currentStrategy.getWeightAdjustingAlgorithm2()),
    123   reductionAlgorithm(currentStrategy.getReductionAlgorithm())
     117  extraReductionAlgorithm(currentStrategy.getExtraReductionAlgorithm())
    124118{
    125119  if (startingRing) rTest(startingRing);
     
    148142  weightAdjustingAlgorithm1 = currentStrategy.getWeightAdjustingAlgorithm1();
    149143  weightAdjustingAlgorithm2 = currentStrategy.getWeightAdjustingAlgorithm2();
    150   reductionAlgorithm = currentStrategy.getReductionAlgorithm();
     144  extraReductionAlgorithm = currentStrategy.getExtraReductionAlgorithm();
    151145
    152146  if (startingRing) rTest(startingRing);
  • Singular/dyn_modules/gfanlib/tropicalStrategy.h

    r06d5774 rfb1872  
    1515private:
    1616  ring originalRing;
     17  ideal originalIdeal;
     18  int dimensionOfIdeal;
    1719  ring startingRing;
     20  ideal startingIdeal;
    1821  number uniformizingParameter;
    19   ideal startingIdeal;
    20   int dimensionOfIdeal;
     22  gfan::ZCone linealitySpace;
    2123  bool onlyLowerHalfSpace;
    2224
    2325  gfan::ZVector (*weightAdjustingAlgorithm1) (gfan::ZVector w);
    2426  gfan::ZVector (*weightAdjustingAlgorithm2) (gfan::ZVector v, gfan::ZVector w);
    25   bool (*reductionAlgorithm) (ideal I, ring r, number p);
     27  bool (*extraReductionAlgorithm) (ideal I, ring r, number p);
    2628
    2729public:
     
    6264  }
    6365
     66  gfan::ZCone getHomogeneitySpace() const
     67  {
     68    return linealitySpace;
     69  }
     70
     71  int getDimensionOfHomogeneitySpace() const
     72  {
     73    return linealitySpace.dimension();
     74  }
     75
    6476  bool restrictToLowerHalfSpace() const
    6577  {
     
    7789  }
    7890
    79   redAlg getReductionAlgorithm() const
     91  redAlg getExtraReductionAlgorithm() const
    8092  {
    81     return reductionAlgorithm;
     93    return extraReductionAlgorithm;
    8294  }
    8395
     
    95107  {
    96108    rTest(r);  id_Test(I,r);
    97     return this->reductionAlgorithm(I,r,uniformizingParameter);
     109    return this->extraReductionAlgorithm(I,r,uniformizingParameter);
    98110  }
    99111};
    100112
     113int dim(ideal I, ring r);
     114
    101115#endif
Note: See TracChangeset for help on using the changeset viewer.