Changeset bf83d3 in git
- Timestamp:
- Dec 14, 2014, 11:28:20 AM (9 years ago)
- Branches:
- (u'spielwiese', 'd0474371d8c5d8068ab70bfb42719c97936b18a6')
- Children:
- e5618cd2798aac0cb8de02188d38a8971f2c51e0
- Parents:
- 4b47563a73afa1ce8193b66caba4ddd88af4f706
- git-author:
- Yue Ren <ren@mathematik.uni-kl.de>2014-12-14 11:28:20+01:00
- git-committer:
- Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:05+01:00
- Location:
- Singular/dyn_modules/gfanlib
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/gfanlib/adjustWeights.cc
r4b47563 rbf83d3 48 48 for (unsigned i=1; i<w.size(); i++) 49 49 if (w[i]<min) min=w[i]; 50 51 if (min.sign()>0) 52 return w; 53 50 54 /* compute w+(1-min)*(1,...,1) and return it */ 51 55 gfan::ZVector v=gfan::ZVector(w.size()); 52 if (min<1) 53 { 54 for (unsigned i=0; i<w.size(); i++) 55 v[i]=w[i]-min+1; 56 } 56 for (unsigned i=0; i<w.size(); i++) 57 v[i]=w[i]-min+1; 57 58 assume(checkForNonPositiveEntries(v)); 58 59 return v; -
Singular/dyn_modules/gfanlib/bbcone.cc
r4b47563 rbf83d3 959 959 gfan::ZVector randomPoint(const gfan::ZCone* zc) 960 960 { 961 gfan::ZVector rp = gfan::ZVector(zc->ambientDimension()); 962 961 963 gfan::ZMatrix rays = zc->extremeRays(); 962 gfan::ZVector rp = gfan::ZVector(zc->ambientDimension());963 964 for (int i=0; i<rays.getHeight(); i++) 964 965 { … … 966 967 rp = rp + n * rays[i]; 967 968 } 969 970 gfan::ZMatrix lins = zc->generatorsOfLinealitySpace(); 971 for (int i=0; i<lins.getHeight(); i++) 972 { 973 int n = siRand(); 974 rp = rp + n * lins[i]; 975 } 976 968 977 return rp; 969 978 } -
Singular/dyn_modules/gfanlib/containsMonomial.cc
r4b47563 rbf83d3 169 169 { 170 170 ring origin = currRing; 171 if (currRing != r) 172 rChangeCurrRing(r); 173 171 174 ideal M = idInit(1); 172 175 M->m[0] = p_Init(r); … … 176 179 p_Setm(M->m[0],r); p_Test(M->m[0],r); 177 180 181 // for (int i=1; i<100; i++) 182 // { 183 // omUpdateInfo(); 184 // Print("usedBytesBefore=%ld\n",om_Info.UsedBytes); 185 // ideal J = id_Copy(I,r); bool b; int k = 0; 186 // intvec* nullVector = NULL; 187 // do 188 // { 189 // ideal Jstd = kStd(J,currRing->qideal,testHomog,&nullVector); 190 // ideal JquotM = idQuot(Jstd,M,true,true); 191 // ideal JquotMredJ = kNF(Jstd,currRing->qideal,JquotM); 192 // b = idIs0(JquotMredJ); 193 // id_Delete(&Jstd,r); 194 // id_Delete(&J,r); 195 // J = JquotM; 196 // id_Delete(&JquotMredJ,r); 197 // k++; 198 // } while (!b); 199 // id_Delete(&J,r); 200 // } 201 178 202 ideal J = id_Copy(I,r); bool b; int k = 0; 179 203 if (currRing != r) rChangeCurrRing(r); … … 182 206 { 183 207 ideal Jstd = kStd(J,currRing->qideal,testHomog,&nullVector); 184 ideal JquotM = idQuot(Jstd,M,true,true); k++;208 ideal JquotM = idQuot(Jstd,M,true,true); 185 209 ideal JquotMredJ = kNF(Jstd,currRing->qideal,JquotM); 186 210 b = idIs0(JquotMredJ); 187 id_Delete(&Jstd,r); id_Delete(&J,r); J = JquotM; 211 id_Delete(&Jstd,r); 212 id_Delete(&J,r); 213 J = JquotM; 188 214 id_Delete(&JquotMredJ,r); 215 k++; 189 216 } while (!b); 190 217 191 if (currRing != origin) rChangeCurrRing(origin);192 218 poly monom = NULL; 193 219 if (id_IsConstant(J,r)) … … 201 227 id_Delete(&M,r); 202 228 id_Delete(&J,r); 229 230 if (currRing != origin) 231 rChangeCurrRing(origin); 203 232 return monom; 204 233 } -
Singular/dyn_modules/gfanlib/groebnerCone.cc
r4b47563 rbf83d3 339 339 assume(checkPolyhedralInput(polyhedralCone,interiorPoint)); 340 340 if (polynomialIdeal) id_Delete(&polynomialIdeal,polynomialRing); 341 if (reducedPolynomialIdeal) id_Delete(&reducedPolynomialIdeal,polynomialRing); 342 if (initialPolynomialIdeal) id_Delete(&initialPolynomialIdeal,polynomialRing); 341 343 if (polynomialRing) rDelete(polynomialRing); 342 344 } … … 440 442 * to obtain an initial form with respect to interiorPoint+e*facetNormal, 441 443 * for e>0 sufficiently small */ 442 std::pair<ideal,ring> flipped = currentStrategy-> getFlip(reducedPolynomialIdeal,polynomialRing,interiorPoint,facetNormal);444 std::pair<ideal,ring> flipped = currentStrategy->computeFlip(reducedPolynomialIdeal,polynomialRing,interiorPoint,facetNormal); 443 445 assume(checkPolynomialInput(flipped.first,flipped.second)); 444 446 groebnerCone flippedCone(flipped.first, flipped.second, interiorPoint, facetNormal, *currentStrategy); 447 id_Delete(&flipped.first,flipped.second); 448 rDelete(flipped.second); 445 449 return flippedCone; 446 450 } … … 506 510 { 507 511 std::pair<gfan::ZMatrix, gfan::ZMatrix> facetsData = interiorPointsAndNormalsOfFacets(polyhedralCone); 512 508 513 gfan::ZMatrix interiorPoints = facetsData.first; 509 514 gfan::ZMatrix facetNormals = facetsData.second; … … 520 525 continue; 521 526 } 522 neighbours.insert( this->flipCone(interiorPoints[i],facetNormals[i]));527 neighbours.insert(flipCone(interiorPoints[i],facetNormals[i])); 523 528 } 524 529 return neighbours; … … 597 602 neighbours.insert(neighbour); 598 603 } 604 id_Delete(&initialIdeal,polynomialRing); 599 605 } 600 606 } … … 616 622 return new gfan::ZFan(gfan::ZFan::fullFan(currRing->N)); 617 623 } 624 625 626 #ifndef NDEBUG 627 628 BOOLEAN flipConeDebug(leftv res, leftv args) 629 { 630 leftv u = args; 631 if ((u!=NULL) && (u->Typ()==IDEAL_CMD)) 632 { 633 leftv v = u->next; 634 if ((v!=NULL) && (v->Typ()==NUMBER_CMD)) 635 { 636 leftv w = v->next; 637 if ((w!=NULL) && (w->Typ()==BIGINTMAT_CMD)) 638 { 639 leftv x = w->next; 640 if ((x!=NULL) && (x->Typ()==BIGINTMAT_CMD)) 641 { 642 omUpdateInfo(); 643 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes); 644 645 ideal I = (ideal) u->CopyD(); 646 number p = (number) v->CopyD(); 647 bigintmat* interiorPoint0 = (bigintmat*) w->CopyD(); 648 bigintmat* facetNormal0 = (bigintmat*) x->CopyD(); 649 tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing); 650 651 gfan::ZVector* interiorPoint = bigintmatToZVector(interiorPoint0); 652 gfan::ZVector* facetNormal = bigintmatToZVector(facetNormal0); 653 654 groebnerCone sigma(I,currRing,debug); 655 groebnerCone theta = sigma.flipCone(*interiorPoint,*facetNormal); 656 657 id_Delete(&I,currRing); 658 n_Delete(&p,currRing->cf); 659 delete interiorPoint0; 660 delete facetNormal0; 661 delete interiorPoint; 662 delete facetNormal; 663 664 res->rtyp = NONE; 665 res->data = NULL; 666 return FALSE; 667 } 668 } 669 } 670 } 671 WerrorS("computeFlipDebug: unexpected parameters"); 672 return TRUE; 673 } 674 675 BOOLEAN groebnerNeighboursDebug(leftv res, leftv args) 676 { 677 leftv u = args; 678 if ((u!=NULL) && (u->Typ()==IDEAL_CMD)) 679 { 680 leftv v = u->next; 681 if ((v!=NULL) && (v->Typ()==NUMBER_CMD)) 682 { 683 omUpdateInfo(); 684 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes); 685 686 ideal I = (ideal) u->CopyD(); 687 number p = (number) v->CopyD(); 688 689 tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing); 690 groebnerCone sigma(I,currRing,debug); 691 groebnerCones neighbours = sigma.groebnerNeighbours(); 692 693 id_Delete(&I,currRing); 694 n_Delete(&p,currRing->cf); 695 res->rtyp = NONE; 696 res->data = NULL; 697 return FALSE; 698 } 699 } 700 WerrorS("computeFlipDebug: unexpected parameters"); 701 return TRUE; 702 } 703 704 BOOLEAN tropicalNeighboursDebug(leftv res, leftv args) 705 { 706 leftv u = args; 707 if ((u!=NULL) && (u->Typ()==IDEAL_CMD)) 708 { 709 leftv v = u->next; 710 if ((v!=NULL) && (v->Typ()==NUMBER_CMD)) 711 { 712 omUpdateInfo(); 713 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes); 714 715 ideal I = (ideal) u->CopyD(); 716 number p = (number) v->CopyD(); 717 718 tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing); 719 groebnerCone sigma(I,currRing,debug); 720 groebnerCones neighbours = sigma.groebnerNeighbours(); 721 722 id_Delete(&I,currRing); 723 n_Delete(&p,currRing->cf); 724 res->rtyp = NONE; 725 res->data = NULL; 726 return FALSE; 727 } 728 } 729 WerrorS("computeFlipDebug: unexpected parameters"); 730 return TRUE; 731 } 732 #endif -
Singular/dyn_modules/gfanlib/groebnerCone.h
r4b47563 rbf83d3 121 121 gfan::ZFan* toFanStar(groebnerCones setOfCones); 122 122 123 #ifndef NDEBUG 124 BOOLEAN flipConeDebug(leftv res, leftv args); 125 BOOLEAN groebnerNeighboursDebug(leftv res, leftv args); 126 BOOLEAN tropicalNeighboursDebug(leftv res, leftv args); 123 127 #endif 128 129 #endif -
Singular/dyn_modules/gfanlib/tropical.cc
r4b47563 rbf83d3 174 174 { 175 175 leftv u = args; 176 if ((u != NULL) && (u->Typ() == POLY_CMD) && (u->next == NULL))176 if ((u != NULL) && (u->Typ() == POLY_CMD)) 177 177 { 178 178 leftv v = u->next; … … 194 194 weightVector = bigintmatToZVector(*w1); 195 195 } 196 res->rtyp = IDEAL_CMD;196 res->rtyp = POLY_CMD; 197 197 res->data = (void*) initial(p, currRing, *weightVector); 198 198 delete weightVector; … … 200 200 } 201 201 } 202 if ((u != NULL) && (u->Typ() == IDEAL_CMD) && (u->next == NULL))202 if ((u != NULL) && (u->Typ() == IDEAL_CMD)) 203 203 { 204 204 leftv v = u->next; … … 220 220 weightVector = bigintmatToZVector(*w1); 221 221 } 222 res->rtyp = POLY_CMD;222 res->rtyp = IDEAL_CMD; 223 223 res->data = (void*) initial(I, currRing, *weightVector); 224 224 delete weightVector; … … 260 260 // p->iiAddCproc("","tropicalCurve1",FALSE,tropicalCurve1); 261 261 p->iiAddCproc("","reduceInitiallyDebug",FALSE,reduceInitiallyDebug); 262 p->iiAddCproc("","getWitnessDebug",FALSE,getWitnessDebug); 263 p->iiAddCproc("","getFlipDebug",FALSE,getFlipDebug); 262 p->iiAddCproc("","computeWitnessDebug",FALSE,computeWitnessDebug); 263 p->iiAddCproc("","computeFlipDebug",FALSE,computeFlipDebug); 264 p->iiAddCproc("","flipConeDebug",FALSE,flipConeDebug); 265 p->iiAddCproc("","groebnerNeighboursDebug",FALSE,groebnerNeighboursDebug); 266 p->iiAddCproc("","tropicalNeighboursDebug",FALSE,tropicalNeighboursDebug); 267 p->iiAddCproc("","tropicalStarDebug",FALSE,tropicalStarDebug); 264 268 p->iiAddCproc("","tropicalStartingPoint",FALSE,tropicalStartingPoint); 265 269 p->iiAddCproc("","positiveTropicalStartingPoint",FALSE,positiveTropicalStartingPoint); -
Singular/dyn_modules/gfanlib/tropicalCurves.cc
r4b47563 rbf83d3 130 130 * and compute the common refinement with its tropical variety. 131 131 * If all initial ideals are monomial free, then we have our tropical curve */ 132 // gfan::ZFan* zf = toFanStar(C); 133 // std::cout << zf->toString(); 134 // delete zf; 132 135 for (std::set<gfan::ZCone>::iterator zc=C.begin(); zc!=C.end();) 133 136 { … … 141 144 inIs->m[j] = p_PermPoly(inI->m[j],NULL,r,s,identity,NULL,0); 142 145 143 inIs = gfanlib_kStd_wrapper(inIs,s,isHomog); 144 ideal ininIs = initial(inIs,s,w,W); 145 146 poly mons = checkForMonomialViaSuddenSaturation(ininIs,s); 146 ideal inIsSTD = gfanlib_kStd_wrapper(inIs,s,isHomog); 147 ideal ininIs = initial(inIsSTD,s,w,W); 148 149 poly mons = currentStrategy.checkInitialIdealForMonomial(ininIs,s,w); 150 // poly mons = checkForMonomialViaSuddenSaturation(ininIs,s); 147 151 if (mons) 148 152 { 149 poly gs = witness(mons,inIs ,ininIs,s);153 poly gs = witness(mons,inIsSTD,ininIs,s); 150 154 C = intersect(C,tropicalVariety(gs,s,currentStrategy),d); 151 155 nMapFunc mMap = n_SetMap(s->cf,r->cf); … … 156 160 p_Delete(&gs,s); 157 161 zc = C.begin(); 162 // gfan::ZFan* zf = toFanStar(C); 163 // std::cout << zf->toString(); 164 // delete zf; 165 id_Delete(&inIs,s); 166 id_Delete(&inIsSTD,s); 167 id_Delete(&ininIs,s); 168 rDelete(s); 158 169 } 159 170 else 160 zc++; 161 id_Delete(&inIs,s); 162 id_Delete(&ininIs,s); 163 rDelete(s); 171 { 172 gfan::ZVector wNeg = -w; 173 if (zc->contains(wNeg)) 174 { 175 s = genericlyWeightedOrdering(r,u,wNeg,W,currentStrategy); 176 identity = n_SetMap(r->cf,s->cf); 177 inIs = idInit(k); 178 for (int j=0; j<k; j++) 179 inIs->m[j] = p_PermPoly(inI->m[j],NULL,r,s,identity,NULL,0); 180 181 inIsSTD = gfanlib_kStd_wrapper(inIs,s,isHomog); 182 ininIs = initial(inIsSTD,s,wNeg,W); 183 184 mons = currentStrategy.checkInitialIdealForMonomial(ininIs,s,wNeg); 185 // mons = checkForMonomialViaSuddenSaturation(ininIs,s); 186 if (mons) 187 { 188 poly gs = witness(mons,inIsSTD,ininIs,s); 189 C = intersect(C,tropicalVariety(gs,s,currentStrategy),d); 190 nMapFunc mMap = n_SetMap(s->cf,r->cf); 191 poly gr = p_PermPoly(gs,NULL,s,r,mMap,NULL,0); 192 idInsertPoly(inI,gr); 193 k++; 194 p_Delete(&mons,s); 195 p_Delete(&gs,s); 196 zc = C.begin(); 197 // gfan::ZFan* zf = toFanStar(C); 198 // std::cout << zf->toString(); 199 // delete zf; 200 } 201 else 202 zc++; 203 id_Delete(&inIs,s); 204 id_Delete(&inIsSTD,s); 205 id_Delete(&ininIs,s); 206 rDelete(s); 207 } 208 else 209 zc++; 210 } 164 211 } 165 212 return C; … … 170 217 { 171 218 std::set<gfan::ZCone> C = tropicalStar(I,r,u,currentStrategy); 219 gfan::ZFan* zf = toFanStar(C); 220 std::cout << zf->toString(); 221 delete zf; 172 222 gfan::ZMatrix raysOfC(0,u.size()); 173 223 if (!currentStrategy.restrictToLowerHalfSpace()) … … 176 226 { 177 227 assume(zc->dimensionOfLinealitySpace()+1 == zc->dimension()); 178 raysOfC.appendRow(zc->semiGroupGeneratorOfRay()); 228 gfan::ZMatrix ray = zc->extremeRays(); 229 raysOfC.appendRow(ray[0]); 179 230 } 180 231 } … … 196 247 **/ 197 248 #ifndef NDEBUG 198 // BOOLEAN tropicalCurve0(leftv res, leftv args) 199 // { 200 // leftv u = args; 201 // ideal I = (ideal) u->CopyD(); 202 // leftv v = u->next; 203 // int d = (int)(long) v->CopyD(); 204 // tropicalStrategy currentCase = nonValuedCase; 205 // std::set<gfan::ZCone> C = tropicalCurve(I,currRing,d,currentCase); 206 // id_Delete(&I,currRing); 207 // omUpdateInfo(); 208 // Print("usedBytesBefore=%ld\n",om_Info.UsedBytes); 209 // res->rtyp = fanID; 210 // res->data = (char*) toFanStar(C); 211 // return FALSE; 212 // } 213 // BOOLEAN tropicalCurve1(leftv res, leftv args) 214 // { 215 // leftv u = args; 216 // ideal I = (ideal) u->CopyD(); 217 // leftv v = u->next; 218 // int d = (int)(long) v->CopyD(); 219 // tropicalStrategy currentCase = valuedCase; 220 // std::set<gfan::ZCone> C = tropicalCurve(I,currRing,d,currentCase); 221 // id_Delete(&I,currRing); 222 // omUpdateInfo(); 223 // Print("usedBytesBefore=%ld\n",om_Info.UsedBytes); 224 // res->rtyp = fanID; 225 // res->data = (char*) toFanStar(C); 226 // return FALSE; 227 // } 249 BOOLEAN tropicalStarDebug(leftv res, leftv args) 250 { 251 leftv u = args; 252 if ((u!=NULL) && (u->Typ()==IDEAL_CMD)) 253 { 254 leftv v = u->next; 255 if ((v!=NULL) && (v->Typ()==BIGINTMAT_CMD)) 256 { 257 omUpdateInfo(); 258 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes); 259 ideal inI = (ideal) u->CopyD(); 260 bigintmat* u = (bigintmat*) v->CopyD(); 261 tropicalStrategy currentCase(inI,currRing); 262 gfan::ZVector* v = bigintmatToZVector(u); 263 std::set<gfan::ZCone> C = tropicalStar(inI,currRing,*v,currentCase); 264 id_Delete(&inI,currRing); 265 delete u; 266 delete v; 267 res->rtyp = fanID; 268 res->data = (char*) toFanStar(C); 269 return FALSE; 270 } 271 } 272 WerrorS("tropicalStarDebug: unexpected parameters"); 273 return TRUE; 274 } 228 275 #endif -
Singular/dyn_modules/gfanlib/tropicalCurves.h
r4b47563 rbf83d3 13 13 14 14 #ifndef NDEBUG 15 BOOLEAN tropicalCurve0(leftv res, leftv args); 16 BOOLEAN tropicalCurve1(leftv res, leftv args); 15 BOOLEAN tropicalStarDebug(leftv res, leftv args); 17 16 #endif 18 17 -
Singular/dyn_modules/gfanlib/tropicalStrategy.cc
r4b47563 rbf83d3 5 5 #include <tropical.h> 6 6 #include <std_wrapper.h> 7 #include <tropicalCurves.h> 7 8 8 9 // for various commands in dim(ideal I, ring r): … … 41 42 } 42 43 43 static bool noExtraReduction(ideal /*I*/, ring /*r*/, number /*p*/) 44 { 44 static void swapElements(ideal I, ideal J) 45 { 46 assume(idSize(I)==idSize(J)); 47 48 for (int i=0; i<idSize(I); i++) 49 { 50 poly cache = I->m[i]; 51 I->m[i] = J->m[i]; 52 J->m[i] = cache; 53 } 54 55 return; 56 } 57 58 static bool noExtraReduction(ideal I, ring r, number /*p*/) 59 { 60 int n = rVar(r); 61 gfan::ZVector allOnes(n); 62 for (int i=0; i<n; i++) 63 allOnes[i] = 1; 64 ring rShortcut = rCopy0(r); 65 66 int* order = rShortcut->order; 67 int* block0 = rShortcut->block0; 68 int* block1 = rShortcut->block1; 69 int** wvhdl = rShortcut->wvhdl; 70 71 int h = rBlocks(r); 72 rShortcut->order = (int*) omAlloc0((h+1)*sizeof(int)); 73 rShortcut->block0 = (int*) omAlloc0((h+1)*sizeof(int)); 74 rShortcut->block1 = (int*) omAlloc0((h+1)*sizeof(int)); 75 rShortcut->wvhdl = (int**) omAlloc0((h+1)*sizeof(int*)); 76 rShortcut->order[0] = ringorder_a; 77 rShortcut->block0[0] = 1; 78 rShortcut->block1[0] = n; 79 bool overflow; 80 rShortcut->wvhdl[0] = ZVectorToIntStar(allOnes,overflow); 81 for (int i=1; i<=h; i++) 82 { 83 rShortcut->order[i] = order[i-1]; 84 rShortcut->block0[i] = block0[i-1]; 85 rShortcut->block1[i] = block1[i-1]; 86 rShortcut->wvhdl[i] = wvhdl[i-1]; 87 } 88 89 rComplete(rShortcut); 90 rTest(rShortcut); 91 92 omFree(order); 93 omFree(block0); 94 omFree(block1); 95 omFree(wvhdl); 96 97 int k = idSize(I); 98 ideal IShortcut = idInit(k); 99 nMapFunc intoShortcut = n_SetMap(r->cf,rShortcut->cf); 100 for (int i=0; i<k; i++) 101 IShortcut->m[i] = p_PermPoly(I->m[i],NULL,r,rShortcut,intoShortcut,NULL,0); 102 103 ideal JShortcut = gfanlib_kStd_wrapper(IShortcut,rShortcut); 104 105 ideal J = idInit(k); 106 nMapFunc outofShortcut = n_SetMap(rShortcut->cf,r->cf); 107 for (int i=0; i<k; i++) 108 J->m[i] = p_PermPoly(JShortcut->m[i],NULL,rShortcut,r,outofShortcut,NULL,0); 109 110 swapElements(I,J); 111 id_Delete(&IShortcut,rShortcut); 112 id_Delete(&JShortcut,rShortcut); 113 rDelete(rShortcut); 114 id_Delete(&J,r); 45 115 return false; 46 116 } … … 313 383 id_Test(I,r); 314 384 315 if (isValuationTrivial())316 return false;317 318 385 nMapFunc identity = n_SetMap(startingRing->cf,r->cf); 319 386 number p = identity(uniformizingParameter,startingRing->cf,r->cf); … … 413 480 { 414 481 monomial=p_One(r); 415 for (int i=1; i< n; i++)482 for (int i=1; i<=n; i++) 416 483 p_SetExp(monomial,i,p_GetExp(p,i,rShortcut),r); 417 484 p_Delete(&p,rShortcut); … … 433 500 } 434 501 435 ideal tropicalStrategy:: getWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const502 ideal tropicalStrategy::computeWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const 436 503 { 437 504 // if the valuation is trivial and the ring and ideal have not been extended, … … 555 622 inJr->m[i] = p_PermPoly(inJs->m[i],NULL,s,r,identitysr,NULL,0); 556 623 557 ideal Jr = getWitness(inJr,inIr,Ir,r);624 ideal Jr = computeWitness(inJr,inIr,Ir,r); 558 625 nMapFunc identityrs = n_SetMap(r->cf,s->cf); 559 626 ideal Js = idInit(k); … … 644 711 } 645 712 646 std::pair<ideal,ring> tropicalStrategy:: getFlip(const ideal Ir, const ring r,647 const gfan::ZVector interiorPoint,648 const gfan::ZVector facetNormal) const713 std::pair<ideal,ring> tropicalStrategy::computeFlip(const ideal Ir, const ring r, 714 const gfan::ZVector interiorPoint, 715 const gfan::ZVector facetNormal) const 649 716 { 650 717 assume(isValuationTrivial() || interiorPoint[0].sign()<0); … … 670 737 inJr->m[i] = p_PermPoly(inJsAdjusted->m[i],NULL,sAdjusted,r,identity,NULL,0); 671 738 672 ideal Jr = getWitness(inJr,inIr,Ir,r);739 ideal Jr = computeWitness(inJr,inIr,Ir,r); 673 740 ring s = copyAndChangeOrderingLS(r,interiorPoint,facetNormal); 674 741 identity = n_SetMap(r->cf,s->cf); … … 769 836 return false; 770 837 } 771 772 773 838 774 839 #ifndef NDEBUG … … 812 877 } 813 878 814 BOOLEAN getWitnessDebug(leftv res, leftv args)879 BOOLEAN computeWitnessDebug(leftv res, leftv args) 815 880 { 816 881 leftv u = args; … … 834 899 number p = (number) x->CopyD(); 835 900 tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing); 836 ideal J = debug. getWitness(inJ,inI,I,currRing);901 ideal J = debug.computeWitness(inJ,inI,I,currRing); 837 902 id_Delete(&inJ,currRing); 838 903 id_Delete(&inI,currRing); … … 849 914 } 850 915 851 BOOLEAN getFlipDebug(leftv res, leftv args)916 BOOLEAN computeFlipDebug(leftv res, leftv args) 852 917 { 853 918 leftv u = args; … … 874 939 gfan::ZVector* interiorPoint = bigintmatToZVector(interiorPoint0); 875 940 gfan::ZVector* facetNormal = bigintmatToZVector(facetNormal0); 876 std::pair<ideal,ring> Js = debug. getFlip(I,currRing,*interiorPoint,*facetNormal);941 std::pair<ideal,ring> Js = debug.computeFlip(I,currRing,*interiorPoint,*facetNormal); 877 942 ideal J = Js.first; 878 943 ring s = Js.second; … … 895 960 } 896 961 } 897 WerrorS(" getFlipDebug: unexpected parameters");962 WerrorS("computeFlipDebug: unexpected parameters"); 898 963 return TRUE; 899 964 } -
Singular/dyn_modules/gfanlib/tropicalStrategy.h
r4b47563 rbf83d3 136 136 #ifndef NDEBUG 137 137 tropicalStrategy(); 138 139 138 static tropicalStrategy debugStrategy(const ideal startIdeal, number unifParameter, ring startRing); 140 139 #endif … … 233 232 234 233 /** 235 * returns the dimension of the homogeneity space236 */237 int getDimensionOfHomogeneitySpace() const238 {239 return linealitySpace.dimension();240 }241 242 /**243 234 * returns true, if valuation non-trivial, false otherwise 244 235 */ … … 276 267 277 268 /** 278 * Returns a copy of the shortcutRing which is weighted with respect to w first and v second.279 * If valuation trivial, the coefficient ring will be the field with valuation.280 * If valuation non-trivial, the coefficient ring will be the residue field.281 */282 ring getShortcutRingDoublyWeighted(const gfan::ZVector w, const gfan::ZVector v) const;283 284 /**285 * copies r and prepends extra weight w286 */287 ring copyAndPrependWeight(const ring r, const gfan::ZVector w) const;288 289 /**290 * changes the coefficient ring of r to be the residue field291 */292 void changeCoefficientToResidueField(ring r) const;293 294 /**295 269 * reduces the generators of an ideal I so that 296 270 * the inequalities and equations of the Groebner cone can be read off. … … 301 275 302 276 /** 303 * returns true, if I contains a monomial. 304 * returns false otherwise. 277 * If given w, assuming w is in the Groebner cone of the ordering on r 278 * and I is a standard basis with respect to that ordering, 279 * checks whether the initial ideal of I with respect to w contains a monomial. 280 * If no w is given, assuming that I is already an initial form of some ideal, 281 * checks whether I contains a monomial. 282 * In both cases returns a monomial, if it contains one, returns NULL otherwise. 305 283 **/ 306 poly checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector w) const; 284 poly checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector w=0) const; 285 286 /** 287 * given generators of the initial ideal, computes its standard basis 288 */ 289 ideal computeStdOfInitialIdeal(const ideal inI, const ring r) const; 307 290 308 291 /** … … 315 298 * then the returned J will be a standard baiss of the ideal w.r.t. >' 316 299 */ 317 ideal getWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const;300 ideal computeWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const; 318 301 319 302 ideal computeLift(const ideal inJs, const ring s, const ideal inIr, const ideal Ir, const ring r) const; 320 321 /**322 * given generators of the initial ideal, computes its standard basis323 */324 ideal computeStdOfInitialIdeal(const ideal inI, const ring r) const;325 303 326 304 /** … … 328 306 * computes the groebner cone adjacent to it 329 307 */ 330 std::pair<ideal,ring> getFlip(const ideal Ir, const ring r, const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const;308 std::pair<ideal,ring> computeFlip(const ideal Ir, const ring r, const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const; 331 309 }; 332 310 333 int dim(ideal I, ring r);334 335 311 #ifndef NDEBUG 336 BOOLEAN getWitnessDebug(leftv res, leftv args);337 BOOLEAN getFlipDebug(leftv res, leftv args);312 BOOLEAN computeWitnessDebug(leftv res, leftv args); 313 BOOLEAN computeFlipDebug(leftv res, leftv args); 338 314 #endif 339 315 -
Singular/dyn_modules/gfanlib/tropicalVariety.cc
r4b47563 rbf83d3 78 78 number p = (number) v->Data(); 79 79 tropicalStrategy currentStrategy(I,p,currRing); 80 std::set<gfan::ZCone> maxCones = tropicalVariety(g,currRing,currentStrategy); 80 ideal startingIdeal = currentStrategy.getStartingIdeal(); 81 ideal startingRing = currentStrategy.getStartingRing(); 82 poly gStart = startingIdeal->m[0]; 83 std::set<gfan::ZCone> maxCones = tropicalVariety(gStart,startingRing,currentStrategy); 81 84 res->rtyp = fanID; 82 85 res->data = (char*) toZFan(maxCones);
Note: See TracChangeset
for help on using the changeset viewer.