Changeset e744d9 in git for Singular/dyn_modules/gfanlib/tropicalCurves.cc
 Timestamp:
 Jul 17, 2014, 12:28:18 PM (9 years ago)
 Branches:
 (u'spielwiese', 'ec94ef7a30b928574c0c3daf41f6804dff5f6b69')
 Children:
 eb836ceccfffe01622457439ed104bca800bc101
 Parents:
 3c0aa5079c417e92fdfaa03c1d87d73f5b365291
 gitauthor:
 Yue Ren <ren@mathematik.unikl.de>20140717 12:28:18+02:00
 gitcommitter:
 Yue Ren <ren@mathematik.unikl.de>20150206 13:47:03+01:00
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/dyn_modules/gfanlib/tropicalCurves.cc
r3c0aa5 re744d9 44 44 45 45 /*** 46 * Given a weight w and k more weights E[1], ..., E[h] stored as row vectors of a matrix E,47 + returns a ring whose ordering is weighted with respect to any48 * w +\varepsilon_1*E[1]+...+\varepsilon_k*E[h] for \varepsilon_i sufficiently small.49 * In particular, if E[1], ..., E[h] generate a vector space of dimension d,50 * this ordering can be used to compute a Groebner cone of dimension d containing w.51 **/ 52 static ring genericlyWeightedOrdering(const ring r, const gfan::ZVector w, const gfan::ZMatrix E,53 const tropicalStrategy& currentStrategy)54 { 55 int n = r >N;46 * Given a ring r, weights u, w, and a matrix E, returns a copy of r whose ordering is, 47 * for any ideal homogeneous with respect to u, weighted with respect to u and 48 * whose tiebreaker is genericly weighted with respect to v and E in the following sense: 49 * the ordering "lies" on the affine space A running through v and spanned by the row vectors of E, 50 * and it lies in a Groebner cone of dimension at least rank(E)=dim(A). 51 **/ 52 static ring genericlyWeightedOrdering(const ring r, const gfan::ZVector u, const gfan::ZVector w, 53 const gfan::ZMatrix W, const tropicalStrategy& currentStrategy) 54 { 55 int n = rVar(r); 56 56 int h = E.getHeight(); 57 57 … … 59 59 ring s = rCopy0(r); 60 60 omFree(s>order); 61 s>order = (int*) omAlloc0((h+ 3)*sizeof(int));61 s>order = (int*) omAlloc0((h+4)*sizeof(int)); 62 62 omFree(s>block0); 63 s>block0 = (int*) omAlloc0((h+ 3)*sizeof(int));63 s>block0 = (int*) omAlloc0((h+4)*sizeof(int)); 64 64 omFree(s>block1); 65 s>block1 = (int*) omAlloc0((h+ 3)*sizeof(int));65 s>block1 = (int*) omAlloc0((h+4)*sizeof(int)); 66 66 for (int j=0; s>wvhdl[j]; j++) omFree(s>wvhdl[j]); 67 67 omFree(s>wvhdl); 68 s>wvhdl = (int**) omAlloc0((h+ 3)*sizeof(int*));69 70 /* construct a new ordering a nd keep an eye out for weight overflows*/68 s>wvhdl = (int**) omAlloc0((h+4)*sizeof(int*)); 69 70 /* construct a new ordering as describe above */ 71 71 bool overflow; 72 72 s>order[0] = ringorder_a; 73 73 s>block0[0] = 1; 74 74 s>block1[0] = n; 75 s>wvhdl[0] = ZVectorToIntStar(w,overflow); 76 for (int j=1; j<h; j++) 77 { 78 s>order[j] = ringorder_a; 79 s>block0[j] = 1; 80 s>block1[j] = n; 81 s>wvhdl[j] = ZVectorToIntStar(currentStrategy.adjustWeightUnderHomogeneity(E[j1],w),overflow); 82 } 83 s>order[h] = ringorder_wp; 84 s>block0[h] = 1; 85 s>block1[h] = n; 86 s>wvhdl[h] = ZVectorToIntStar(currentStrategy.adjustWeightUnderHomogeneity(E[h1],w),overflow); 87 s>order[h+1] = ringorder_C; 75 gfan::ZVector uAdjusted = currentStrategy.adjustWeightForHomogeneity(u); 76 s>wvhdl[0] = ZVectorToIntStar(uAdjusted,overflow); 77 s>order[1] = ringorder_a; 78 s>block0[1] = 1; 79 s>block1[1] = n; 80 gfan::ZVector wAdjusted = currentStrategy.adjustWeightUnterHomogeneity(w,uAdjusted); 81 s>wvhdl[1] = ZVectorToIntStar(wAdjusted,overflow); 82 for (int j=0; j<h; j++) 83 { 84 s>order[j+2] = ringorder_a; 85 s>block0[j+2] = 1; 86 s>block1[j+2] = n; 87 wAdjusted = currentStrategy.adjustWeightUnderHomogeneity(W[j],uAdjusted); 88 s>wvhdl[j+2] = ZVectorToIntStar(wAdjusted,overflow); 89 } 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; 88 96 89 97 if (overflow) … … 97 105 98 106 /*** 99 * Given an ideal I which is homogeneous in the later variables of r, 100 * whose tropicalization is, modulo its lineality space, a tropical Curve, 101 * computes the said tropicalization. 102 * At the end of the computation, I will contain a tropical basis. 103 * If the dimension of the tropical variety is known beforehand, 104 * it can be provided in order to speed up the computation. 105 **/ 106 std::set<gfan::ZCone> tropicalCurve(ideal I, const ring r, const tropicalStrategy currentStrategy) 107 { 108 int k = idSize(I); 107 * Let I be an ideal. Given a weight vector u in the relative interior 108 * of a onecodimensional cone of the tropical variety of I and 109 * the initial ideal inI with respect to it, computes the star of the tropical variety in u. 110 **/ 111 std::set<gfan::ZCone> tropicalStar(ideal inI, const ring r, const gfan::ZVector u, 112 const tropicalStrategy currentStrategy) 113 { 114 int k = idSize(inI); 115 int d = currentStrategy.getDimensionOfIdeal(); 109 116 110 117 /* Compute the common refinement over all tropical varieties 111 118 * of the polynomials in the generating set */ 112 std::set<gfan::ZCone> C = tropicalVariety( I>m[0],r,currentStrategy);119 std::set<gfan::ZCone> C = tropicalVariety(inI>m[0],r,currentStrategy); 113 120 for (int i=1; i<k; i++) 114 C = intersect(C,tropicalVariety( I>m[i],r,currentStrategy),currentStrategy.getDimensionOfIdeal());121 C = intersect(C,tropicalVariety(inI>m[i],r,currentStrategy),d); 115 122 116 123 /* Cycle through all maximal cones of the refinement. … … 124 131 { 125 132 gfan::ZVector v = zc>getRelativeInteriorPoint(); 126 gfan::ZMatrix E= zc>generatorsOfSpan();127 128 ring s = genericlyWeightedOrdering(r,v, E,currentStrategy);129 nMapFunc nMap= n_SetMap(r>cf,s>cf);130 ideal Is = idInit(k);133 gfan::ZMatrix W = zc>generatorsOfSpan(); 134 135 ring s = genericlyWeightedOrdering(r,v,W,currentStrategy); 136 nMapFunc identity = n_SetMap(r>cf,s>cf); 137 ideal inIs = idInit(k); 131 138 for (int j=0; j<k; j++) 132 Is>m[j] = p_PermPoly(I>m[j],NULL,r,s,nMap,NULL,0); 133 ideal inIs = initial(Is,s,E[E.getHeight()1]); 139 inIs>m[j] = p_PermPoly(inI>m[j],NULL,r,s,identity,NULL,0); 140 141 inIs = gfanlib_kStd_wrapper(inIs,s,isHomog); 142 ideal ininIs = initial(inIs,s,E[E.getHeight()1]); 134 143 135 144 poly mons = checkForMonomialViaSuddenSaturation(inIs,s); 136 145 if (mons) 137 146 { 138 poly gs = witness(mons, Is,inIs,s);139 C = intersect(C,tropicalVariety(gs,s,currentStrategy), currentStrategy.getDimensionOfIdeal());147 poly gs = witness(mons,inIs,ininIs,s); 148 C = intersect(C,tropicalVariety(gs,s,currentStrategy),d); 140 149 nMapFunc mMap = n_SetMap(s>cf,r>cf); 141 150 poly gr = p_PermPoly(gs,NULL,s,r,mMap,NULL,0);
Note: See TracChangeset
for help on using the changeset viewer.