Changeset eb836c in git
- Timestamp:
- Jul 21, 2014, 11:41:11 AM (9 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- d4049cf8c7b6c2765919c8fcc08a3b038d0e1c29
- Parents:
- e744d9067cafc8137765bab643ab9ebf8120f339
- git-author:
- Yue Ren <ren@mathematik.uni-kl.de>2014-07-21 11:41:11+02:00
- git-committer:
- Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:03+01:00
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/gfanlib/adjustWeights.cc
re744d9 reb836c 64 64 /* find k such that e+k*w is strictly positive, 65 65 * i.e. k such that e[i]+k*w[i] is strictly positive 66 * for all i=0,...,n */ 66 * for all i=0,...,n 67 * note that the division is rounded towards zero, 68 * hence we increment the value by 1 */ 67 69 gfan::Integer k((long)0); 68 70 if (e[0].sign()<=0) 69 k = gfan::Integer((long)1)-( gfan::Integer((long)e[0].sign())*e[0])/w[0];71 k = gfan::Integer((long)1)-(e[0]/w[0]); 70 72 for (unsigned i=1; i<e.size(); i++) 71 73 { 72 gfan::Integer kk = gfan::Integer((long)1)-(gfan::Integer((long)e[i].sign())*e[i])/w[i]; 73 if (k<kk) 74 k = kk; 74 if (e[i].sign()<=0) 75 { 76 gfan::Integer kk = gfan::Integer((long)1)-(e[i]/w[i]); 77 if (k<kk) 78 k = kk; 79 } 75 80 } 76 81 /* compute e+k*w, check it for correctness and return it */ -
Singular/dyn_modules/gfanlib/groebnerCone.cc
re744d9 reb836c 41 41 << "weight: " << std::endl 42 42 << v << std::endl; 43 } 44 return zc.contains(v); 43 return false; 44 } 45 return true; 45 46 } 46 47 return (zc.dimension()==0); … … 144 145 } 145 146 147 /*** 148 * Computes the groebner cone of I around u+e*w for e>0 sufficiently small. 149 * Assumes that this cone is a face of the maximal Groenbner cone given by the ordering of r. 150 **/ 151 groebnerCone::groebnerCone(const ideal I, const ring r, const gfan::ZVector& u, const gfan::ZVector& w, const tropicalStrategy& currentCase): 152 polynomialIdeal(NULL), 153 polynomialRing(NULL), 154 currentStrategy(¤tCase) 155 { 156 assume(checkPolynomialInput(I,r)); 157 if (I) polynomialIdeal = id_Copy(I,r); 158 if (r) polynomialRing = rCopy(r); 159 160 int n = rVar(r); 161 gfan::ZMatrix inequalities = gfan::ZMatrix(0,n); 162 gfan::ZMatrix equations = gfan::ZMatrix(0,n); 163 int* expv = (int*) omAlloc((n+1)*sizeof(int)); 164 for (int i=0; i<idSize(polynomialIdeal); i++) 165 { 166 poly g = polynomialIdeal->m[i]; 167 p_GetExpV(g,expv,polynomialRing); 168 gfan::ZVector leadexpv = intStar2ZVector(n,expv); 169 long d1 = wDeg(g,polynomialRing,u); 170 long d2 = wDeg(g,polynomialRing,w); 171 for (pIter(g); g; pIter(g)) 172 { 173 p_GetExpV(g,expv,polynomialRing); 174 gfan::ZVector tailexpv = intStar2ZVector(n,expv); 175 if (wDeg(g,polynomialRing,u)==d1 && wDeg(g,polynomialRing,w)==d2) 176 equations.appendRow(leadexpv-tailexpv); 177 else 178 { 179 assume(wDeg(g,polynomialRing,u)<d1 || wDeg(g,polynomialRing,w)<d2); 180 inequalities.appendRow(leadexpv-tailexpv); 181 } 182 } 183 } 184 omFreeSize(expv,(n+1)*sizeof(int)); 185 186 polyhedralCone = gfan::ZCone(inequalities,equations); 187 interiorPoint = polyhedralCone.getRelativeInteriorPoint(); 188 assume(checkOrderingAndCone(polynomialRing,polyhedralCone)); 189 } 190 191 146 192 groebnerCone::groebnerCone(const ideal I, const ideal inI, const ring r, const tropicalStrategy& currentCase): 147 193 polynomialIdeal(id_Copy(I,r)), … … 272 318 } 273 319 /* check whether facet normal points outwards */ 274 gfan::ZMatrix halfSpaceInequality(0,facetNormal.size()); 275 halfSpaceInequality.appendRow(facetNormal); 276 gfan::ZCone halfSpace = gfan::ZCone(halfSpaceInequality,gfan::ZMatrix(0,facetNormal.size())); 277 hopefullyAFacet = intersection(polyhedralCone, halfSpace); 278 if (hopefullyAFacet.dimension()!=(polyhedralCone.dimension()-1)) 320 gfan::ZCone dual = polyhedralCone.dualCone(); 321 if(dual.contains(facetNormal)) 279 322 { 280 323 std::cout << "ERROR: facetNormal is not pointing outwards!" << std::endl … … 302 345 std::pair<ideal,ring> flipped = flip(polynomialIdeal,polynomialRing,interiorPoint,facetNormal,*currentStrategy); 303 346 assume(checkPolynomialInput(flipped.first,flipped.second)); 304 groebnerCone flippedCone(flipped.first, flipped.second, facetNormal, *currentStrategy);347 groebnerCone flippedCone(flipped.first, flipped.second, interiorPoint, facetNormal, *currentStrategy); 305 348 return flippedCone; 306 349 } … … 432 475 { 433 476 ideal initialIdeal = initial(polynomialIdeal,polynomialRing,interiorPoints[i]); 434 std::set<gfan::ZVector> rays = raysOfTropicalCurve(initialIdeal,polynomialRing,*currentStrategy); 435 groebnerCones neighbours; 477 std::set<gfan::ZVector> rays = raysOfTropicalStar(initialIdeal,polynomialRing,interiorPoints[i],*currentStrategy); 436 478 for (std::set<gfan::ZVector>::iterator ray = rays.begin(); ray!=rays.end(); ray++) 437 479 neighbours.insert(this->flipCone(interiorPoints[i],*ray)); -
Singular/dyn_modules/gfanlib/groebnerCone.h
re744d9 reb836c 32 32 groebnerCone(const ideal I, const ring r, const tropicalStrategy& currentCase); 33 33 groebnerCone(const ideal I, const ring r, const gfan::ZVector& w, const tropicalStrategy& currentCase); 34 groebnerCone(const ideal I, const ring r, const gfan::ZVector& u, const gfan::ZVector& w, const tropicalStrategy& currentCase); 34 35 groebnerCone(const ideal I, const ideal inI, const ring r, const tropicalStrategy& currentCase); 35 36 groebnerCone(const groebnerCone& sigma); -
Singular/dyn_modules/gfanlib/tropicalCurves.cc
re744d9 reb836c 4 4 #include <callgfanlib_conversion.h> 5 5 #include <gfanlib_exceptions.h> 6 #include <std_wrapper.h> 6 7 #include <containsMonomial.h> 7 8 #include <initial.h> … … 54 55 { 55 56 int n = rVar(r); 56 int h = E.getHeight();57 int h = W.getHeight(); 57 58 58 59 /* create a copy s of r and delete its ordering */ … … 78 79 s->block0[1] = 1; 79 80 s->block1[1] = n; 80 gfan::ZVector wAdjusted = currentStrategy.adjustWeightUn terHomogeneity(w,uAdjusted);81 gfan::ZVector wAdjusted = currentStrategy.adjustWeightUnderHomogeneity(w,uAdjusted); 81 82 s->wvhdl[1] = ZVectorToIntStar(wAdjusted,overflow); 82 for (int j=0; j<h ; j++)83 for (int j=0; j<h-1; j++) 83 84 { 84 85 s->order[j+2] = ringorder_a; … … 88 89 s->wvhdl[j+2] = ZVectorToIntStar(wAdjusted,overflow); 89 90 } 90 s->order[h+ 2] = ringorder_wp;91 s->block0[h+ 2] = 1;92 s->block1[h+ 2] = n;93 wAdjusted = currentStrategy.adjustWeightUnderHomogeneity(W[ j],uAdjusted);94 s->wvhdl[h+ 2] = ZVectorToIntStar(wAdjusted,overflow);95 s->order[h+ 3] = ringorder_C;91 s->order[h+1] = ringorder_wp; 92 s->block0[h+1] = 1; 93 s->block1[h+1] = n; 94 wAdjusted = currentStrategy.adjustWeightUnderHomogeneity(W[h-1],uAdjusted); 95 s->wvhdl[h+1] = ZVectorToIntStar(wAdjusted,overflow); 96 s->order[h+2] = ringorder_C; 96 97 97 98 if (overflow) … … 130 131 for (std::set<gfan::ZCone>::iterator zc=C.begin(); zc!=C.end(); zc++) 131 132 { 132 gfan::ZVector v= zc->getRelativeInteriorPoint();133 gfan::ZVector w = zc->getRelativeInteriorPoint(); 133 134 gfan::ZMatrix W = zc->generatorsOfSpan(); 134 135 135 ring s = genericlyWeightedOrdering(r, v,W,currentStrategy);136 ring s = genericlyWeightedOrdering(r,u,w,W,currentStrategy); 136 137 nMapFunc identity = n_SetMap(r->cf,s->cf); 137 138 ideal inIs = idInit(k); … … 140 141 141 142 inIs = gfanlib_kStd_wrapper(inIs,s,isHomog); 142 ideal ininIs = initial(inIs,s, E[E.getHeight()-1]);143 ideal ininIs = initial(inIs,s,W[W.getHeight()-1]); 143 144 144 145 poly mons = checkForMonomialViaSuddenSaturation(inIs,s); … … 149 150 nMapFunc mMap = n_SetMap(s->cf,r->cf); 150 151 poly gr = p_PermPoly(gs,NULL,s,r,mMap,NULL,0); 151 idInsertPoly( I,gr);152 idInsertPoly(inI,gr); 152 153 k++; 153 154 p_Delete(&mons,s); … … 155 156 zc = C.begin(); 156 157 } 157 id_Delete(&Is,s);158 158 id_Delete(&inIs,s); 159 id_Delete(&ininIs,s); 159 160 rDelete(s); 160 161 } … … 163 164 164 165 165 std::set<gfan::ZVector> raysOfTropical Curve(ideal I, const ring r, const tropicalStrategy& currentStrategy)166 { 167 std::set<gfan::ZCone> C = tropical Curve(I,r,currentStrategy);166 std::set<gfan::ZVector> raysOfTropicalStar(ideal I, const ring r, const gfan::ZVector u, const tropicalStrategy& currentStrategy) 167 { 168 std::set<gfan::ZCone> C = tropicalStar(I,r,u,currentStrategy); 168 169 std::set<gfan::ZVector> raysOfC; 169 170 for (std::set<gfan::ZCone>::iterator zc=C.begin(); zc!=C.end(); zc++) -
Singular/dyn_modules/gfanlib/tropicalCurves.h
re744d9 reb836c 7 7 #include <tropicalStrategy.h> 8 8 9 std::set<gfan::ZCone> tropicalCurve(const ideal I, const ring r, const tropicalStrategy& currentStrategy); 10 std::set<gfan::ZVector> raysOfTropicalCurve(ideal I, const ring r, const tropicalStrategy& currentStrategy); 9 std::set<gfan::ZCone> tropicalStar(const ideal I, const ring r, const gfan::ZVector u, 10 const tropicalStrategy& currentStrategy); 11 std::set<gfan::ZVector> raysOfTropicalStar(ideal I, const ring r, const gfan::ZVector u, 12 const tropicalStrategy& currentStrategy); 11 13 12 14 #ifndef NDEBUG -
dyn_modules/callgfanlib/std_wrapper.cc
re744d9 reb836c 1 1 #include <kernel/kstd1.h> 2 2 #include <kernel/polys.h> 3 #include <kernel/ideals.h> 3 4 4 5 ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog) -
dyn_modules/callgfanlib/tropicalTraversal.cc
re744d9 reb836c 10 10 const groebnerCone sigma=*(workingList.begin()); 11 11 const groebnerCones neighbours = sigma.tropicalNeighbours(); 12 workingList.insert(neighbours.begin(),neighbours.end()); 12 for (groebnerCones::iterator tau = neighbours.begin(); tau!=neighbours.end(); tau++) 13 { 14 if (tropicalVariety.count(*tau)==0) 15 workingList.insert(*tau); 16 } 13 17 tropicalVariety.insert(sigma); 14 18 workingList.erase(sigma); 19 std::cout << "tropicalVariety.size():" << tropicalVariety.size() << std::endl; 20 std::cout << "workingList.size():" << workingList.size() << std::endl; 15 21 } 16 22 return tropicalVariety;
Note: See TracChangeset
for help on using the changeset viewer.