Changeset 61335ab in git
- Timestamp:
- Sep 27, 2016, 3:07:11 PM (8 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- 1a7f12281eef1d444ca75b01a111122c604a85f4
- Parents:
- 4699031b427e5217a931823e41fd2d6624cc1d8b6aca64497b457e982197c5264a6b4e6147f9c757
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2016-09-27 15:07:11+02:00
- git-committer:
- GitHub <noreply@github.com>2016-09-27 15:07:11+02:00
- Files:
-
- 4 added
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/customstd/Makefile.am
r469903 r61335ab 1 1 ACLOCAL_AMFLAGS = -I ../../m4 2 2 3 SOURCES = customstd. cc3 SOURCES = customstd.h customstd.cc 4 4 5 5 MY_CPPFLAGS = -I${srcdir} -I${top_srcdir} -I${top_builddir} \ -
Singular/dyn_modules/customstd/customstd.cc
r469903 r61335ab 42 42 // routine that simplifies the new element by dividing it with the maximal possible 43 43 // partially saturating the ideal with respect to all variables doing so 44 staticBOOLEAN sat_vars_sp(kStrategy strat)44 BOOLEAN sat_vars_sp(kStrategy strat) 45 45 { 46 46 BOOLEAN b = FALSE; // set b to TRUE, if spoly was changed, … … 205 205 } 206 206 207 // static BOOLEAN abortIfMonomial_sp(kStrategy strat) 208 // { 209 // BOOLEAN b = FALSE; // set b to TRUE, if spoly was changed, 210 // // let it remain FALSE otherwise 211 // if (strat->P.t_p==NULL) 212 // { 213 // poly p=strat->P.p; 214 // if (pNext(p)==NULL) 215 // { 216 // // if a term is contained in the ideal, abort std computation 217 // // and store the output in idealCache to be returned 218 // while ((strat->Ll >= 0)) 219 // deleteInL(strat->L,&strat->Ll,strat->Ll,strat); 220 // std::cout << "aborting!" << std::endl; 221 // return FALSE; 222 // } 223 // } 224 // else 225 // { 226 // poly p=strat->P.t_p; 227 // if (pNext(p)==NULL) 228 // { 229 // // if a term is contained in the ideal, abort std computation 230 // // and store the output in idealCache to be returned 231 // while ((strat->Ll >= 0)) 232 // deleteInL(strat->L,&strat->Ll,strat->Ll,strat); 233 // std::cout << "aborting!" << std::endl; 234 // return FALSE; 235 // } 236 // } 237 // return b; // return TRUE if sp was changed, FALSE if not 238 // } 239 // static BOOLEAN abortifmonomialstd(leftv res, leftv args) 240 // { 241 // if (args!=NULL) 242 // { 243 // if ((args->Typ()==IDEAL_CMD) && (args->next==NULL)) 244 // { 245 // ideal I=(ideal)args->Data(); 246 // idealCache = NULL; 247 // I=kStd(I,currRing->qideal,testHomog,NULL,NULL,0,0,NULL,abortIfMonomial_sp); 248 // res->rtyp=IDEAL_CMD; 249 // if (idealCache) 250 // res->data=(char*)idealCache; 251 // else 252 // { 253 // idSkipZeroes(I); 254 // res->data=(char*)I; 255 // } 256 // return FALSE; 257 // } 258 // } 259 // WerrorS("abortifmonomialstd: unexpected parameters"); 260 // return TRUE; 261 // } 262 207 BOOLEAN abort_if_monomial_sp(kStrategy strat) 208 { 209 BOOLEAN b = FALSE; // set b to TRUE, if spoly was changed, 210 // let it remain FALSE otherwise 211 if (strat->P.t_p==NULL) 212 { 213 poly p=strat->P.p; 214 if (pNext(p)==NULL) 215 { 216 while ((strat->Ll >= 0)) 217 deleteInL(strat->L,&strat->Ll,strat->Ll,strat); 218 return FALSE; 219 } 220 } 221 else 222 { 223 poly p=strat->P.t_p; 224 if (pNext(p)==NULL) 225 { 226 while ((strat->Ll >= 0)) 227 deleteInL(strat->L,&strat->Ll,strat->Ll,strat); 228 return FALSE; 229 } 230 } 231 return b; // return TRUE if sp was changed, FALSE if not 232 } 233 234 BOOLEAN monomialabortstd(leftv res, leftv args) 235 { 236 if (args!=NULL) 237 { 238 if ((args->Typ()==IDEAL_CMD) && (args->next==NULL)) 239 { 240 ideal I=(ideal)args->Data(); 241 I=kStd(I,currRing->qideal,testHomog,NULL,NULL,0,0,NULL,abort_if_monomial_sp); 242 idSkipZeroes(I); 243 res->rtyp=IDEAL_CMD; 244 res->data=(char*)I; 245 return FALSE; 246 } 247 } 248 WerrorS("monomialabortstd: unexpected parameters"); 249 return TRUE; 250 } 263 251 264 252 // static long wDeg(const poly p, const ring r) … … 447 435 p->iiAddCproc("customstd.so","satstd",FALSE,satstd); 448 436 // p->iiAddCproc("std_demo","satstdWithInitialCheck",FALSE,satstdWithInitialCheck); 449 // p->iiAddCproc("std_demo","abortifmonomialstd",FALSE,abortifmonomialstd);437 p->iiAddCproc("std_demo","monomialabortstd",FALSE,monomialabortstd); 450 438 // PrintS("init of std_demo - type `listvar(Std_demo);` to its contents\n"); 451 439 return (MAX_TOK); -
Singular/dyn_modules/gfanlib/Makefile.am
r469903 r61335ab 1 1 ACLOCAL_AMFLAGS = -I ../../m4 2 2 3 SOURCES = singularWishlist. h gfanlib_exceptions.h callgfanlib_conversion.cc callgfanlib_conversion.h bbcone.cc bbcone.h bbfan.cc bbfan.h bbpolytope.cc bbpolytope.h gfan.h gitfan.cc gitfan.h std_wrapper.cc std_wrapper.htropicalVarietyOfPolynomials.h tropicalVarietyOfPolynomials.cc ppinitialReduction.cc ppinitialReduction.h containsMonomial.cc containsMonomial.h adjustWeights.cc adjustWeights.h tropicalStrategy.cc tropicalStrategy.h initial.cc initial.h witness.cc witness.h lift.cc lift.h flip.cc flip.h tropicalCurves.cc tropicalCurves.h groebnerCone.cc groebnerCone.h startingCone.cc startingCone.h tropicalTraversal.cc tropicalTraversal.h tropicalVarietyOfIdeals.cc tropicalVarietyOfIdeals.h tropicalVariety.cc tropicalVariety.h groebnerFan.cc groebnerFan.h groebnerComplex.cc groebnerComplex.h tropical.cc tropical.h gfanlib.cc3 SOURCES = singularWishlist.cc singularWishlist.h gfanlib_exceptions.h callgfanlib_conversion.cc callgfanlib_conversion.h bbcone.cc bbcone.h bbfan.cc bbfan.h bbpolytope.cc bbpolytope.h gfan.h gitfan.cc gitfan.h std_wrapper.cc std_wrapper.h tropicalDebug.h tropicalDebug.cc tropicalVarietyOfPolynomials.h tropicalVarietyOfPolynomials.cc ppinitialReduction.cc ppinitialReduction.h containsMonomial.cc containsMonomial.h adjustWeights.cc adjustWeights.h tropicalStrategy.cc tropicalStrategy.h initial.cc initial.h witness.cc witness.h lift.cc lift.h flip.cc flip.h tropicalCurves.cc tropicalCurves.h groebnerCone.cc groebnerCone.h startingCone.cc startingCone.h tropicalTraversal.cc tropicalTraversal.h tropicalVarietyOfIdeals.cc tropicalVarietyOfIdeals.h tropicalVariety.cc tropicalVariety.h groebnerFan.cc groebnerFan.h groebnerComplex.cc groebnerComplex.h tropical.cc tropical.h gfanlib.cc 4 4 5 5 MY_CPPFLAGS = -I${srcdir} -I${top_srcdir} -I${top_builddir} \ -
Singular/dyn_modules/gfanlib/adjustWeights.cc
r469903 r61335ab 1 #include <gfanlib/gfanlib_vector.h>2 1 #include <kernel/mod2.h> 3 2 3 #include <gfanlib/gfanlib_vector.h> 4 4 5 5 #ifndef NDEBUG 6 static bool checkForNonPositiveEntries(const gfan::ZVector &w) 7 { 8 for (unsigned i=0; i<w.size(); i++) 9 { 10 if (w[i].sign()<=0) 11 { 12 std::cout << "ERROR: non-positive weight in weight vector" << std::endl 13 << "weight: " << w << std::endl; 14 return false; 15 } 16 } 17 return true; 18 } 19 20 static bool checkForNonPositiveLaterEntries(const gfan::ZVector &w) 21 { 22 for (unsigned i=1; i<w.size(); i++) 23 { 24 if (w[i].sign()<=0) 25 { 26 std::cout << "ERROR: non-positive weight in weight vector later entries" << std::endl 27 << "weight: " << w << std::endl; 28 return false; 29 } 30 } 31 return true; 32 } 6 #include <tropicalDebug.h> 33 7 #endif //NDEBUG 34 8 -
Singular/dyn_modules/gfanlib/bbcone.cc
r469903 r61335ab 1646 1646 1647 1647 delete facet; 1648 delete point; 1649 if (v->Typ() == INTVEC_CMD) 1650 delete point1; 1651 return FALSE; 1652 } 1653 } 1654 WerrorS("facetContaining: unexpected parameters"); 1655 return TRUE; 1656 } 1657 1658 1659 BOOLEAN faceContaining(leftv res, leftv args) 1660 { 1661 gfan::initializeCddlibIfRequired(); 1662 leftv u = args; 1663 if ((u != NULL) && (u->Typ() == coneID)) 1664 { 1665 leftv v = u->next; 1666 if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD))) 1667 { 1668 gfan::ZCone* zc = (gfan::ZCone*) u->Data(); 1669 1670 bigintmat* point1; 1671 if (v->Typ() == INTVEC_CMD) 1672 { 1673 intvec* point0 = (intvec*) v->Data(); 1674 point1 = iv2bim(point0,coeffs_BIGINT)->transpose(); 1675 } 1676 else 1677 point1 = (bigintmat*) v->Data(); 1678 gfan::ZVector* point = bigintmatToZVector(*point1); 1679 1680 res->rtyp = coneID; 1681 res->data = (void*) new gfan::ZCone(zc->faceContaining(*point)); 1682 1648 1683 delete point; 1649 1684 if (v->Typ() == INTVEC_CMD) … … 1927 1962 p->iiAddCproc("","listOfFacets",FALSE,listOfFacets); 1928 1963 p->iiAddCproc("","facetContaining",FALSE,facetContaining); 1964 p->iiAddCproc("","faceContaining",FALSE,faceContaining); 1929 1965 coneID=setBlackboxStuff(b,"cone"); 1930 1966 } -
Singular/dyn_modules/gfanlib/containsMonomial.cc
r469903 r61335ab 1 #include <bbcone.h>2 1 #include <kernel/polys.h> 3 2 #include <kernel/GBEngine/kstd1.h> 4 3 #include <polys/prCopy.h> 4 5 #include <callgfanlib_conversion.h> 6 #include <bbcone.h> 7 #include <std_wrapper.h> 5 8 6 9 poly checkForMonomialViaSuddenSaturation(const ideal I, const ring r) … … 50 53 } 51 54 55 poly searchForMonomialViaStepwiseSaturation(const ideal I, const ring r, const gfan::ZVector w0) 56 { 57 gfan::ZVector w = w0; 58 59 ring origin = currRing; 60 if (currRing != r) 61 rChangeCurrRing(r); 62 63 // copy ring including qideal but without ordering 64 // set ordering to be wp(w) 65 int n = rVar(r); 66 ring rGraded = rCopy0(r,TRUE,FALSE); 67 rGraded->order = (int*) omAlloc0(3*sizeof(int)); 68 rGraded->block0 = (int*) omAlloc0(3*sizeof(int)); 69 rGraded->block1 = (int*) omAlloc0(3*sizeof(int)); 70 rGraded->wvhdl = (int**) omAlloc0(3*sizeof(int**)); 71 rGraded->order[0] = ringorder_wp; 72 rGraded->block0[0] = 1; 73 rGraded->block1[0] = n; 74 bool overflow; 75 rGraded->wvhdl[0] = ZVectorToIntStar(w,overflow); 76 rGraded->order[1] = ringorder_C; 77 rComplete(rGraded); 78 rTest(rGraded); 79 80 // map I into the new ring so that it becomes a graded ideal 81 int k = IDELEMS(I); 82 nMapFunc identity = n_SetMap(r->cf,rGraded->cf); 83 ideal Jold = idInit(k); 84 for (int i=0; i<k; i++) 85 Jold->m[i] = p_PermPoly(I->m[i],NULL,r,rGraded,identity,NULL,0); 86 87 // compute std and check whether result contains a monomial, 88 // wrap up computation if it does 89 ideal Jnew = gfanlib_monomialabortStd_wrapper(Jold,rGraded); 90 id_Delete(&Jold,rGraded); 91 k = IDELEMS(Jnew); 92 for (int i=0; i<k; i++) 93 { 94 poly g = Jnew->m[i]; 95 if (g!=NULL && pNext(g)==NULL && n_IsUnit(p_GetCoeff(g,r),r->cf)) 96 { 97 poly monomial = p_One(r); 98 for (int j=1; j<=rVar(r); j++) 99 p_SetExp(monomial,j,p_GetExp(g,j,rGraded),r); 100 p_Setm(monomial,r); 101 102 id_Delete(&Jnew,rGraded); 103 rDelete(rGraded); 104 if (currRing != origin) 105 rChangeCurrRing(origin); 106 return monomial; 107 } 108 } 109 110 // prepare permutation to cycle all variables 111 int* cycleAllVariables = (int*) omAlloc0((n+1)*sizeof(int)); 112 for (int i=1; i<n; i++) 113 cycleAllVariables[i]=i+1; 114 cycleAllVariables[n]=1; 115 // prepare storage of maximal powers that are being divided with 116 int* maxPowers = (int*) omAlloc0((n+1)*sizeof(int)); 117 118 for(int currentSaturationVariable=n-1; currentSaturationVariable>0; currentSaturationVariable--) 119 { 120 // divide out the maximal power in the last variable, 121 // storing the maximum of all powers. 122 for (int i=0; i<k; i++) 123 { 124 poly g = Jnew->m[i]; 125 int d = p_GetExp(g,n,rGraded); 126 if (d>0) 127 { 128 for (; g!=NULL; pIter(g)) 129 { 130 p_SubExp(g,n,d,rGraded); 131 p_Setm(g,rGraded); 132 } 133 if (d>maxPowers[currentSaturationVariable+1]) 134 maxPowers[currentSaturationVariable+1]=d; 135 } 136 } 137 138 // cycle all variables, i.e. x_1->x_2, x_2->x_3, ..., x_n->x_1 139 // so that a new variable is at the last position 140 gfan::Integer cache = w[n-1]; 141 for (int i=n-1; i>0; i--) 142 w[i] = w[i-1]; 143 w[0] = cache; 144 145 ring rGradedNew = rCopy0(r,TRUE,FALSE); 146 rGradedNew->order = (int*) omAlloc0(3*sizeof(int)); 147 rGradedNew->block0 = (int*) omAlloc0(3*sizeof(int)); 148 rGradedNew->block1 = (int*) omAlloc0(3*sizeof(int)); 149 rGradedNew->wvhdl = (int**) omAlloc0(3*sizeof(int**)); 150 rGradedNew->order[0] = ringorder_wp; 151 rGradedNew->block0[0] = 1; 152 rGradedNew->block1[0] = n; 153 bool overflow; 154 rGradedNew->wvhdl[0] = ZVectorToIntStar(w,overflow); 155 rGradedNew->order[1] = ringorder_C; 156 rComplete(rGradedNew); 157 rTest(rGradedNew); 158 159 identity = n_SetMap(rGraded->cf,rGradedNew->cf); 160 Jold = idInit(k); 161 for (int i=0; i<k; i++) 162 Jold->m[i] = p_PermPoly(Jnew->m[i],cycleAllVariables,rGraded,rGradedNew,identity,NULL,0); 163 id_Delete(&Jnew,rGraded); 164 rDelete(rGraded); 165 166 rGraded = rGradedNew; 167 rGradedNew = NULL; 168 169 // compute std and check whether result contains a monomial, 170 // wrap up computation if it does 171 // adjust for the powers already divided out of the ideal 172 // and the shift of variables! 173 Jnew = gfanlib_monomialabortStd_wrapper(Jold,rGraded); 174 id_Delete(&Jold,rGraded); 175 176 k = IDELEMS(Jnew); 177 for (int i=0; i<k; i++) 178 { 179 poly g = Jnew->m[i]; 180 if (g!=NULL && pNext(g)==NULL && n_IsUnit(p_GetCoeff(g,rGraded),rGraded->cf)) 181 { 182 poly monomial = p_One(r); 183 for (int j=1; j<=rVar(r); j++) 184 { 185 int jDeshifted = (j-currentSaturationVariable)%n; 186 if (jDeshifted<=0) jDeshifted = jDeshifted+n; 187 p_SetExp(monomial,j,p_GetExp(g,jDeshifted,rGraded)+maxPowers[j],r); 188 } 189 p_Setm(monomial,r); 190 191 id_Delete(&Jnew,rGraded); 192 rDelete(rGraded); 193 omFree(cycleAllVariables); 194 omFree(maxPowers); 195 if (currRing != origin) 196 rChangeCurrRing(origin); 197 return monomial; 198 } 199 } 200 } 201 202 if (currRing != origin) 203 rChangeCurrRing(origin); 204 205 id_Delete(&Jnew,rGraded); 206 rDelete(rGraded); 207 omFree(cycleAllVariables); 208 omFree(maxPowers); 209 return NULL; 210 } 52 211 53 212 BOOLEAN checkForMonomial(leftv res, leftv args) … … 73 232 } 74 233 75 #if 0 76 // /*** 77 // * Creates an int* representing the transposition of the last two variables 78 // **/ 79 // static inline int* createPermutationVectorForSaturation(static const ring &r) 80 // { 81 // int* w = (int*) omAlloc0((rVar(r)+1)*sizeof(int)); 82 // for (int i=1; i<=rVar(r)-2; i++) 83 // w[i] = i; 84 // w[rVar(r)-1] = rVar(r); 85 // w[rVar(r)] = rVar(r)-1; 86 // } 87 88 89 /*** 90 * Creates an int* representing the permutation 91 * 1 -> 1, ..., i-1 -> i-1, i -> n, i+1 -> n-1, ... , n -> i 92 **/ 93 static inline int* createPermutationVectorForSaturation(const ring &r, const int i) 94 { 95 int* sigma = (int*) omAlloc0((rVar(r)+1)*sizeof(int)); 96 int j; 97 for (j=1; j<i; j++) 98 sigma[j] = j; 99 for (; j<=rVar(r); j++) 100 sigma[j] = rVar(r)-j+i; 101 return(sigma); 102 } 103 104 105 /*** 106 * Changes the int* representing the permutation 107 * 1 -> 1, ..., i -> i, i+1 -> n, i+2 -> n-1, ... , n -> i+1 108 * to an int* representing the permutation 109 * 1 -> 1, ..., i-1 -> i-1, i -> n, i+1 -> n-1, ... , n -> i 110 **/ 111 static void changePermutationVectorForSaturation(int* sigma, const ring &r, const int i) 112 { 113 for (int j=i; j<rVar(r); j++) 114 sigma[j] = rVar(r)-j+i; 115 sigma[rVar(r)] = i; 116 } 117 118 119 /*** 120 * returns a ring in which the weights of the ring variables are permuted 121 * if handed over a poly in which the variables are permuted, this is basically 122 * as good as permuting the variables of the ring itself. 123 **/ 124 static ring permuteWeighstOfRingVariables(const ring &r, const int* const sigma) 125 { 126 ring s = rCopy0(r); 127 for (int j=0; j<rVar(r); j++) 128 { 129 s->wvhdl[0][j] = r->wvhdl[0][sigma[j+1]]; 130 s->wvhdl[1][j] = r->wvhdl[1][sigma[j+1]]; 131 } 132 rComplete(s,1); 133 rTest(s); 134 return s; 135 } 136 137 138 /*** 139 * creates a ring s that is a copy of r except with ordering wp(w) 140 **/ 141 static inline ring createInitialRingForSaturation(const ring &r, const gfan::ZVector &w, bool &ok) 142 { 143 assume(rVar(r) == (int) w.size()); 144 145 ring s = rCopy0(r); int i; 146 for (i=0; s->order[i]; i++) 147 omFreeSize(s->wvhdl[i],rVar(r)*sizeof(int)); 148 i++; 149 omFreeSize(s->order,i*sizeof(int)); 150 s->order = (int*) omAlloc0(3*sizeof(int)); 151 omFreeSize(s->block0,i*sizeof(int)); 152 s->block0 = (int*) omAlloc0(3*sizeof(int)); 153 omFreeSize(s->block1,i*sizeof(int)); 154 s->block1 = (int*) omAlloc0(3*sizeof(int)); 155 omFreeSize(s->wvhdl,i*sizeof(int*)); 156 s->wvhdl = (int**) omAlloc0(3*sizeof(int*)); 157 158 s->order[0] = ringorder_wp; 159 s->block0[0] = 1; 160 s->block1[0] = rVar(r); 161 s->wvhdl[0] = ZVectorToIntStar(w,ok); 162 s->order[1]=ringorder_C; 163 164 rComplete(s,1); 165 rTest(s); 166 return s; 167 } 168 169 170 /*** 171 * Given an weighted homogeneous ideal I with respect to weight w 172 * that in standard basis form with respect to the ordering ws(-w), 173 * derives the standard basis of I:<x_n>^\infty 174 * and returns a long k such that I:<x_n>^\infty=I:<x_n>^k 175 **/ 176 static long deriveStandardBasisOfSaturation(ideal &I, ring &r) 177 { 178 long k=0, l; poly current; 179 for (int i=0; i<IDELEMS(I); i++) 180 { 181 current = I->m[i]; 182 l = p_GetExp(current,rVar(r),r); 183 if (k<l) k=l; 184 while (current) 185 { 186 p_SubExp(current,rVar(r),l,r); p_Setm(current,r); 187 pIter(current); 188 } 189 } 190 return k; 191 } 192 193 194 /*** 195 * Given a weighted homogeneous ideal I with respect to weight w 196 * with constant first element, 197 * returns NULL if I does not contain a monomial 198 * otherwise returns the monomial contained in I 199 **/ 200 poly checkForMonomialsViaStepwiseSaturation(const ideal &I, const gfan::ZVector &w) 201 { 202 // assume(rField_is_Ring_Z(currRing)); 203 204 // first we switch to the ground field currRing->cf / I->m[0] 205 ring r = rCopy0(currRing); 206 nKillChar(r->cf); 207 r->cf = nInitChar(n_Zp,(void*)(long)n_Int(p_GetCoeff(I->m[0],currRing),currRing->cf)); 208 rComplete(r); 209 rTest(r); 210 211 ideal J = id_Copy(I, currRing); poly cache; number temp; 212 for (int i=0; i<IDELEMS(I); i++) 213 { 214 cache = J->m[i]; 215 while (cache) 216 { 217 // TODO: temp = npMapGMP(p_GetCoeff(cache,currRing),currRing->cf,r->cf); 218 p_SetCoeff(cache,temp,r); pIter(cache); 219 } 220 } 221 222 J = kStd(J,NULL,isHomog,NULL); 223 224 bool b = false; 225 ring s = createInitialRingForSaturation(currRing, w, b); 226 if (b) 227 { 228 WerrorS("containsMonomial: overflow in weight vector"); 229 return NULL; 230 } 231 232 return NULL; 233 } 234 #endif //0 234 BOOLEAN searchForMonomialViaStepwiseSaturation(leftv res, leftv args) 235 { 236 leftv u = args; 237 if ((u != NULL) && (u->Typ() == IDEAL_CMD)) 238 { 239 leftv v = u->next; 240 if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD))) 241 { 242 ideal I = (ideal) u->Data(); 243 bigintmat* w0=NULL; 244 if (v->Typ() == INTVEC_CMD) 245 { 246 intvec* w00 = (intvec*) v->Data(); 247 bigintmat* w0t = iv2bim(w00,coeffs_BIGINT); 248 w0 = w0t->transpose(); 249 delete w0t; 250 } 251 else 252 w0 = (bigintmat*) v->Data(); 253 gfan::ZVector* w = bigintmatToZVector(w0); 254 255 res->rtyp = POLY_CMD; 256 res->data = (char*) searchForMonomialViaStepwiseSaturation(I,currRing,*w); 257 delete w; 258 if (v->Typ() == INTVEC_CMD) 259 delete w0; 260 261 return FALSE; 262 } 263 } 264 WerrorS("searchForMonomialViaStepwiseSaturation: unexpected parameters"); 265 return TRUE; 266 } -
Singular/dyn_modules/gfanlib/containsMonomial.h
r469903 r61335ab 7 7 8 8 poly checkForMonomialViaSuddenSaturation(const ideal I, const ring r); 9 poly searchForMonomialViaStepwiseSaturation(const ideal I, const ring r, const gfan::ZVector w); 9 10 BOOLEAN checkForMonomial(leftv res, leftv args); 11 BOOLEAN searchForMonomialViaStepwiseSaturation(leftv res, leftv args); 10 12 11 13 #endif -
Singular/dyn_modules/gfanlib/flip.cc
r469903 r61335ab 3 3 #include <gfanlib/gfanlib_vector.h> 4 4 #include <callgfanlib_conversion.h> 5 #include <singularWishlist.h> 5 6 #include <initial.h> 6 7 #include <lift.h> 7 #include <tropicalStrategy.h>8 9 10 static void deleteOrdering(ring r)11 {12 if (r->order != NULL)13 {14 int i=rBlocks(r);15 assume(r->block0 != NULL && r->block1 != NULL && r->wvhdl != NULL);16 /* delete order */17 omFreeSize((ADDRESS)r->order,i*sizeof(int));18 omFreeSize((ADDRESS)r->block0,i*sizeof(int));19 omFreeSize((ADDRESS)r->block1,i*sizeof(int));20 /* delete weights */21 for (int j=0; j<i; j++)22 if (r->wvhdl[j]!=NULL)23 omFree(r->wvhdl[j]);24 omFreeSize((ADDRESS)r->wvhdl,i*sizeof(int *));25 }26 else27 assume(r->block0 == NULL && r->block1 == NULL && r->wvhdl == NULL);28 return;29 }30 8 31 9 /*** … … 49 27 int n = rVar(sAdjusted); 50 28 deleteOrdering(sAdjusted); 51 sAdjusted->order = (int*) omAlloc0( 4*sizeof(int));52 sAdjusted->block0 = (int*) omAlloc0( 4*sizeof(int));53 sAdjusted->block1 = (int*) omAlloc0( 4*sizeof(int));54 sAdjusted->wvhdl = (int**) omAlloc0( 4*sizeof(int**));29 sAdjusted->order = (int*) omAlloc0(5*sizeof(int)); 30 sAdjusted->block0 = (int*) omAlloc0(5*sizeof(int)); 31 sAdjusted->block1 = (int*) omAlloc0(5*sizeof(int)); 32 sAdjusted->wvhdl = (int**) omAlloc0(5*sizeof(int**)); 55 33 sAdjusted->order[0] = ringorder_a; 56 34 sAdjusted->block0[0] = 1; 57 35 sAdjusted->block1[0] = n; 58 36 sAdjusted->wvhdl[0] = ZVectorToIntStar(adjustedInteriorPoint,ok); 59 sAdjusted->order[1] = ringorder_ wp;37 sAdjusted->order[1] = ringorder_a; 60 38 sAdjusted->block0[1] = 1; 61 39 sAdjusted->block1[1] = n; 62 40 sAdjusted->wvhdl[1] = ZVectorToIntStar(adjustedFacetNormal,ok); 63 sAdjusted->order[2] = ringorder_C; 41 sAdjusted->order[2] = ringorder_lp; 42 sAdjusted->block0[2] = 1; 43 sAdjusted->block1[2] = n; 44 sAdjusted->wvhdl[2] = ZVectorToIntStar(adjustedFacetNormal,ok); 45 sAdjusted->order[3] = ringorder_C; 64 46 rComplete(sAdjusted); 65 47 rTest(sAdjusted); … … 102 84 s->block1[1] = n; 103 85 s->wvhdl[1] = ZVectorToIntStar(facetNormal,ok); 104 s->order[2] = ringorder_ dp;86 s->order[2] = ringorder_lp; 105 87 s->block0[2] = 1; 106 88 s->block1[2] = n; -
Singular/dyn_modules/gfanlib/groebnerCone.cc
r469903 r61335ab 21 21 #include <tropicalCurves.h> 22 22 #include <bbcone.h> 23 #include <tropicalDebug.h> 23 24 24 25 #ifndef NDEBUG 25 static bool checkPolynomialInput(const ideal I, const ring r)26 {27 if (r) rTest(r);28 if (I && r) id_Test(I,r);29 return ((!I) || (I && r));30 }31 32 static bool checkOrderingAndCone(const ring r, const gfan::ZCone zc)33 {34 return true;35 if (r)36 {37 int n = rVar(r); int* w = r->wvhdl[0];38 gfan::ZVector v = wvhdlEntryToZVector(n,w);39 if (r->order[0]==ringorder_ws)40 v = gfan::Integer((long)-1)*v;41 if (!zc.contains(v))42 {43 std::cout << "ERROR: weight of ordering not inside Groebner cone!" << std::endl44 << "cone: " << std::endl45 << toString(&zc)46 << "weight: " << std::endl47 << v << std::endl;48 return false;49 }50 return true;51 }52 return (zc.dimension()==0);53 }54 55 static bool checkPolyhedralInput(const gfan::ZCone zc, const gfan::ZVector p)56 {57 return zc.containsRelatively(p);58 }59 60 #if 0 /*unused*/61 static bool checkOrderingAndWeight(const ideal I, const ring r, const gfan::ZVector w, const tropicalStrategy& currentCase)62 {63 groebnerCone sigma(I,r,currentCase);64 gfan::ZCone zc = sigma.getPolyhedralCone();65 return zc.contains(w);66 }67 #endif68 69 26 bool groebnerCone::checkFlipConeInput(const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const 70 27 { … … 238 195 currentStrategy(¤tCase) 239 196 { 197 assume(checkWeightVector(I,r,u)); 240 198 assume(checkPolynomialInput(I,r)); 241 199 if (r) polynomialRing = rCopy(r); … … 429 387 { 430 388 assume(this->checkFlipConeInput(interiorPoint,facetNormal)); 389 assume(checkWeightVector(polynomialIdeal,polynomialRing,interiorPoint)); 431 390 /* Note: the polynomial ring created will have a weighted ordering with respect to interiorPoint 432 391 * and with a weighted ordering with respect to facetNormal as tiebreaker. … … 464 423 continue; 465 424 } 466 neighbours.insert(flipCone( interiorPoints[i],facetNormals[i]));425 neighbours.insert(flipCone(w,v)); 467 426 } 468 427 return neighbours; … … 520 479 return new gfan::ZFan(gfan::ZFan(currRing->N)); 521 480 } 522 523 524 #ifndef NDEBUG525 526 BOOLEAN flipConeDebug(leftv res, leftv args)527 {528 leftv u = args;529 if ((u!=NULL) && (u->Typ()==IDEAL_CMD))530 {531 leftv v = u->next;532 if ((v!=NULL) && (v->Typ()==NUMBER_CMD))533 {534 leftv w = v->next;535 if ((w!=NULL) && (w->Typ()==BIGINTMAT_CMD))536 {537 leftv x = w->next;538 if ((x!=NULL) && (x->Typ()==BIGINTMAT_CMD))539 {540 omUpdateInfo();541 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);542 543 ideal I = (ideal) u->CopyD();544 number p = (number) v->CopyD();545 bigintmat* interiorPoint0 = (bigintmat*) w->CopyD();546 bigintmat* facetNormal0 = (bigintmat*) x->CopyD();547 tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing);548 549 gfan::ZVector* interiorPoint = bigintmatToZVector(interiorPoint0);550 gfan::ZVector* facetNormal = bigintmatToZVector(facetNormal0);551 552 groebnerCone sigma(I,currRing,debug);553 groebnerCone theta = sigma.flipCone(*interiorPoint,*facetNormal);554 555 id_Delete(&I,currRing);556 n_Delete(&p,currRing->cf);557 delete interiorPoint0;558 delete facetNormal0;559 delete interiorPoint;560 delete facetNormal;561 562 res->rtyp = NONE;563 res->data = NULL;564 return FALSE;565 }566 }567 }568 }569 WerrorS("computeFlipDebug: unexpected parameters");570 return TRUE;571 }572 573 BOOLEAN groebnerNeighboursDebug(leftv res, leftv args)574 {575 leftv u = args;576 if ((u!=NULL) && (u->Typ()==IDEAL_CMD))577 {578 leftv v = u->next;579 if ((v!=NULL) && (v->Typ()==NUMBER_CMD))580 {581 omUpdateInfo();582 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);583 584 ideal I = (ideal) u->CopyD();585 number p = (number) v->CopyD();586 587 tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing);588 groebnerCone sigma(I,currRing,debug);589 groebnerCones neighbours = sigma.groebnerNeighbours();590 591 id_Delete(&I,currRing);592 n_Delete(&p,currRing->cf);593 res->rtyp = NONE;594 res->data = NULL;595 return FALSE;596 }597 }598 WerrorS("computeFlipDebug: unexpected parameters");599 return TRUE;600 }601 602 BOOLEAN tropicalNeighboursDebug(leftv res, leftv args)603 {604 leftv u = args;605 if ((u!=NULL) && (u->Typ()==IDEAL_CMD))606 {607 leftv v = u->next;608 if ((v!=NULL) && (v->Typ()==NUMBER_CMD))609 {610 omUpdateInfo();611 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);612 613 ideal I = (ideal) u->CopyD();614 number p = (number) v->CopyD();615 616 tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing);617 groebnerCone sigma(I,currRing,debug);618 groebnerCones neighbours = sigma.groebnerNeighbours();619 620 id_Delete(&I,currRing);621 n_Delete(&p,currRing->cf);622 res->rtyp = NONE;623 res->data = NULL;624 return FALSE;625 }626 }627 WerrorS("computeFlipDebug: unexpected parameters");628 return TRUE;629 }630 #endif -
Singular/dyn_modules/gfanlib/groebnerCone.h
r469903 r61335ab 123 123 gfan::ZFan* toFanStar(groebnerCones setOfCones); 124 124 125 #ifndef NDEBUG126 BOOLEAN flipConeDebug(leftv res, leftv args);127 BOOLEAN groebnerNeighboursDebug(leftv res, leftv args);128 BOOLEAN tropicalNeighboursDebug(leftv res, leftv args);129 125 #endif 130 131 #endif -
Singular/dyn_modules/gfanlib/initial.cc
r469903 r61335ab 6 6 #include <exception> 7 7 8 long wDeg(const poly p, const ring r, const gfan::ZVector w)8 long wDeg(const poly p, const ring r, const gfan::ZVector &w) 9 9 { 10 10 long d=0; … … 21 21 } 22 22 23 gfan::ZVector WDeg(const poly p, const ring r, const gfan::ZVector w, const gfan::ZMatrixW)23 gfan::ZVector WDeg(const poly p, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W) 24 24 { 25 25 gfan::ZVector d = gfan::ZVector(W.getHeight()+1); … … 30 30 } 31 31 32 poly initial(const poly p, const ring r, const gfan::ZVector w)32 poly initial(const poly p, const ring r, const gfan::ZVector &w) 33 33 { 34 34 if (p==NULL) … … 58 58 } 59 59 60 ideal initial(const ideal I, const ring r, const gfan::ZVector w)60 ideal initial(const ideal I, const ring r, const gfan::ZVector &w) 61 61 { 62 62 int k = IDELEMS(I); ideal inI = idInit(k); … … 66 66 } 67 67 68 poly initial(const poly p, const ring r, const gfan::ZVector w, const gfan::ZMatrixW)68 poly initial(const poly p, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W) 69 69 { 70 70 if (p==NULL) … … 94 94 } 95 95 96 ideal initial(const ideal I, const ring r, const gfan::ZVector w, const gfan::ZMatrixW)96 ideal initial(const ideal I, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W) 97 97 { 98 98 int k = IDELEMS(I); ideal inI = idInit(k); … … 102 102 } 103 103 104 void initial(poly* pStar, const ring r, const gfan::ZVector w)104 void initial(poly* pStar, const ring r, const gfan::ZVector &w) 105 105 { 106 106 poly p = *pStar; … … 141 141 } 142 142 143 void initial(ideal* IStar, const ring r, const gfan::ZVector w)143 void initial(ideal* IStar, const ring r, const gfan::ZVector &w) 144 144 { 145 145 ideal I = *IStar; … … 150 150 } 151 151 152 void initial(poly* pStar, const ring r, const gfan::ZVector w, const gfan::ZMatrixW)152 void initial(poly* pStar, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W) 153 153 { 154 154 poly p = *pStar; … … 189 189 } 190 190 191 void initial(ideal* IStar, const ring r, const gfan::ZVector w, const gfan::ZMatrixW)191 void initial(ideal* IStar, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W) 192 192 { 193 193 ideal I = *IStar; -
Singular/dyn_modules/gfanlib/initial.h
r469903 r61335ab 12 12 * Returns the weighted degree of the leading term of p with respect to w 13 13 */ 14 long wDeg(const poly p, const ring r, const gfan::ZVector w);14 long wDeg(const poly p, const ring r, const gfan::ZVector &w); 15 15 16 16 /** … … 20 20 * and the i+1st entry is the weighted degree with respect to the i-th row vector of W. 21 21 */ 22 gfan::ZVector WDeg(const poly p, const ring r, const gfan::ZVector w, const gfan::ZMatrixW);22 gfan::ZVector WDeg(const poly p, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W); 23 23 24 24 /** 25 25 * Returns the initial form of p with respect to w 26 26 */ 27 poly initial(const poly p, const ring r, const gfan::ZVector w);27 poly initial(const poly p, const ring r, const gfan::ZVector &w); 28 28 29 29 /** 30 30 * Returns the initial form of I with respect to w 31 31 */ 32 ideal initial(const ideal I, const ring r, const gfan::ZVector w);32 ideal initial(const ideal I, const ring r, const gfan::ZVector &w); 33 33 34 34 /** 35 35 * Returns the initial form of p with respect to w and W 36 36 */ 37 poly initial(const poly p, const ring r, const gfan::ZVector w, const gfan::ZMatrixW);37 poly initial(const poly p, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W); 38 38 39 39 /** 40 40 * Returns the initial form of I with respect to w and W 41 41 */ 42 ideal initial(const ideal I, const ring r, const gfan::ZVector w, const gfan::ZMatrixW);42 ideal initial(const ideal I, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W); 43 43 44 44 /** 45 45 * Stores the initial form of *pStar with respect to w in pStar 46 46 */ 47 void initial(poly* pStar, const ring r, const gfan::ZVector w);47 void initial(poly* pStar, const ring r, const gfan::ZVector &w); 48 48 49 49 /** 50 50 * Stores the initial form of *IStar with respect to w in IStar 51 51 */ 52 void initial(ideal* IStar, const ring r, const gfan::ZVector w);52 void initial(ideal* IStar, const ring r, const gfan::ZVector &w); 53 53 54 54 /** 55 55 * Stores the initial form of *pStar with respect to w and W in pStar 56 56 */ 57 void initial(poly* pStar, const ring r, const gfan::ZVector w, const gfan::ZMatrixW);57 void initial(poly* pStar, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W); 58 58 59 59 /** 60 60 * Stores the initial form of *IStar with respect to w and W in IStar 61 61 */ 62 void initial(ideal* IStar, const ring r, const gfan::ZVector w, const gfan::ZMatrixW);62 void initial(ideal* IStar, const ring r, const gfan::ZVector &w, const gfan::ZMatrix &W); 63 63 64 64 #endif -
Singular/dyn_modules/gfanlib/lift.cc
r469903 r61335ab 1 #include <polys/monomials/p_polys.h> 2 1 3 #include <witness.h> 2 4 -
Singular/dyn_modules/gfanlib/ppinitialReduction.cc
r469903 r61335ab 274 274 #endif //NDEBUG 275 275 276 #ifndef NDEBUG277 BOOLEAN pReduceDebug(leftv res, leftv args)278 {279 leftv u = args;280 if ((u != NULL) && (u->Typ() == POLY_CMD))281 {282 poly g; number p = n_Init(3,currRing->cf);283 omUpdateInfo();284 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);285 g = (poly) u->CopyD();286 (void) pReduce(g,p,currRing);287 p_Delete(&g,currRing);288 omUpdateInfo();289 Print("usedBytesAfter=%ld\n",om_Info.UsedBytes);290 g = (poly) u->CopyD();291 (void) pReduce(g,p,currRing);292 n_Delete(&p,currRing->cf);293 res->rtyp = POLY_CMD;294 res->data = (char*) g;295 return FALSE;296 }297 return TRUE;298 }299 #endif //NDEBUG300 301 276 void pReduce(ideal &I, const number p, const ring r) 302 277 { … … 307 282 { 308 283 number c = p_GetCoeff(I->m[i],r); 309 if (!n_ Equal(p,c,r->cf))284 if (!n_DivBy(p,c,r->cf)) 310 285 pReduce(I->m[i],p,r); 311 286 } … … 354 329 355 330 356 #ifndef NDEBUG357 BOOLEAN ppreduceInitially0(leftv res, leftv args)358 {359 leftv u = args;360 if ((u != NULL) && (u->Typ() == POLY_CMD))361 {362 leftv v = u->next;363 if ((v != NULL) && (v->Typ() == POLY_CMD))364 {365 poly g,h;366 omUpdateInfo();367 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);368 h = (poly) u->CopyD();369 g = (poly) v->CopyD();370 (void)ppreduceInitially(&h,g,currRing);371 p_Delete(&h,currRing);372 p_Delete(&g,currRing);373 omUpdateInfo();374 Print("usedBytesAfter=%ld\n",om_Info.UsedBytes);375 h = (poly) u->CopyD();376 g = (poly) v->CopyD();377 (void)ppreduceInitially(&h,g,currRing);378 p_Delete(&g,currRing);379 res->rtyp = POLY_CMD;380 res->data = (char*) h;381 return FALSE;382 }383 }384 return TRUE;385 }386 #endif //NDEBUG387 388 389 331 /*** 390 332 * reduces I initially with respect to itself and with respect to p-t. … … 436 378 return false; 437 379 } 438 439 440 #ifndef NDEBUG441 BOOLEAN ppreduceInitially1(leftv res, leftv args)442 {443 leftv u = args;444 if ((u != NULL) && (u->Typ() == IDEAL_CMD))445 {446 leftv v = u->next;447 if ((v != NULL) && (v->Typ() == NUMBER_CMD))448 {449 ideal I; number p;450 omUpdateInfo();451 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);452 I = (ideal) u->CopyD();453 p = (number) v->CopyD();454 (void) ppreduceInitially(I,p,currRing);455 id_Delete(&I,currRing);456 n_Delete(&p,currRing->cf);457 omUpdateInfo();458 Print("usedBytesAfter=%ld\n",om_Info.UsedBytes);459 I = (ideal) u->CopyD();460 p = (number) v->CopyD();461 (void) ppreduceInitially(I,p,currRing);462 n_Delete(&p,currRing->cf);463 res->rtyp = IDEAL_CMD;464 res->data = (char*) I;465 return FALSE;466 }467 }468 return TRUE;469 }470 #endif //NDEBUG471 380 472 381 … … 534 443 535 444 536 #ifndef NDEBUG537 BOOLEAN ppreduceInitially2(leftv res, leftv args)538 {539 leftv u = args;540 if ((u != NULL) && (u->Typ() == IDEAL_CMD))541 {542 leftv v = u->next;543 if ((v != NULL) && (v->Typ() == NUMBER_CMD))544 {545 leftv w = v->next;546 if ((w != NULL) && (w->Typ() == POLY_CMD))547 {548 ideal I; number p; poly g;549 omUpdateInfo();550 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);551 I = (ideal) u->CopyD();552 p = (number) v->CopyD();553 g = (poly) w->CopyD();554 (void) ppreduceInitially(I,p,g,currRing);555 id_Delete(&I,currRing);556 n_Delete(&p,currRing->cf);557 omUpdateInfo();558 Print("usedBytesAfter=%ld\n",om_Info.UsedBytes);559 I = (ideal) u->CopyD();560 p = (number) v->CopyD();561 g = (poly) w->CopyD();562 (void) ppreduceInitially(I,p,g,currRing);563 n_Delete(&p,currRing->cf);564 res->rtyp = IDEAL_CMD;565 res->data = (char*) I;566 return FALSE;567 }568 }569 }570 return TRUE;571 }572 #endif //NDEBUG573 574 575 445 static poly ppNext(poly p, int l) 576 446 { … … 736 606 737 607 738 #ifndef NDEBUG739 BOOLEAN ppreduceInitially3(leftv res, leftv args)740 {741 leftv u = args;742 if ((u != NULL) && (u->Typ() == IDEAL_CMD))743 {744 leftv v = u->next;745 if ((v != NULL) && (v->Typ() == NUMBER_CMD))746 {747 leftv w = v->next;748 if ((w != NULL) && (w->Typ() == IDEAL_CMD))749 {750 ideal H,G; number p;751 omUpdateInfo();752 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);753 H = (ideal) u->CopyD();754 p = (number) v->CopyD();755 G = (ideal) w->CopyD();756 (void) ppreduceInitially(H,p,G,currRing);757 n_Delete(&p,currRing->cf);758 id_Delete(&G,currRing);759 res->rtyp = IDEAL_CMD;760 res->data = (char*) H;761 return FALSE;762 }763 }764 }765 return TRUE;766 }767 #endif //NDEBUG768 769 608 /** 770 609 * reduces I initially with respect to itself. … … 871 710 return false; 872 711 } 873 874 875 #ifndef NDEBUG876 BOOLEAN reduceInitiallyDebug(leftv res, leftv args)877 {878 leftv u = args;879 if ((u != NULL) && (u->Typ() == IDEAL_CMD))880 {881 leftv v = u->next;882 if ((v != NULL) && (v->Typ() == NUMBER_CMD))883 {884 omUpdateInfo();885 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);886 ideal I = (ideal) u->CopyD();887 number p = (number) v->Data();888 (void) ppreduceInitially(I,currRing,p);889 res->rtyp = IDEAL_CMD;890 res->data = (char*) I;891 return FALSE;892 }893 }894 return TRUE;895 }896 #endif897 712 898 713 -
Singular/dyn_modules/gfanlib/ppinitialReduction.h
r469903 r61335ab 14 14 /* BOOLEAN ppreduceInitially(leftv res, leftv args); */ 15 15 16 #ifndef NDEBUG17 BOOLEAN pReduceDebug(leftv res, leftv args);18 BOOLEAN reduceInitiallyDebug(leftv res, leftv args);19 BOOLEAN ptNormalize(leftv res, leftv args);20 BOOLEAN ppreduceInitially3(leftv res, leftv args);21 16 #endif 22 23 #endif -
Singular/dyn_modules/gfanlib/singularWishlist.h
r469903 r61335ab 3 3 4 4 #include <polys/monomials/p_polys.h> 5 6 /* #ifndef NDEBUG */ 7 /* void z_Write(number p, ring r) */ 8 /* { */ 9 /* poly g = p_One(r); */ 10 /* p_SetCoeff(g,p,r); */ 11 /* p_Write(g,r); */ 12 /* return; */ 13 /* } */ 14 /* #endif */ 5 #include <libpolys/polys/simpleideals.h> 15 6 16 7 static inline BOOLEAN _p_LeadmonomDivisibleByNoComp(poly a, poly b, const ring r) … … 87 78 } 88 79 80 inline void deleteOrdering(ring r) 81 { 82 if (r->order != NULL) 83 { 84 int i=rBlocks(r); 85 assume(r->block0 != NULL && r->block1 != NULL && r->wvhdl != NULL); 86 /* delete order */ 87 omFreeSize((ADDRESS)r->order,i*sizeof(int)); 88 omFreeSize((ADDRESS)r->block0,i*sizeof(int)); 89 omFreeSize((ADDRESS)r->block1,i*sizeof(int)); 90 /* delete weights */ 91 for (int j=0; j<i; j++) 92 if (r->wvhdl[j]!=NULL) 93 omFree(r->wvhdl[j]); 94 omFreeSize((ADDRESS)r->wvhdl,i*sizeof(int *)); 95 } 96 else 97 assume(r->block0 == NULL && r->block1 == NULL && r->wvhdl == NULL); 98 return; 99 } 100 101 102 void z_Write(number p, ring r); 103 void id_Write(const ideal I, const ring r); 104 105 89 106 #endif -
Singular/dyn_modules/gfanlib/startingCone.cc
r469903 r61335ab 1 1 #include <callgfanlib_conversion.h> 2 #include <singularWishlist.h> 3 #include <tropicalDebug.h> 2 4 #include <containsMonomial.h> 3 5 #include <tropical.h> … … 11 13 #include <tropicalVariety.h> 12 14 #include <tropicalStrategy.h> 15 #include <std_wrapper.h> 13 16 14 17 … … 330 333 } 331 334 335 336 ring createTraversalStartingRing(const ring s, const gfan::ZMatrix &startingPoints, const tropicalStrategy& currentStrategy) 337 { 338 // copy r except qideal (which should be 0) and ordering 339 ring s0 = rCopy0(s); 340 int n = rVar(s); 341 deleteOrdering(s0); 342 bool ok; 343 344 // adjust weight and create new ordering 345 int h = startingPoints.getHeight(); 346 s0->order = (int*) omAlloc0((h+3)*sizeof(int)); 347 s0->block0 = (int*) omAlloc0((h+3)*sizeof(int)); 348 s0->block1 = (int*) omAlloc0((h+3)*sizeof(int)); 349 s0->wvhdl = (int**) omAlloc0((h+3)*sizeof(int**)); 350 for (int i=0; i<h; i++) 351 { 352 s0->order[i] = ringorder_a; 353 s0->block0[i] = 1; 354 s0->block1[i] = n; 355 s0->wvhdl[i] = ZVectorToIntStar(startingPoints[i],ok); 356 } 357 s0->order[h] = ringorder_lp; 358 s0->block0[h] = 1; 359 s0->block1[h] = n; 360 s0->order[h+1] = ringorder_C; 361 362 rComplete(s0); 363 rTest(s0); 364 365 return s0; 366 } 367 368 332 369 /*** 333 370 * Computes a starting cone in the tropical variety. … … 359 396 // equals the dimension of the tropical variety 360 397 gfan::ZCone zc = linealitySpaceOfGroebnerFan(inI,s); 361 gfan::ZVector startingPoint; groebnerCone ambientMaximalCone; 398 gfan::ZMatrix startingPoints(0,rVar(r)); 399 groebnerCone ambientMaximalCone; 362 400 if (zc.dimension()>=currentStrategy.getExpectedDimension()) 363 401 { … … 380 418 // compute a point in the tropical variety outside the lineality space 381 419 std::pair<gfan::ZVector,groebnerCone> startingData = tropicalStartingDataViaGroebnerFan(inI,s,currentStrategy); 382 startingPoint = startingData.first; 420 gfan::ZVector startingPoint = startingData.first; 421 startingPoints.appendRow(startingPoint); 383 422 ambientMaximalCone = groebnerCone(startingData.second); 384 423 … … 397 436 // from this we can read of the inequalities and equations 398 437 438 ring s0 = createTraversalStartingRing(s,startingPoints,currentStrategy); 439 nMapFunc identity = n_SetMap(s->cf,s0->cf); 440 k = IDELEMS(inI); 441 ideal inI0 = idInit(k); 442 for (int i=0; i<k; i++) 443 inI0->m[i] = p_PermPoly(inI->m[i],NULL,s,s0,identity,NULL,0); 444 445 identity = n_SetMap(r->cf,s0->cf); 446 k = IDELEMS(I); 447 ideal I0 = idInit(k); 448 for (int i=0; i<k; i++) 449 I0->m[i] = p_PermPoly(I->m[i],NULL,r,s0,identity,NULL,0); 450 451 399 452 // but before doing so, we must lift the generating set of inI 400 453 // to a generating set of I 401 ideal J = lift(I,r,inI,s); // todo: use computeLift from tropicalStrategy 402 groebnerCone startingCone(J,inI,s,currentStrategy); 403 id_Delete(&inI,s); 404 id_Delete(&J,s); 454 // ideal J0 = lift(I,r,inI0,s0); // todo: use computeLift from tropicalStrategy 455 ideal J0 = gfanlib_kStd_wrapper(I0,s0); 456 assume(areIdealsEqual(J0,s0,I,r)); 457 id_Delete(&I0,s0); 458 groebnerCone startingCone(J0,inI0,s0,currentStrategy); 459 id_Delete(&J0,s0); 460 id_Delete(&inI0,s0); 461 rDelete(s0); 405 462 406 463 // assume(checkContainmentInTropicalVariety(startingCone)); -
Singular/dyn_modules/gfanlib/std_wrapper.cc
r469903 r61335ab 1 #include <vector> 2 1 3 #include <kernel/GBEngine/kstd1.h> 2 4 #include <kernel/polys.h> 3 5 #include <kernel/ideals.h> 6 7 #include <Singular/dyn_modules/customstd/customstd.h> 4 8 5 9 ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog) … … 20 24 return stdI; 21 25 } 26 27 ideal gfanlib_satStd_wrapper(ideal I, ring r, tHomog h=testHomog) 28 { 29 ring origin = currRing; 30 if (origin != r) 31 rChangeCurrRing(r); 32 33 int n = rVar(currRing); 34 satstdSaturatingVariables = std::vector<int>(n); 35 for (int i=n-1; i>=0; i--) 36 satstdSaturatingVariables[i] = i+1; 37 38 ideal stdI = kStd(I,currRing->qideal,h,NULL,NULL,0,0,NULL,sat_vars_sp); 39 id_DelDiv(stdI,currRing); 40 idSkipZeroes(stdI); 41 42 if (origin != r) 43 rChangeCurrRing(origin); 44 45 return stdI; 46 } 47 48 ideal gfanlib_monomialabortStd_wrapper(ideal I, ring r, tHomog h=testHomog) 49 { 50 ring origin = currRing; 51 if (origin != r) 52 rChangeCurrRing(r); 53 54 ideal stdI = kStd(I,currRing->qideal,h,NULL,NULL,0,0,NULL,abort_if_monomial_sp); 55 id_DelDiv(stdI,currRing); 56 idSkipZeroes(stdI); 57 58 if (origin != r) 59 rChangeCurrRing(origin); 60 61 return stdI; 62 } -
Singular/dyn_modules/gfanlib/std_wrapper.h
r469903 r61335ab 6 6 7 7 ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog); 8 ideal gfanlib_satStd_wrapper(ideal I, ring r, tHomog h=testHomog); 9 ideal gfanlib_monomialabortStd_wrapper(ideal I, ring r, tHomog h=testHomog); 8 10 9 11 #endif -
Singular/dyn_modules/gfanlib/tropical.cc
r469903 r61335ab 303 303 if (g != NULL && pNext(g) != NULL) 304 304 { 305 p GetExpV(g,leadexpv);305 p_GetExpV(g,leadexpv,r); 306 306 leadexpw = intStar2ZVector(n, leadexpv); 307 307 pIter(g); 308 308 while (g != NULL) 309 309 { 310 p GetExpV(g,tailexpv);310 p_GetExpV(g,tailexpv,r); 311 311 tailexpw = intStar2ZVector(n, tailexpv); 312 312 inequalities.appendRow(leadexpw-tailexpw); … … 449 449 p->iiAddCproc("","groebnerFan",FALSE,groebnerFan); 450 450 p->iiAddCproc("","groebnerComplex",FALSE,groebnerComplex); 451 #ifndef NDEBUG452 // p->iiAddCproc("","tropicalNeighbours",FALSE,tropicalNeighbours);453 // p->iiAddCproc("","initial0",FALSE,initial0);454 p->iiAddCproc("","pReduceDebug",FALSE,pReduceDebug);455 // p->iiAddCproc("","ppreduceInitially0",FALSE,ppreduceInitially0);456 // p->iiAddCproc("","ppreduceInitially1",FALSE,ppreduceInitially1);457 // p->iiAddCproc("","ppreduceInitially2",FALSE,ppreduceInitially2);458 p->iiAddCproc("","ptNormalize",FALSE,ptNormalize);459 p->iiAddCproc("","ppreduceInitially3",FALSE,ppreduceInitially3);460 // p->iiAddCproc("","ppreduceInitially4",FALSE,ppreduceInitially4);461 // p->iiAddCproc("","ttpReduce",FALSE,ttpReduce);462 // p->iiAddCproc("","ttreduceInitially0",FALSE,ttreduceInitially0);463 // p->iiAddCproc("","ttreduceInitially1",FALSE,ttreduceInitially1);464 // p->iiAddCproc("","ttreduceInitially2",FALSE,ttreduceInitially2);465 // p->iiAddCproc("","ttreduceInitially3",FALSE,ttreduceInitially3);466 // p->iiAddCproc("","ttreduceInitially4",FALSE,ttreduceInitially4);467 // p->iiAddCproc("","checkForMonomial",FALSE,checkForMonomial);468 // p->iiAddCproc("","dwr0",FALSE,dwr0);469 // p->iiAddCproc("","witness0",FALSE,witness0);470 // p->iiAddCproc("","tropicalVariety00",FALSE,tropicalVariety00);471 // p->iiAddCproc("","tropicalVariety01",FALSE,tropicalVariety01);472 // p->iiAddCproc("","tropicalCurve0",FALSE,tropicalCurve0);473 // p->iiAddCproc("","tropicalCurve1",FALSE,tropicalCurve1);474 p->iiAddCproc("","reduceInitiallyDebug",FALSE,reduceInitiallyDebug);475 p->iiAddCproc("","computeWitnessDebug",FALSE,computeWitnessDebug);476 p->iiAddCproc("","computeFlipDebug",FALSE,computeFlipDebug);477 p->iiAddCproc("","flipConeDebug",FALSE,flipConeDebug);478 // p->iiAddCproc("","groebnerNeighboursDebug",FALSE,groebnerNeighboursDebug);479 // p->iiAddCproc("","tropicalNeighboursDebug",FALSE,tropicalNeighboursDebug);480 p->iiAddCproc("","tropicalStarDebug",FALSE,tropicalStarDebug);481 p->iiAddCproc("","tropicalStartingPoint",FALSE,tropicalStartingPoint);482 p->iiAddCproc("","positiveTropicalStartingPoint",FALSE,positiveTropicalStartingPoint);483 p->iiAddCproc("","nonNegativeTropicalStartingPoint",FALSE,nonNegativeTropicalStartingPoint);484 p->iiAddCproc("","negativeTropicalStartingPoint",FALSE,negativeTropicalStartingPoint);485 p->iiAddCproc("","nonPositiveTropicalStartingPoint",FALSE,nonPositiveTropicalStartingPoint);486 p->iiAddCproc("","tropicalStartingCone",FALSE,tropicalStartingCone);487 #endif //NDEBUG488 451 // p->iiAddCproc("","ppreduceInitially",FALSE,ppreduceInitially); 489 452 // p->iiAddCproc("","ttreduceInitially",FALSE,ttreduceInitially); -
Singular/dyn_modules/gfanlib/tropical.h
r469903 r61335ab 8 8 9 9 10 gfan::ZCone maximalGroebnerCone(const ideal &I, const ring &r); 10 11 gfan::ZCone homogeneitySpace(ideal I, ring r); 11 12 void tropical_setup(SModulFunctions* p); -
Singular/dyn_modules/gfanlib/tropicalCurves.cc
r469903 r61335ab 11 11 #include <tropicalCurves.h> 12 12 #include <set> 13 #ifndef NDEBUG14 #include <bbfan.h>15 #endif16 13 17 14 /*** … … 123 120 * of the polynomials in the generating set */ 124 121 ZConesSortedByDimension C = tropicalVarietySortedByDimension(inI->m[0],r,currentStrategy); 125 for (int i=1; i<k; i++) 122 int PayneOsserman = rVar(r)-1; 123 for (int i=0; i<k; i++) 126 124 { 127 125 if(inI->m[i]!=NULL) 128 126 { 129 C = intersect(C,tropicalVarietySortedByDimension(inI->m[i],r,currentStrategy),d); 127 PayneOsserman--; 128 C = intersect(C,tropicalVarietySortedByDimension(inI->m[i],r,currentStrategy),si_max(PayneOsserman,d)); 130 129 } 131 130 } … … 321 320 return raysOfC; 322 321 } 323 324 325 /***326 * Computes the tropical curve of an x-homogeneous ideal I327 * which is weighted homogeneous with respect to weight w in ring r328 **/329 #ifndef NDEBUG330 BOOLEAN tropicalStarDebug(leftv res, leftv args)331 {332 leftv u = args;333 if ((u!=NULL) && (u->Typ()==IDEAL_CMD))334 {335 leftv v = u->next;336 if ((v!=NULL) && (v->Typ()==BIGINTMAT_CMD))337 {338 omUpdateInfo();339 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);340 ideal inI = (ideal) u->CopyD();341 bigintmat* u = (bigintmat*) v->CopyD();342 tropicalStrategy currentCase(inI,currRing);343 gfan::ZVector* v = bigintmatToZVector(u);344 ZConesSortedByDimension C = tropicalStar(inI,currRing,*v,¤tCase);345 id_Delete(&inI,currRing);346 delete u;347 delete v;348 res->rtyp = NONE;349 res->data = NULL;350 // res->rtyp = fanID;351 // res->data = (char*) toFanStar(C);352 return FALSE;353 }354 }355 WerrorS("tropicalStarDebug: unexpected parameters");356 return TRUE;357 }358 #endif -
Singular/dyn_modules/gfanlib/tropicalCurves.h
r469903 r61335ab 13 13 const tropicalStrategy* currentStrategy); 14 14 15 #ifndef NDEBUG16 BOOLEAN tropicalStarDebug(leftv res, leftv args);17 15 #endif 18 19 #endif -
Singular/dyn_modules/gfanlib/tropicalStrategy.cc
r469903 r61335ab 1 1 #include <tropicalStrategy.h> 2 #include <singularWishlist.h> 2 3 #include <adjustWeights.h> 3 4 #include <ppinitialReduction.h> … … 6 7 #include <std_wrapper.h> 7 8 #include <tropicalCurves.h> 9 #include <tropicalDebug.h> 10 #include <containsMonomial.h> 11 8 12 9 13 // for various commands in dim(ideal I, ring r): … … 115 119 J->m[i] = p_PermPoly(JShortcut->m[i],NULL,rShortcut,r,outofShortcut,NULL,0); 116 120 121 assume(areIdealsEqual(J,r,I,r)); 117 122 swapElements(I,J); 118 123 id_Delete(&IShortcut,rShortcut); … … 521 526 } 522 527 528 gfan::ZCone C0 = homogeneitySpace(inIShortcut,rShortcut); 529 gfan::ZCone pos = gfan::ZCone::positiveOrthant(C0.ambientDimension()); 530 gfan::ZCone C0pos = intersection(C0,pos); 531 C0pos.canonicalize(); 532 gfan::ZVector wpos = C0pos.getRelativeInteriorPoint(); 533 assume(checkForNonPositiveEntries(wpos)); 534 523 535 // check initial ideal for monomial and 524 536 // if it exsists, return a copy of the monomial in the input ring 525 poly p = checkForMonomialViaSuddenSaturation(inIShortcut,rShortcut);537 poly p = searchForMonomialViaStepwiseSaturation(inIShortcut,rShortcut,wpos); 526 538 poly monomial = NULL; 527 539 if (p!=NULL) … … 684 696 } 685 697 686 static void deleteOrdering(ring r)687 {688 if (r->order != NULL)689 {690 int i=rBlocks(r);691 assume(r->block0 != NULL && r->block1 != NULL && r->wvhdl != NULL);692 /* delete order */693 omFreeSize((ADDRESS)r->order,i*sizeof(int));694 omFreeSize((ADDRESS)r->block0,i*sizeof(int));695 omFreeSize((ADDRESS)r->block1,i*sizeof(int));696 /* delete weights */697 for (int j=0; j<i; j++)698 if (r->wvhdl[j]!=NULL)699 omFree(r->wvhdl[j]);700 omFreeSize((ADDRESS)r->wvhdl,i*sizeof(int *));701 }702 else703 assume(r->block0 == NULL && r->block1 == NULL && r->wvhdl == NULL);704 return;705 }706 707 698 ring tropicalStrategy::copyAndChangeOrderingWP(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const 708 699 { … … 771 762 assume(isValuationTrivial() || interiorPoint[0].sign()<0); 772 763 assume(checkForUniformizingBinomial(Ir,r)); 764 assume(checkWeightVector(Ir,r,interiorPoint)); 773 765 774 766 // get a generating system of the initial ideal … … 798 790 Js->m[i] = p_PermPoly(Jr->m[i],NULL,r,s,identity,NULL,0); 799 791 800 // this->reduce(Jr,r); 792 reduce(Js,s); 793 assume(areIdealsEqual(Js,s,Ir,r)); 794 assume(isValuationTrivial() || isOrderingLocalInT(s)); 795 assume(checkWeightVector(Js,s,interiorPoint)); 796 801 797 // cleanup 802 798 id_Delete(&inIsAdjusted,sAdjusted); … … 890 886 return false; 891 887 } 892 893 #ifndef NDEBUG894 tropicalStrategy::tropicalStrategy():895 originalRing(NULL),896 originalIdeal(NULL),897 expectedDimension(NULL),898 linealitySpace(gfan::ZCone()),899 startingRing(NULL),900 startingIdeal(NULL),901 uniformizingParameter(NULL),902 shortcutRing(NULL),903 onlyLowerHalfSpace(false)904 {905 weightAdjustingAlgorithm1=NULL;906 weightAdjustingAlgorithm2=NULL;907 extraReductionAlgorithm=NULL;908 }909 910 tropicalStrategy tropicalStrategy::debugStrategy(const ideal startIdeal, number unifParameter, ring startRing)911 {912 tropicalStrategy debug;913 debug.originalRing = rCopy(startRing);914 debug.originalIdeal = id_Copy(startIdeal,startRing);915 debug.startingRing = rCopy(startRing);916 debug.startingIdeal = id_Copy(startIdeal,startRing);917 debug.uniformizingParameter = n_Copy(unifParameter,startRing->cf);918 919 debug.shortcutRing = rCopy0(startRing);920 nKillChar(debug.shortcutRing->cf);921 debug.shortcutRing->cf = nInitChar(n_Zp,(void*)(long)IsPrime(n_Int(unifParameter,startRing->cf)));922 rComplete(debug.shortcutRing);923 rTest(debug.shortcutRing);924 925 debug.onlyLowerHalfSpace = true;926 debug.weightAdjustingAlgorithm1 = valued_adjustWeightForHomogeneity;927 debug.weightAdjustingAlgorithm2 = valued_adjustWeightUnderHomogeneity;928 debug.extraReductionAlgorithm = ppreduceInitially;929 930 return debug;931 }932 933 BOOLEAN computeWitnessDebug(leftv res, leftv args)934 {935 leftv u = args;936 if ((u!=NULL) && (u->Typ()==IDEAL_CMD))937 {938 leftv v = u->next;939 if ((v!=NULL) && (v->Typ()==IDEAL_CMD))940 {941 leftv w = v->next;942 if ((w!=NULL) && (w->Typ()==IDEAL_CMD))943 {944 leftv x = w->next;945 if ((x!=NULL) && (x->Typ()==NUMBER_CMD))946 {947 omUpdateInfo();948 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);949 950 ideal inJ = (ideal) u->CopyD();951 ideal inI = (ideal) v->CopyD();952 ideal I = (ideal) w->CopyD();953 number p = (number) x->CopyD();954 tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing);955 ideal J = debug.computeWitness(inJ,inI,I,currRing);956 id_Delete(&inJ,currRing);957 id_Delete(&inI,currRing);958 id_Delete(&I,currRing);959 n_Delete(&p,currRing->cf);960 res->rtyp = IDEAL_CMD;961 res->data = (char*) J;962 return FALSE;963 }964 }965 }966 }967 return TRUE;968 }969 970 BOOLEAN computeFlipDebug(leftv res, leftv args)971 {972 leftv u = args;973 if ((u!=NULL) && (u->Typ()==IDEAL_CMD))974 {975 leftv v = u->next;976 if ((v!=NULL) && (v->Typ()==NUMBER_CMD))977 {978 leftv w = v->next;979 if ((w!=NULL) && (w->Typ()==BIGINTMAT_CMD))980 {981 leftv x = w->next;982 if ((x!=NULL) && (x->Typ()==BIGINTMAT_CMD))983 {984 omUpdateInfo();985 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);986 987 ideal I = (ideal) u->CopyD();988 number p = (number) v->CopyD();989 bigintmat* interiorPoint0 = (bigintmat*) w->CopyD();990 bigintmat* facetNormal0 = (bigintmat*) x->CopyD();991 tropicalStrategy debug = tropicalStrategy::debugStrategy(I,p,currRing);992 993 gfan::ZVector* interiorPoint = bigintmatToZVector(interiorPoint0);994 gfan::ZVector* facetNormal = bigintmatToZVector(facetNormal0);995 std::pair<ideal,ring> Js = debug.computeFlip(I,currRing,*interiorPoint,*facetNormal);996 ideal J = Js.first;997 ring s = Js.second;998 999 id_Delete(&J,s);1000 rDelete(s);1001 1002 id_Delete(&I,currRing);1003 n_Delete(&p,currRing->cf);1004 delete interiorPoint0;1005 delete facetNormal0;1006 delete interiorPoint;1007 delete facetNormal;1008 1009 res->rtyp = NONE;1010 res->data = NULL;1011 return FALSE;1012 }1013 }1014 }1015 }1016 WerrorS("computeFlipDebug: unexpected parameters");1017 return TRUE;1018 }1019 #endif -
Singular/dyn_modules/gfanlib/tropicalStrategy.h
r469903 r61335ab 134 134 135 135 136 #ifndef NDEBUG137 tropicalStrategy();138 static tropicalStrategy debugStrategy(const ideal startIdeal, number unifParameter, ring startRing);139 #endif140 141 136 /** 142 137 * destructor … … 333 328 }; 334 329 335 #ifndef NDEBUG336 BOOLEAN computeWitnessDebug(leftv res, leftv args);337 BOOLEAN computeFlipDebug(leftv res, leftv args);338 330 #endif 339 340 #endif -
Singular/dyn_modules/gfanlib/tropicalTraversal.cc
r469903 r61335ab 2 2 #include <groebnerCone.h> 3 3 #include <tropicalCurves.h> 4 #include <std_wrapper.h> 4 5 5 6 std::vector<bool> checkNecessaryTropicalFlips(const groebnerCones &tropicalVariety, const groebnerCones &workingList, … … 22 23 { 23 24 if (needToFlip[i] && sigma->contains(testVectors[i])) 25 { 24 26 needToFlip[i] = false; 27 break; 28 } 25 29 } 26 30 } … … 34 38 { 35 39 if (needToFlip[i] && sigma->contains(testVectors[i])) 40 { 36 41 needToFlip[i] = false; 42 break; 43 } 37 44 } 38 45 } … … 71 78 { 72 79 ideal inI = initial(sigma.getPolynomialIdeal(),sigma.getPolynomialRing(),interiorPoint); 73 gfan::ZMatrix normalVectors = raysOfTropicalStar(inI, 80 ideal inISTD = gfanlib_satStd_wrapper(inI,sigma.getPolynomialRing()); 81 id_Delete(&inI,sigma.getPolynomialRing()); 82 gfan::ZMatrix normalVectors = raysOfTropicalStar(inISTD, 74 83 sigma.getPolynomialRing(), 75 84 interiorPoint, 76 85 sigma.getTropicalStrategy()); 77 id_Delete(&inI ,sigma.getPolynomialRing());86 id_Delete(&inISTD,sigma.getPolynomialRing()); 78 87 79 88 std::vector<bool> needToFlip = checkNecessaryTropicalFlips(tropicalVariety,workingList,interiorPoint,normalVectors); -
Singular/dyn_modules/gfanlib/witness.cc
r469903 r61335ab 3 3 #include <polys/monomials/p_polys.h> 4 4 #include <callgfanlib_conversion.h> 5 #include <tropicalDebug.h> 5 6 #include <initial.h> 6 7 #include <tropicalStrategy.h> 7 #include <utility>8 8 9 9 matrix divisionDiscardingRemainder(const poly f, const ideal G, const ring r) … … 67 67 } 68 68 69 assume(areIdealsEqual(I,r,J,r)); 70 69 71 return I; 70 72 } 71 72 #ifndef NDEBUG73 BOOLEAN dwrDebug(leftv res, leftv args)74 {75 leftv u = args;76 leftv v = u->next;77 ideal F = (ideal) u->CopyD();78 ideal G = (ideal) v->CopyD();79 omUpdateInfo();80 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);81 matrix Q = divisionDiscardingRemainder(F,G,currRing);82 id_Delete(&F,currRing);83 id_Delete(&G,currRing);84 res->rtyp = MATRIX_CMD;85 res->data = (char*) Q;86 return FALSE;87 }88 89 BOOLEAN witnessDebug(leftv res, leftv args)90 {91 leftv u = args;92 if ((u != NULL) && (u->Typ() == IDEAL_CMD))93 {94 leftv v = u->next;95 if ((v!=NULL) && (v->Typ()==IDEAL_CMD))96 {97 omUpdateInfo();98 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);99 ideal inI = (ideal) u->CopyD();100 ideal J = (ideal) v->CopyD();101 ideal I = witness(inI,J,currRing);102 id_Delete(&inI,currRing);103 id_Delete(&J,currRing);104 res->rtyp = IDEAL_CMD;105 res->data = (char*) I;106 return FALSE;107 }108 }109 return TRUE;110 }111 #endif -
Singular/dyn_modules/gfanlib/witness.h
r469903 r61335ab 41 41 ideal witness(const ideal inI, const ideal J, const ring r); 42 42 43 #ifndef NDEBUG44 #include <Singular/ipid.h>45 BOOLEAN dwrDebug(leftv res, leftv args);46 BOOLEAN witnessDebug(leftv res, leftv args);47 43 #endif 48 49 #endif -
Tst/Short/bug_newstruct.tst
r469903 r61335ab 2 2 tst_init(); 3 3 4 LIB"customstd.so"; 4 5 LIB"gfanlib.so"; 5 6 // newstruct stuff -
gfanlib/gfanlib_zfan.cpp
r469903 r61335ab 281 281 return complex->getAmbientDimension()-complex->getMaxDim(); 282 282 if(coneCollection) 283 { 284 if(coneCollection->isEmpty()) 285 return -1; 283 286 return coneCollection->getAmbientDimension()-coneCollection->getMaxDimension(); 287 } 284 288 assert(0); 285 289 return 0; … … 290 294 return complex->getMaxDim(); 291 295 if(coneCollection) 296 { 297 if(coneCollection->isEmpty()) 298 return -1; 292 299 return coneCollection->getMaxDimension(); 300 } 293 301 assert(0); 294 302 return 0;
Note: See TracChangeset
for help on using the changeset viewer.