Changeset 0be039 in git for Singular/LIB/freegb.lib
 Timestamp:
 Mar 16, 2018, 6:27:45 PM (6 years ago)
 Branches:
 (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
 Children:
 52ac0882b123798821765bb16d5ba4b371ced4cd
 Parents:
 95a42a2dacdcadb5c004cb3520b5c252dfe8e784df09c0184ffc4aaf31c02b8691e68734f25fc3b3
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/LIB/freegb.lib
r95a42a2 r0be039 51 51 LIB "qhmoduli.lib"; // for Max 52 52 LIB "bfun.lib"; // for inForm 53 LIB "fpadim.lib"; // for intvec conversion 53 54 54 55 proc tstfreegb() … … 3278 3279 } 3279 3280 3281 proc lpDivision(poly p, ideal I) 3282 "ASSUME: I is a Groebner basis G = {g1,...,gN}, the original ring of the Letterplace ring has the name 'r' and no variable is called 'tag_i' for i in 1...N 3283 RETURN: list L 3284 NOTE:  L[1] NF(p,I) 3285  L[2] list of expressions [i,l_{ij},r_{ij}] with \sum_{i,j} l_{ij} g_i r_{ij} = p  NF(p,I) 3286 " 3287 { 3288 if (p == 0  size(I) == 0) { 3289 list L = 0; 3290 list empty; 3291 L[2] = empty; 3292 return (L); 3293 } 3294 poly pNF = lpNF(p,I); 3295 p = p  pNF; 3296 3297 // make new ring 3298 def save = basering; 3299 int norigvars = nvars(r); 3300 string tagvarstr = "(tag_1"; 3301 for (int i = 2; i <= size(I); i++) { 3302 tagvarstr = tagvarstr + ",tag_" + string(i); 3303 } kill i; 3304 tagvarstr = tagvarstr + ")"; 3305 string field = string(ringlist(r)[1]); 3306 execute("ring @tags = " + field + "," + tagvarstr + ",dp;"); 3307 ring @tagged = (r + @tags); 3308 def @R = makeLetterplaceRing(attrib(save,"uptodeg")); setring @R; 3309 3310 // restore vars 3311 poly p = imap(save, p); 3312 poly pNF = imap(save, pNF); 3313 ideal I = imap(save, I); 3314 for (int i = 1; i <= size(I); i++) { 3315 I[i] = I[i]  var(norigvars + i); 3316 } kill i; 3317 3318 list summands; 3319 list L = pNF; 3320 poly pTaggedNF = lpNF(p,I); 3321 pTaggedNF = pTaggedNF * leadcoef(p); // somehow pTaggedNF gets normalized 3322 for (int i = 1; i <= size(pTaggedNF); i++) { 3323 intvec iv = lp2iv(pTaggedNF[i]); 3324 for (int j = 1; j <= size(iv); j++) { 3325 if (iv[j] > norigvars) { 3326 intvec left; 3327 intvec right; 3328 if (j > 1) { 3329 left = iv[1..(j1)]; 3330 } 3331 if (j < size(iv)) { 3332 right = iv[(j+1)..size(iv)]; 3333 } 3334 list summand = (iv[j]  norigvars), leadcoef(pTaggedNF[i])*iv2lp(left), iv2lp(right); 3335 summands = insert(summands, summand, size(summands)); 3336 3337 kill left; 3338 kill right; 3339 kill summand; 3340 break; 3341 } 3342 } kill j; 3343 kill iv; 3344 } kill i; 3345 3346 L[2] = summands; 3347 3348 setring save; 3349 list L = imap(@R,L); 3350 return (L); 3351 } 3352 3353 proc lpGBPres2Poly(list L, ideal I) 3354 "ASSUME: L is a valid Groebner presentation as for example the result of lpDivision 3355 RETURN: poly 3356 NOTE: computes p = \sum_{i,j} l_{ij} g_i r_{ij} + NF(p,I) = \sum_{i} L[2][i][2] I[L[2][i][1]] L[2][i][3] + L[1] 3357 " 3358 { 3359 poly p; 3360 for (int i = 1; i <= size(L[2]); i++) { 3361 p = p + lpMult(lpMult(L[2][i][2], I[L[2][i][1]]), L[2][i][3]); 3362 } 3363 p = p + L[1]; 3364 return (p); 3365 } 3366 3280 3367 //procedures to convert monomials into the DVec representation, all static 3281 3368 ////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.