Changeset e57255 in git
- Timestamp:
- Dec 16, 2013, 3:12:47 PM (9 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
- Children:
- d186d3baff30f2e6e96b2a354ff156ec286fcb4ef24b9c65dd9d2b3d937e5841295580dedc2f7412
- Parents:
- 27877c10cae6d5eb945d62a27d66dfdf8a5a47849e8ae12733559521215c7641624da588f2d8cdf3
- Files:
-
- 14 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/COPYING
r27877c re57255 134 134 paramet.lib Thomas Keilen keilen@mathematik.uni-kl.de 135 135 perron.lib Oleksandr Motsak motsak at mathematik dot uni minus kl dot de 136 phindex.lib 136 phindex.lib 137 137 pointid.lib Stefan Steidel steidel@mathematik.uni-kl.de 138 138 poly.lib Olaf Bachmann obachman@mathematik.uni-kl.de 139 139 Gert-Martin Greuel greuel@mathematik.uni-kl.de 140 140 Anne Fruehbis-Krueger anne@mathematik.uni-kl.de 141 oldpolymake.libThomas Markwig keilen@mathematik.uni-kl.de141 polymake.lib Thomas Markwig keilen@mathematik.uni-kl.de 142 142 presolve.lib Gert-Martin Greuel greuel@mathematik.uni-kl.de 143 143 primdec.lib Gerhard Pfister pfister@mathematik.uni-kl.de -
Singular/LIB/polymake.lib
r27877c re57255 1 //// 2 version="version oldpolymake.lib 4.0.0.0 Jun_2013 "; // $Id$ 1 version="version oldpolymake.lib 4.0.0.0 Jun_2013 "; 3 2 category="Tropical Geometry"; 4 3 info=" 5 LIBRARY: oldpolymake.libComputations with polytopes and fans,6 4 LIBRARY: polymake.lib Computations with polytopes and fans, 5 interface to polymake and TOPCOM 7 6 AUTHOR: Thomas Markwig, email: keilen@mathematik.uni-kl.de 8 7 … … 10 9 Most procedures will not work unless polymake or topcom is installed and 11 10 if so, they will only work with the operating system LINUX! 12 For more detailed information see the following note orconsult the11 For more detailed information see IMPORTANT NOTE respectively consult the 13 12 help string of the procedures. 14 13 15 NOTE: 14 The conventions used in this library for polytopes and fans, e.g. the 15 length and labeling of their vertices resp. rays, differs from the conventions 16 used in polymake and thus from the conventions used in the polymake 17 extension polymake.so of Singular. We recommend to use the newer polymake.so 18 whenever possible. 19 20 IMPORTANT NOTE: 16 21 Even though this is a Singular library for computing polytopes and fans 17 22 such as the Newton polytope or the Groebner fan of a polynomial, most of … … 19 24 @* - polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt 20 25 @* (see http://www.math.tu-berlin.de/polymake/), 21 @* respectively (only in the procedure triangula rions) by the program22 @* - topcom by Joerg Rambau, Universitaet Bayreuth (see http://www.uni-bayreuth.de/23 24 @* This library should rather be seen as an interface which allows to use a26 @* respectively (only in the procedure triangulations) by the program 27 @* - topcom by Joerg Rambau, Universitaet Bayreuth (see 28 @* http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/TOPCOM); 29 @* this library should rather be seen as an interface which allows to use a 25 30 (very limited) number of options which polymake respectively topcom offers 26 31 to compute with polytopes and fans and to make the results available in … … 32 37 independent of both, polymake and topcom. 33 38 34 PROCEDURES: 35 polymakePolytope() computes the vertices of a polytope using polymake 36 newtonPolytopeP() computes the Newton polytope of a polynomial 37 newtonPolytopeLP() computes the lattice points of the Newton polytope 38 normalFan() computes the normal fan of a polytope 39 groebnerFan() computes the Groebner fan of a polynomial 40 intmatToPolymake() transforms an integer matrix into polymake format 41 polymakeToIntmat() transforms polymake output into an integer matrix 42 43 triangulations() computes all triangulations of a marked polytope 44 secondaryPolytope() computes the secondary polytope of a marked polytope 45 46 secondaryFan() computes the secondary fan of a marked polytope 47 48 cycleLength() computes the cycleLength of cycle 49 splitPolygon() splits a marked polygon into vertices, facets, interior points 50 eta() computes the eta-vector of a triangulation 51 findOrientedBoundary() computes the boundary of a convex hull 52 cyclePoints() computes lattice points connected to some lattice point 53 latticeArea() computes the lattice area of a polygon 54 picksFormula() computes the ingrediants of Pick's formula for a polygon 55 ellipticNF() computes the normal form of an elliptic polygon 56 ellipticNFDB() displays the 16 normal forms of elliptic polygons 57 58 polymakeKeepTmpFiles() determines if the files created in /tmp should be kept 39 PROCEDURES USING POLYMAKE: 40 polymakePolytope() computes the vertices of a polytope using polymake 41 newtonPolytopeP() computes the Newton polytope of a polynomial 42 newtonPolytopeLP() computes the lattice points of the Newton polytope 43 normalFanL() computes the normal fan of a polytope 44 groebnerFan() computes the Groebner fan of a polynomial 45 46 PROCEDURES USING TOPCOM: 47 triangulations() computes all triangulations of a marked polytope 48 secondaryPolytope() computes the secondary polytope of a marked polytope 49 50 PROCEDURES USING POLYMAKE AND TOPCOM: 51 secondaryFan() computes the secondary fan of a marked polytope 52 53 PROCEDURES CONERNED WITH PLANAR POLYGONS: 54 cycleLength() computes the cycleLength of cycle 55 splitPolygon() splits a marked polygon into vertices, facets, interior points 56 eta() computes the eta-vector of a triangulation 57 findOrientedBoundary() computes the boundary of a convex hull 58 cyclePoints() computes lattice points connected to some lattice point 59 latticeArea() computes the lattice area of a polygon 60 picksFormula() computes the ingrediants of Pick's formula for a polygon 61 ellipticNF() computes the normal form of an elliptic polygon 62 ellipticNFDB() displays the 16 normal forms of elliptic polygons 59 63 60 64 KEYWORDS: polytope; fan; secondary fan; secondary polytope; polymake; … … 85 89 //////////////////////////////////////////////////////////////////////////////// 86 90 91 static proc mod_init () 92 { 93 LIB "gfanlib.so"; 94 LIB "polymake.so"; 95 } 87 96 88 97 ///////////////////////////////////////////////////////////////////////////// … … 90 99 ///////////////////////////////////////////////////////////////////////////// 91 100 92 proc polymakePolytope (intmat po lytop,list #)93 "USAGE: polymakePolytope(po lytope[,#]); polytope list, # string94 ASSUME: each row of po lytopegives the coordinates of a lattice point of a101 proc polymakePolytope (intmat points) 102 "USAGE: polymakePolytope(points); polytope intmat 103 ASSUME: each row of points gives the coordinates of a lattice point of a 95 104 polytope with their affine coordinates as given by the output of 96 105 secondaryPolytope 97 106 PURPOSE: the procedure calls polymake to compute the vertices of the polytope 98 107 as well as its dimension and information on its facets 99 RETURN: list L with four entries108 RETURN: list, L with four entries 100 109 @* L[1] : an integer matrix whose rows are the coordinates of vertices 101 110 of the polytope 102 111 @* L[2] : the dimension of the polytope 103 @* L[3] : a list whose i -th entry explains to which vertices the112 @* L[3] : a list whose ith entry explains to which vertices the 104 113 ith vertex of the Newton polytope is connected 105 114 -- i.e. L[3][i] is an integer vector and an entry k in 106 115 there means that the vertex L[1][i] is connected to the 107 116 vertex L[1][k] 108 @* L[4] : an integer matrixwhose rows mulitplied by117 @* L[4] : an matrix of type bigintmat whose rows mulitplied by 109 118 (1,var(1),...,var(nvar)) give a linear system of equations 110 119 describing the affine hull of the polytope, … … 118 127 convention which starts indexing its vertices by zero while we start 119 128 with one ! 120 @* - the procedure creates the file /tmp/polytope.polymake which contains121 the polytope in polymake format; if you wish to use this for further122 computations with polymake, you have to use the procedure123 polymakeKeepTmpFiles in before124 @* - moreover, the procedure creates the file /tmp/polytope.output which125 it deletes again before ending126 @* - it is possible to provide an optional second argument a string127 which then will be used instead of 'polytope' in the name of the128 polymake output file129 129 EXAMPLE: example polymakePolytope; shows an example" 130 130 { 131 // the header for the file secendarypolytope.polymake 132 string sp="_application polytope 133 _version 2.2 134 _type RationalPolytope 135 136 POINTS 137 "; 131 // add a first column to polytope as homogenising coordinate 132 points=intmatAddFirstColumn(points,"points"); 133 polytope polytop=polytopeViaPoints(points); 134 list graph=vertexAdjacencyGraph(polytop)[2]; 138 135 int i,j; 139 // set the name for the polymake output file 140 if (size(#)>0) 141 { 142 if (typeof(#[1])=="string") 143 { 144 string dateiname=#[1]; 145 } 146 else 147 { 148 string dateiname="polytope"; 149 } 150 } 151 else 152 { 153 string dateiname="polytope"; 154 } 155 // create the lattice point list for polymake 156 sp=sp+intmatToPolymake(polytop,"points"); 157 // initialise dateiname.polymake and compute the vertices 158 write(":w /tmp/"+dateiname+".polymake",sp); 159 system("sh","cd /tmp; polymake "+dateiname+".polymake VERTICES > "+dateiname+".output"); 160 string vertices=read("/tmp/"+dateiname+".output"); 161 system("sh","/bin/rm /tmp/"+dateiname+".output"); 162 intmat np=polymakeToIntmat(vertices,"affine"); 163 // compute the dimension 164 system("sh","cd /tmp; polymake "+dateiname+".polymake DIM > "+dateiname+".output"); 165 string pdim=read("/tmp/"+dateiname+".output"); 166 system("sh","/bin/rm /tmp/"+dateiname+".output"); 167 pdim=pdim[5,size(pdim)-6]; 168 execute("int nd="+pdim+";"); 169 // compute the vertex-edge graph 170 system("sh","cd /tmp; polymake "+dateiname+".polymake GRAPH > "+dateiname+".output"); 171 string vertexedgegraph=read("/tmp/"+dateiname+".output"); 172 system("sh","/bin/rm /tmp/"+dateiname+".output"); 173 vertexedgegraph=vertexedgegraph[7,size(vertexedgegraph)-8]; 174 string newveg; 175 for (i=1;i<=size(vertexedgegraph);i++) 176 { 177 if (vertexedgegraph[i]=="{") 178 { 179 newveg=newveg+"intvec("; 180 } 181 else 182 { 183 if (vertexedgegraph[i]=="}") 184 { 185 newveg=newveg+"),"; 186 } 187 else 188 { 189 if (vertexedgegraph[i]==" ") 190 { 191 newveg=newveg+","; 192 } 193 else 194 { 195 newveg=newveg+vertexedgegraph[i]; 196 } 197 } 198 } 199 } 200 newveg=newveg[1,size(newveg)-1]; 201 execute("list nveg="+newveg+";"); 202 // raise each entry in nveg by one 203 for (i=1;i<=size(nveg);i++) 204 { 205 for (j=1;j<=size(nveg[i]);j++) 206 { 207 nveg[i][j]=nveg[i][j]+1; 208 } 209 } 210 // compute the affine hull 211 system("sh","cd /tmp; polymake "+dateiname+".polymake AFFINE_HULL > "+dateiname+".output"); 212 string equations=read("/tmp/"+dateiname+".output"); 213 system("sh","/bin/rm /tmp/"+dateiname+".output"); 214 if (size(equations)>14) 215 { 216 intmat neq=polymakeToIntmat(equations,"cleardenom"); 217 } 218 else 219 { 220 intmat neq[1][ncols(polytop)+1]; 221 } 222 // delete the tmp-files, if polymakekeeptmpfiles is not set 223 if (defined(polymakekeeptmpfiles)==0) 224 { 225 system("sh","/bin/rm /tmp/"+dateiname+".polymake"); 226 } 227 // return the files 228 return(list(np,nd,nveg,neq)); 136 for (i=1;i<=size(graph);i++) 137 { 138 for (j=1;j<=size(graph[i]);j++) 139 { 140 graph[i][j]=graph[i][j]+1; 141 } 142 } 143 return(list(intmatcoldelete(vertices(polytop),1),dimension(polytop),graph,equations(polytop))); 229 144 } 230 145 example … … 247 162 ring r=0,x(1..4),dp; 248 163 matrix M[5][1]=1,x(1),x(2),x(3),x(4); 249 np[4]*M;164 intmat(np[4])*M; 250 165 } 251 166 252 167 ///////////////////////////////////////////////////////////////////////////// 253 168 254 proc newtonPolytopeP (poly f ,list #)255 "USAGE: newtonPolytopeP(f [,#]); f poly, # string256 RETURN: list L with four entries169 proc newtonPolytopeP (poly f) 170 "USAGE: newtonPolytopeP(f); f poly 171 RETURN: list, L with four entries 257 172 @* L[1] : an integer matrix whose rows are the coordinates of vertices 258 173 of the Newton polytope of f … … 263 178 there means that the vertex L[1][i] is 264 179 connected to the vertex L[1][k] 265 @* L[4] : an integer matrixwhose rows mulitplied by180 @* L[4] : an matrix of type bigintmat whose rows mulitplied by 266 181 (1,var(1),...,var(nvar)) give a linear system of equations 267 182 describing the affine hull of the Newton polytope, i.e. the … … 269 184 NOTE: - if we replace the first column of L[4] by zeros, i.e. if we move 270 185 the affine hull to the origin, then we get the equations for the 271 orthogonal compl oment of the linearity space of the normal fan dual186 orthogonal complement of the linearity space of the normal fan dual 272 187 to the Newton polytope, i.e. we get the EQUATIONS that 273 188 we need as input for polymake when computing the normal fan … … 275 190 TU Berlin and Michael Joswig, so it only works if polymake is installed; 276 191 see http://www.math.tu-berlin.de/polymake/ 277 @* - the procedure creates the file /tmp/newtonPolytope.polymake which278 contains the polytope in polymake format and which can be used for279 further computations with polymake280 @* - moreover, the procedure creates the file /tmp/newtonPolytope.output281 and deletes it again before ending282 @* - it is possible to give as an optional second argument a string283 which then will be used instead of 'newtonPolytope' in the name of284 the polymake output file285 192 EXAMPLE: example newtonPolytopeP; shows an example" 286 193 { … … 296 203 f=f-lead(f); 297 204 } 298 if (size(#)==0)299 {300 #[1]="newtonPolytope";301 }302 205 // call polymakePolytope with exponents 303 return(polymakePolytope(exponents ,#));206 return(polymakePolytope(exponents)); 304 207 } 305 208 example … … 330 233 // the Newton polytope is contained in the affine space given 331 234 // by the equations 332 np[4]*M;235 intmat(np[4])*M; 333 236 } 334 237 … … 339 242 RETURN: list, the exponent vectors of the monomials occuring in f, 340 243 i.e. the lattice points of the Newton polytope of f 341 EXAMPLE: example n ormalFan; shows an example"244 EXAMPLE: example newtonPolytopeLP; shows an example" 342 245 { 343 246 list np; … … 363 266 ///////////////////////////////////////////////////////////////////////////// 364 267 365 proc normalFan (intmat vertices,intmataffinehull,list graph,int er,list #)366 "USAGE: normalFan (vert,aff,graph,rays,[,#]); vert,aff intmat, graph list, rays int, # string268 proc normalFanL (def vertices, def affinehull,list graph,int er,list #) 269 "USAGE: normalFanL (vert,aff,graph,rays,[,#]); vert,aff intmat, graph list, rays int, # string 367 270 ASSUME: - vert is an integer matrix whose rows are the coordinate of 368 271 the vertices of a convex lattice polytope; … … 396 299 @* - in the optional argument # it is possible to hand over other names 397 300 for the variables to be used -- be careful, the format must be correct 398 which is not tested, e.g. if you want the variable names to be 399 u00,u10,u01,u11 then you must hand over the string 'u11,u10,u01,u11' 400 EXAMPLE: example normalFan; shows an example" 401 { 301 and that is not tested, e.g. if you want the variable names to be 302 u00,u10,u01,u11 then you must hand over the string u11,u10,u01,u11 303 EXAMPLE: example normalFanL; shows an example" 304 { 305 if (typeof(affinehull) != "intmat" && typeof (affinehull) != "bigintmat") 306 { 307 ERROR("normalFanL: input affinehull has to be either intmat or bigintmat"); 308 list L; 309 return (L); 310 } 402 311 list ineq; // stores the inequalities of the cones 403 312 int i,j,k; … … 431 340 list pp; // contain strings representing the inequalities 432 341 // describing the normal cone 433 intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities 434 // as rows 342 if (typeof (vertices) == "intmat") 343 { 344 intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities 345 } // as rows 346 if (typeof (vertices) == "bigintmat") 347 { 348 bigintmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities 349 } // as rows 435 350 // consider all the vertices to which the ith vertex in the 436 351 // polytope is connected by an edge … … 469 384 } 470 385 // remove the first column of affine hull to compute the linearity space 471 intmat linearity=intmatcoldelete(affinehull,1); 386 bigintmat linearity[1][ncols(vertices)]; 387 if (nrows(affinehull)>0) 388 { 389 linearity=intmatcoldelete(affinehull,1); 390 } 472 391 ////////////////////////////////////////////////////////////////// 473 392 // Compute next the extreme rays of the cones … … 476 395 { 477 396 list extremerays; // keeps the result 478 string polymake; // keeps polymake output 479 // the header for ineq.polymake 480 string head="_application polytope 481 _version 2.2 482 _type RationalPolytope 483 484 INEQUALITIES 485 "; 486 // the tail for both polymake files 487 string tail=" 488 EQUATIONS 489 "; 490 tail=tail+intmatToPolymake(linearity,"rays"); 491 string ungleichungen; // keeps the inequalities for the polymake code 397 cone kegel; 398 bigintmat linearspan=intmatAddFirstColumn(linearity,"rays"); 492 399 intmat M; // the matrix keeping the inequalities 493 // create the file ineq.output494 write(":w /tmp/ineq.output","");495 int dimension; // keeps the dimension of the intersection the496 // bad cones with the u11tobeseencone497 400 for (i=1;i<=size(ineq);i++) 498 401 { 499 i,". Cone of ",nrows(vertices); // indicate how many 500 // vertices have been dealt with 501 ungleichungen=intmatToPolymake(ineq[i][1],"rays"); 502 // write the inequalities to ineq.polymake and call polymake 503 write(":w /tmp/ineq.polymake",head+ungleichungen+tail); 504 ungleichungen=""; // clear ungleichungen 505 system("sh","cd /tmp; /bin/rm ineq.output; polymake ineq.polymake VERTICES > ineq.output"); 506 // read the result of polymake 507 polymake=read("/tmp/ineq.output"); 508 intmat VERT=polymakeToIntmat(polymake,"affine"); 509 extremerays[i]=VERT; 510 kill VERT; 402 kegel=coneViaInequalities(intmatAddFirstColumn(ineq[i][1],"rays"),linearspan); 403 extremerays[i]=intmatcoldelete(rays(kegel),1); 511 404 } 512 405 for (i=1;i<=size(ineq);i++) … … 514 407 ineq[i]=ineq[i]+list(extremerays[i]); 515 408 } 516 }517 // delete the tmp-files, if polymakekeeptmpfiles is not set518 if (defined(polymakekeeptmpfiles)==0)519 {520 system("sh","/bin/rm /tmp/ineq.polymake");521 system("sh","/bin/rm /tmp/ineq.output");522 409 } 523 410 // get the linearity space … … 534 421 list np=newtonPolytopeP(f); 535 422 // the Groebner fan of f, i.e. the normal fan of the Newton polytope 536 list gf=normalFan (np[1],np[4],np[3],1,"x,y,z");423 list gf=normalFanL(np[1],np[4],np[3],1,"x,y,z"); 537 424 // the number of cones in the Groebner fan of f is: 538 425 size(gf[1]); … … 549 436 ///////////////////////////////////////////////////////////////////////////// 550 437 551 proc groebnerFan (poly f ,list #)552 "USAGE: groebnerFan(f [,#]); f poly, # string438 proc groebnerFan (poly f) 439 "USAGE: groebnerFan(f); f poly 553 440 RETURN: list, the ith entry of L[1] contains information about the ith cone 554 441 in the Groebner fan dual to the ith vertex in the Newton … … 564 451 in each cone 565 452 @* L[3] = the Newton polytope of f in the format of the procedure 566 newtonPolytope 567 @* L[4] = integer matrix where each row represents the expone t453 newtonPolytopeP 454 @* L[4] = integer matrix where each row represents the exponent 568 455 vector of one monomial occuring in the input polynomial 569 456 NOTE: - if you have already computed the Newton polytope of f then you might want 570 to use the procedure normalFan instead in order to avoid doing costly457 to use the procedure normalFanL instead in order to avoid doing costly 571 458 computation twice 572 459 @* - the procedure calls for its computation polymake by Ewgenij Gawrilow, 573 460 TU Berlin and Michael Joswig, so it only works if polymake is installed; 574 461 see http://www.math.tu-berlin.de/polymake/ 575 @* - the procedure creates the file /tmp/newtonPolytope.polymake which576 contains the Newton polytope of f in polymake format and which can577 be used for further computations with polymake578 @* - it is possible to give as an optional second argument as string which579 then will be used instead of 'newtonPolytope' in the name of the580 polymake output file581 462 EXAMPLE: example groebnerFan; shows an example" 582 463 { … … 591 472 f=f-lead(f); 592 473 } 593 if (size(#)==0)594 {595 #[1]="newtonPolytope";596 }597 474 // call polymakePolytope with exponents 598 list newtonp=polymakePolytope(exponents ,"newtonPolytope");475 list newtonp=polymakePolytope(exponents); 599 476 // get the variables as string 600 477 string variablen; … … 604 481 } 605 482 variablen=variablen[1,size(variablen)-1]; 606 // call normalFan in order to compute the Groebner fan607 list gf=normalFan (newtonp[1],newtonp[4],newtonp[3],1,variablen);483 // call normalFanL in order to compute the Groebner fan 484 list gf=normalFanL(newtonp[1],newtonp[4],newtonp[3],1,variablen); 608 485 // append newtonp to gf 609 486 gf[3]=newtonp; … … 642 519 643 520 644 /////////////////////////////////////////////////////////////////////////////645 646 proc intmatToPolymake (intmat M,string art)647 "USAGE: intmatToPolymake(M,art); M intmat, art string648 ASSUME: - M is an integer matrix which should be transformed into polymake649 format;650 @* - art is one of the following strings:651 @* + 'rays' : indicating that a first column of 0's should be added652 @* + 'points' : indicating that a first column of 1's should be added653 RETURN: string, the matrix is transformed in a string and a first column has654 been added655 EXAMPLE: example intmatToPolymake; shows an example"656 {657 if (art=="rays")658 {659 string anf="0 ";660 }661 else662 {663 string anf="1 ";664 }665 string sp;666 int i,j;667 // create the lattice point list for polymake668 for (i=1;i<=nrows(M);i++)669 {670 sp=sp+anf;671 for (j=1;j<=ncols(M);j++)672 {673 sp=sp+string(M[i,j])+" ";674 if (j==ncols(M))675 {676 sp=sp+"677 ";678 }679 }680 }681 return(sp);682 }683 example684 {685 "EXAMPLE:";686 echo=2;687 intmat M[3][4]=1,2,3,4,5,6,7,8,9,10,11,12;688 intmatToPolymake(M,"rays");689 intmatToPolymake(M,"points");690 }691 692 /////////////////////////////////////////////////////////////////////////////693 694 proc polymakeToIntmat (string pm,string art)695 "USAGE: polymakeToIntmat(pm,art); pm, art string696 ASSUME: pm is the result of calling polymake with one 'argument' like697 VERTICES, AFFINE_HULL, etc., so that the first row of the string is698 the name of the corresponding 'argument' and the further rows contain699 the result which consists of vectors either over the integers700 or over the rationals701 RETURN: intmat, the rows of the matrix are basically the vectors in pm, starting702 from the second row, where each row has been multiplied with the703 lowest common multiple of the denominators of its entries as if704 it is an integer matrix; moreover, if art=='affine', then705 the first column is omitted since we only want affine706 coordinates707 EXAMPLE: example polymakeToIntmat; shows an example"708 {709 // we need a line break710 string zeilenumbruch="711 ";712 // remove the 'argment' name, i.e. the first row of pm713 while (pm[1]!=zeilenumbruch)714 {715 pm=stringdelete(pm,1);716 }717 pm=stringdelete(pm,1);718 // find out how many entries each vector has, namely one more719 // than 'spaces' in a row720 int i=1;721 int s=1;722 int z=1;723 while (pm[i]!=zeilenumbruch)724 {725 if (pm[i]==" ")726 {727 s++;728 }729 i++;730 }731 // if we want to have affine coordinates732 if (art=="affine")733 {734 s--; // then there is one column less735 // and the entry of the first column (in the first row) has to be removed736 while (pm[1]!=" ")737 {738 pm=stringdelete(pm,1);739 }740 pm=stringdelete(pm,1);741 }742 // we add two line breaks at the end in order to have this as743 // a stopping criterion744 pm=pm+zeilenumbruch+zeilenumbruch;745 // we now have to work through each row746 for (i=1;i<=size(pm);i++)747 {748 // if there are two consecutive line breaks we are done749 if ((pm[i]==zeilenumbruch) and (pm[i+1]==zeilenumbruch))750 {751 i=size(pm)+1;752 }753 else754 {755 // a line break has to be replaced by a comma756 if (pm[i]==zeilenumbruch)757 {758 z++;759 pm[i]=",";760 // if we want to have affine coordinates,761 // then we have to delete the first entry in each row762 if (art=="affine")763 {764 while (pm[i+1]!=" ")765 {766 pm=stringdelete(pm,i+1);767 }768 pm=stringdelete(pm,i+1);769 }770 }771 // a space has to be replaced by a comma772 if (pm[i]==" ")773 {774 pm[i]=",";775 }776 }777 }778 // if we have introduced superflous commata at the end, they should be removed779 while (pm[size(pm)]==",")780 {781 pm=stringdelete(pm,size(pm));782 }783 // since the matrix could be over the rationals,784 // we need a ring with rational coefficients785 ring zwischering=0,x,lp;786 // create the matrix with the elements of pm as entries787 execute("matrix mm["+string(z)+"]["+string(s)+"]="+pm+";");788 // transform this into an integer matrix789 matrix M[1][ncols(mm)]; // takes a row of mm790 int cm; // takes a lowest common multiple791 // multiply each row by an integer such that its entries are integers792 for (int j=1;j<=nrows(mm);j++)793 {794 M=mm[j,1..ncols(mm)];795 cm=commondenominator(M);796 for (i=1;i<=ncols(mm);i++)797 {798 mm[j,i]=cm*mm[j,i];799 }800 }801 // transform the matrix mm into an integer matrix802 execute("intmat im["+string(z)+"]["+string(s)+"]="+string(mm)+";");803 return(im);804 }805 example806 {807 "EXAMPLE:";808 echo=2;809 // this is the usual output of some polymake computation810 string pm="VERTICES811 0 1 3 5/3 1/3 -1 -23/3 -1/3 5/3 1/3 1812 0 1 3 -23/3 5/3 1 5/3 1/3 1/3 -1/3 -1813 0 1 1 1/3 -1/3 -1 5/3 1/3 -23/3 5/3 3814 0 1 1 5/3 -23/3 3 1/3 5/3 -1/3 1/3 -1815 0 1 -1 1/3 5/3 3 -1/3 -23/3 1/3 5/3 1816 0 1 -1 -1/3 1/3 1 1/3 5/3 5/3 -23/3 3817 0 1 -1 1 3 -5 -1 3 -1 1 -1818 0 1 -1 -1 -1 -1 1 1 3 3 -5819 0 1 -5 3 1 -1 3 -1 1 -1 -1820 821 ";822 intmat PM=polymakeToIntmat(pm,"affine");823 // note that the first column has been removed, since we asked for824 // affine coordinates, and the denominators have been cleared825 print(PM);826 }827 828 521 /////////////////////////////////////////////////////////////////////////////// 829 522 /// PROCEDURES USING TOPCOM 830 523 /////////////////////////////////////////////////////////////////////////////// 831 524 832 proc triangulations (list polygon )833 "USAGE: triangulations(polygon ); list polygon525 proc triangulations (list polygon,list #) 526 "USAGE: triangulations(polygon[,#]); list polygon, list # 834 527 ASSUME: polygon is a list of integer vectors of the same size representing 835 528 the affine coordinates of the lattice points … … 846 539 this procedure; see 847 540 @* http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/TOPCOM 541 @* - if you only want to have the regular triangulations the procedure should 542 be called with the string 'regular' as optional argument 848 543 @* - the procedure creates the files /tmp/triangulationsinput and 849 544 /tmp/triangulationsoutput; … … 851 546 output containing the triangulations of corresponding to points in the 852 547 format of points2triangs; if you wish to use this for further 853 computations with topcom, you have to use the procedure854 polymakeKeepTmpFiles in before548 computations with topcom, you have to call the procedure with the 549 string 'keepfiles' as optional argument 855 550 @* - note that an integer i in an integer vector representing a triangle 856 551 refers to the ith lattice point, i.e. polygon[i]; this convention is … … 860 555 { 861 556 int i,j; 557 // check for optional arguments 558 int regular,keepfiles; 559 if (size(#)>0) 560 { 561 for (i=1;i<=size(#);i++) 562 { 563 if (typeof(#[i])=="string") 564 { 565 if (#[i]=="keepfiles") 566 { 567 keepfiles=1; 568 } 569 if (#[i]=="regular") 570 { 571 regular=1; 572 } 573 } 574 } 575 } 862 576 // prepare the input for points2triangs by writing the input polygon in the 863 577 // necessary format … … 875 589 write(":w /tmp/triangulationsinput",spi); 876 590 // call points2triangs 877 system("sh","cd /tmp; points2triangs < triangulationsinput > triangulationsoutput"); 591 if (regular==1) // compute only regular triangulations 592 { 593 system("sh","cd /tmp; points2triangs --regular < triangulationsinput > triangulationsoutput"); 594 } 595 else // compute all triangulations 596 { 597 system("sh","cd /tmp; points2triangs < triangulationsinput > triangulationsoutput"); 598 } 878 599 string p2t=read("/tmp/triangulationsoutput"); // takes result of points2triangs 879 // delete the tmp-files, if polymakekeeptmpfiles is not set880 if ( defined(polymakekeeptmpfiles)==0)600 // delete the tmp-files, if no second argument is given 601 if (keepfiles==0) 881 602 { 882 603 system("sh","cd /tmp; rm -f triangulationsinput; rm -f triangulationsoutput"); … … 953 674 else 954 675 { 955 np2t=np2t+p2t[i]; 676 if (p2t[i]=="[") 677 { 678 // in Topcom version 17.4 (and maybe also in earlier versions) the list 679 // of triangulations is indexed starting with index 0, in Singular 680 // we have to start with index 1 681 np2t=np2t+p2t[i]+"1+"; 682 } 683 else 684 { 685 np2t=np2t+p2t[i]; 686 } 956 687 } 957 688 } … … 962 693 list T; 963 694 execute(np2t); 695 // depending on the version of Topcom, the list T has or has not an entry T[1] 696 // if it has none, the entry should be removed 697 while (typeof(T[1])=="none") 698 { 699 T=delete(T,1); 700 } 964 701 // raise each index by one 965 702 for (i=1;i<=size(T);i++) … … 1000 737 RETURN: list, say L, such that: 1001 738 @* L[1] = intmat, each row gives the affine coordinates of a lattice 1002 point in the secondary polytope given by the marked polytope1003 corresponding to polygon739 point in the secondary polytope given by the marked 740 polytope corresponding to polygon 1004 741 @* L[2] = the list of corresponding triangulations 1005 742 NOTE: if the triangluations are not handed over as optional argument the … … 1114 851 see http://www.math.tu-berlin.de/polymake/ 1115 852 @* - in the optional argument # it is possible to hand over other names for 1116 the variables to be used -- be careful, the format must be correct 1117 whichis not tested, e.g. if you want the variable names to be853 the variables to be used -- be careful, the format must be correct and 854 that is not tested, e.g. if you want the variable names to be 1118 855 u00,u10,u01,u11 then you must hand over the string 'u11,u10,u01,u11' 1119 856 @* - if the triangluations are not handed over as optional argument the … … 1135 872 list sp=secondaryPolytope(polygon,triang); 1136 873 list spp=polymakePolytope(sp[1]); 1137 list sf=normalFan (spp[1],spp[4],spp[3],1);874 list sf=normalFanL(spp[1],spp[4],spp[3],1); 1138 875 return(list(sf[1],sf[2],spp,triang)); 1139 876 } … … 1378 1115 @* triang is a list of integer vectors all of size three describing a 1379 1116 triangulation of the polygon described by polygon; if an entry of 1380 triang is the vector (i,j,k) then the triangle is built fromthe vertices1117 triang is the vector (i,j,k) then the triangle is built by the vertices 1381 1118 with indices i, j and k 1382 1119 RETURN: intvec, the integer vector eta describing that vertex of the Newton … … 1948 1685 // points and 1949 1686 // the number b of boundary points are connected by the formula: A=b+2g-2 1950 return(list(area,bdpts,(area-bdpts+2) /2));1687 return(list(area,bdpts,(area-bdpts+2) div 2)); 1951 1688 } 1952 1689 example … … 1973 1710 "USAGE: ellipticNF(polygon); polygon list 1974 1711 ASSUME: polygon is a list of integer vectors in the plane such that their 1975 convex hull C has precisely one interior lattice point ,i.e. C is the1712 convex hull C has precisely one interior lattice point; i.e. C is the 1976 1713 Newton polygon of an elliptic curve 1977 1714 PURPOSE: compute the normal form of the polygon with respect to the unimodular … … 1991 1728 int i; // index 1992 1729 intvec edge; // stores the vector of an edge 1993 intvec boundary; // stores lattice lengths of the edges of the Newton cy lce1730 intvec boundary; // stores lattice lengths of the edges of the Newton cycle 1994 1731 // find the vertices of the Newton cycle and order it clockwise 1995 1732 list pg=findOrientedBoundary(polygon)[2]; … … 2302 2039 2303 2040 ///////////////////////////////////////////////////////////////////////////////// 2304 /// AUXILARY PROCEDURES2305 /////////////////////////////////////////////////////////////////////////////////2306 2307 proc polymakeKeepTmpFiles (int i)2308 "USAGE: polymakeKeepTmpFiles(int i); i int2309 PURPOSE: some procedures create files in the directory /tmp which are used for2310 computations with polymake respectively topcom; these will be removed2311 when the corresponding procedure is left; however, it might be2312 desireable to keep them for further computations with either polymake or2313 topcom; this can be achieved by this procedure; call the procedure as:2314 @* - polymakeKeepTmpFiles(1); - then the files will be kept2315 @* - polymakeKeepTmpFiles(0); - then files will be removed in the future2316 RETURN: none"2317 {2318 if ((i==1) and (defined(polymakekeeptmpfiles)==0))2319 {2320 int polymakekeeptmpfiles;2321 export(polymakekeeptmpfiles);2322 }2323 if (i!=1)2324 {2325 if (defined(polymakekeeptmpfiles))2326 {2327 kill polymakekeeptmpfiles;2328 }2329 }2330 }2331 2332 2333 /////////////////////////////////////////////////////////////////////////////////2334 2041 ///////////////////////////////////////////////////////////////////////////////// 2335 2042 /// AUXILARY PROCEDURES, WHICH ARE DECLARED STATIC … … 2364 2071 } 2365 2072 2366 static proc intmatcoldelete ( intmatw,int i)2073 static proc intmatcoldelete (def w,int i) 2367 2074 "USAGE: intmatcoldelete(w,i); w intmat, i int 2368 2075 RETURN: intmat, the integer matrix w with the ith comlumn deleted 2369 NOTE: the procedure is called by intmatsort and normalFan" 2370 { 2371 if ((i<1) or (i>ncols(w)) or (ncols(w)==1)) 2372 { 2373 return(w); 2374 } 2375 if (i==1) 2376 { 2377 intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),2..ncols(w)]; 2378 return(M); 2379 } 2380 if (i==ncols(w)) 2381 { 2382 intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),1..ncols(w)-1]; 2383 return(M); 2384 } 2385 else 2386 { 2387 intmat M[nrows(w)][i-1]=w[1..nrows(w),1..i-1]; 2388 intmat N[nrows(w)][ncols(w)-i]=w[1..nrows(w),i+1..ncols(w)]; 2389 return(intmatconcat(M,N)); 2076 NOTE: the procedure is called by intmatsort and normalFanL" 2077 { 2078 if (typeof(w)=="intmat") 2079 { 2080 if ((i<1) or (i>ncols(w)) or (ncols(w)==1)) 2081 { 2082 return(w); 2083 } 2084 if (i==1) 2085 { 2086 intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),2..ncols(w)]; 2087 return(M); 2088 } 2089 if (i==ncols(w)) 2090 { 2091 intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),1..ncols(w)-1]; 2092 return(M); 2093 } 2094 else 2095 { 2096 intmat M[nrows(w)][i-1]=w[1..nrows(w),1..i-1]; 2097 intmat N[nrows(w)][ncols(w)-i]=w[1..nrows(w),i+1..ncols(w)]; 2098 return(intmatconcat(M,N)); 2099 } 2100 } 2101 if (typeof(w)=="bigintmat") 2102 { 2103 if ((i<1) or (i>ncols(w)) or (ncols(w)==1)) 2104 { 2105 return(w); 2106 } 2107 if (i==1) 2108 { 2109 bigintmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),2..ncols(w)]; 2110 return(M); 2111 } 2112 if (i==ncols(w)) 2113 { 2114 bigintmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),1..ncols(w)-1]; 2115 return(M); 2116 } 2117 else 2118 { 2119 bigintmat MN[nrows(w)][ncols(w)-1]; 2120 MN[1..nrows(w),1..i-1]=w[1..nrows(w),1..i-1]; 2121 MN[1..nrows(w),i..ncols(w)-1]=w[1..nrows(w),i+1..ncols(w)]; 2122 return(MN); 2123 } 2124 } else 2125 { 2126 ERROR("intmatcoldelete: input matrix has to be of type intmat or bigintmat"); 2127 intmat M; return(M); 2390 2128 } 2391 2129 } … … 2683 2421 return(list(coord,coords,latex)); 2684 2422 } 2423 2424 static proc intmatAddFirstColumn (def M,string art) 2425 "USAGE: intmatAddFirstColumn(M,art); M intmat, art string 2426 ASSUME: - M is an integer matrix where a first column of 0's or 1's should be added 2427 @* - art is one of the following strings: 2428 @* + 'rays' : indicating that a first column of 0's should be added 2429 @* + 'points' : indicating that a first column of 1's should be added 2430 RETURN: intmat, a first column has been added to the matrix" 2431 { 2432 if (typeof (M) == "intmat") 2433 { 2434 intmat N[nrows(M)][ncols(M)+1]; 2435 int i,j; 2436 for (i=1;i<=nrows(M);i++) 2437 { 2438 if (art=="rays") 2439 { 2440 N[i,1]=0; 2441 } 2442 else 2443 { 2444 N[i,1]=1; 2445 } 2446 for (j=1;j<=ncols(M);j++) 2447 { 2448 N[i,j+1]=M[i,j]; 2449 } 2450 } 2451 return(N); 2452 } 2453 if (typeof (M) == "bigintmat") 2454 { 2455 bigintmat N[nrows(M)][ncols(M)+1]; 2456 int i,j; 2457 for (i=1;i<=nrows(M);i++) 2458 { 2459 if (art=="rays") 2460 { 2461 N[i,1]=0; 2462 } 2463 else 2464 { 2465 N[i,1]=1; 2466 } 2467 for (j=1;j<=ncols(M);j++) 2468 { 2469 N[i,j+1]=M[i,j]; 2470 } 2471 } 2472 return(N); 2473 } 2474 else 2475 { 2476 ERROR ("intmatAddFirstColumn: input matrix has to be either intmat or bigintmat"); 2477 intmat N; 2478 return (N); 2479 } 2480 } 2481 2482 2483 -
Singular/LIB/tropical.lib
r27877c re57255 1 // /////////////////////////////////////////////////////////2 version=" version tropical.lib 4.0.0.0 Jun_2013 "; // $Id$1 // 2 version="$Id$"; 3 3 category="Tropical Geometry"; 4 4 info=" … … 650 650 // pass first to a ring where a and @a 651 651 // are variables in order to use maps 652 string @mp= string(minpoly);652 poly mp=minpoly; 653 653 ring INTERRING=char(LIFTRING),(t,@a,a),dp; 654 execute("poly mp=" + @mp + ";");654 poly mp=imap(LIFTRING,mp); 655 655 ideal LIFT=imap(LIFTRING,LIFT); 656 656 kill LIFTRING; … … 1012 1012 { 1013 1013 def GLOBALRING=basering; 1014 string @mp= string(minpoly);1014 number mp=minpoly; 1015 1015 execute("ring LOCALRING=("+charstr(basering)+"),("+varstr(basering)+"),ds;"); 1016 execute("minpoly= " + @mp + ";");1017 1016 poly f=imap(GLOBALRING,f); 1017 minpoly=imap(GLOBALRING,mp); 1018 1018 } 1019 1019 // check if a substitution is necessary … … 1049 1049 if (minpoly!=0) 1050 1050 { 1051 string @mp= string(minpoly);1051 poly mp=minpoly; 1052 1052 def OLDRING=basering; 1053 1053 execute("ring NEWRING=0,("+varstr(basering)+","+parstr(basering)+"),ds;"); 1054 execute("ideal I = " + @mp + ";"); 1055 I = I,imap(OLDRING,f); 1054 ideal I=imap(OLDRING,mp),imap(OLDRING,f); 1056 1055 } 1057 1056 else … … 1065 1064 w=NewtP[jj]-NewtP[jj+1]; 1066 1065 ggteiler=gcd(w[1],w[2]); 1067 zw=w[1] /ggteiler;1068 w[1]=w[2] /ggteiler;1066 zw=w[1] div ggteiler; 1067 w[1]=w[2] div ggteiler; 1069 1068 w[2]=zw; 1070 1069 // if we have introduced a third variable for the parameter, then w needs a third component … … 1134 1133 else 1135 1134 { 1136 string @mp= string(minpoly);1135 poly mp=minpoly; 1137 1136 ring degreering=0,a,dp; 1138 execute("poly mp=" + @mp + ";");1137 poly mp=imap(countring,mp); 1139 1138 numberofbranchesfound=numberofbranchesfound+deg(mp); 1140 1139 setring countring; … … 1158 1157 ring r=0,(x,y),ds; 1159 1158 poly f=x2-y4+x5y7; 1160 puiseuxExpansion(puiseuxExpansion(f,3)); 1159 puiseuxExpansion(f,3,"subst"); 1160 displayPuiseuxExpansion(puiseuxExpansion(f,3)); 1161 1161 } 1162 1162 … … 1540 1540 ggt=gcd(normalvector[1],normalvector[2]); // the gcd of the entries 1541 1541 zw=normalvector[2]; // create the outward pointing normal vector 1542 normalvector[2]=-normalvector[1] /ggt;1543 normalvector[1]=zw /ggt;1542 normalvector[2]=-normalvector[1] div ggt; 1543 normalvector[1]=zw div ggt; 1544 1544 if (size(#)==0) // we are computing w.r.t. minimum 1545 1545 { … … 2718 2718 if(k<>j) // except the unit vector of the non-zero component 2719 2719 { 2720 intvec u; u[size(w)]=0; u[k]=1; 2721 O[r,1..size(w)]=u; r=r+1; 2720 intvec u; 2721 u[size(w)]=0; 2722 u[k]=1; 2723 O[r,1..size(w)]=u; 2724 r=r+1; 2725 kill u; 2722 2726 } 2723 2727 } … … 4708 4712 wneu=NewtP[1]-NewtP[2]; 4709 4713 int ggteiler=gcd(wneu[1],wneu[2]); 4710 wneu[1]=-wneu[1] /ggteiler;4711 wneu[2]=wneu[2] /ggteiler;4714 wneu[1]=-wneu[1] div ggteiler; 4715 wneu[2]=wneu[2] div ggteiler; 4712 4716 if (wneu[1]>0) 4713 4717 { … … 4807 4811 for (jj=1;jj<=anzahlvariablen+numberdeletedvariables-1;jj++) 4808 4812 { 4809 PARA[jj]=(PARA[jj]+a[jj+1])*t^(tw[jj+1]*tweight /ww[1]);4813 PARA[jj]=(PARA[jj]+a[jj+1])*t^(tw[jj+1]*tweight div ww[1]); 4810 4814 } 4811 4815 // if we have reached the stop-level, i.e. either … … 5353 5357 if (koeffizienten[j-ord(p)+1]!=0) 5354 5358 { 5355 if ((j-(N*wj) /w1)==0)5359 if ((j-(N*wj) div w1)==0) 5356 5360 { 5357 5361 dp=dp+displaycoef(koeffizienten[j-ord(p)+1]); 5358 5362 } 5359 if (((j-(N*wj) /w1)==1) and (N!=1))5363 if (((j-(N*wj) div w1)==1) and (N!=1)) 5360 5364 { 5361 5365 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*t^(1/"+string(N)+")"; 5362 5366 } 5363 if (((j-(N*wj) /w1)==1) and (N==1))5367 if (((j-(N*wj) div w1)==1) and (N==1)) 5364 5368 { 5365 5369 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*t"; 5366 5370 } 5367 if (((j-(N*wj) /w1)==-1) and (N==1))5371 if (((j-(N*wj) div w1)==-1) and (N==1)) 5368 5372 { 5369 5373 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*1/t"; 5370 5374 } 5371 if (((j-(N*wj) /w1)==-1) and (N!=1))5375 if (((j-(N*wj) div w1)==-1) and (N!=1)) 5372 5376 { 5373 5377 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*1/t^(1/"+string(N)+")"; 5374 5378 } 5375 if (((j-(N*wj) /w1)>1) and (N==1))5376 { 5377 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*t^"+string(j-(N*wj) /w1);5378 } 5379 if (((j-(N*wj) /w1)>1) and (N!=1))5380 { 5381 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*t^("+string(j-(N*wj) /w1)+"/"+string(N)+")";5382 } 5383 if (((j-(N*wj) /w1)<-1) and (N==1))5379 if (((j-(N*wj) div w1)>1) and (N==1)) 5380 { 5381 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*t^"+string(j-(N*wj) div w1); 5382 } 5383 if (((j-(N*wj) div w1)>1) and (N!=1)) 5384 { 5385 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*t^("+string(j-(N*wj) div w1)+"/"+string(N)+")"; 5386 } 5387 if (((j-(N*wj) div w1)<-1) and (N==1)) 5384 5388 { 5385 5389 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*1/t^"+string(wj-j); 5386 5390 } 5387 if (((j-(N*wj) /w1)<-1) and (N!=1))5388 { 5389 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*1/t^("+string((N*wj) /w1-j)+"/"+string(N)+")";5391 if (((j-(N*wj) div w1)<-1) and (N!=1)) 5392 { 5393 dp=dp+displaycoef(koeffizienten[j-ord(p)+1])+"*1/t^("+string((N*wj) div w1-j)+"/"+string(N)+")"; 5390 5394 } 5391 5395 if (j<deg(p)) … … 5495 5499 { 5496 5500 setring LIFTRing; 5497 string @mp= string(minpoly);5501 poly mp=minpoly; 5498 5502 execute("ring TESTRing=("+charstr(LIFTRing)+"),("+varstr(BASERING)+"),dp;"); 5499 execute("minpoly= " + @mp + ";");5503 minpoly=number(imap(LIFTRing,mp)); 5500 5504 ideal i=imap(BASERING,i); 5501 5505 } … … 5769 5773 wneu=NewtP[jjj]-NewtP[jjj+1]; 5770 5774 int ggteiler=gcd(wneu[1],wneu[2]); 5771 wneu[1]=-wneu[1] /ggteiler;5772 wneu[2]=wneu[2] /ggteiler;5775 wneu[1]=-wneu[1] div ggteiler; 5776 wneu[2]=wneu[2] div ggteiler; 5773 5777 if (wneu[1]>0) 5774 5778 { … … 5869 5873 { 5870 5874 execute("ring PARARing=("+string(char(basering))+",@a),t,ls;"); 5871 minpoly=number(imap(PREGFANRING,m)); // ?5875 minpoly=number(imap(PREGFANRING,m)); 5872 5876 } 5873 5877 else … … 5908 5912 for (jjj=1;jjj<=anzahlvariablen+numberdeletedvariables-1;jjj++) 5909 5913 { 5910 PARA[jjj]=(PARA[jjj]+zeros[size(zeros)][jjj+1])*t^(ww[jjj+1]*tweight /ww[1]);5914 PARA[jjj]=(PARA[jjj]+zeros[size(zeros)][jjj+1])*t^(ww[jjj+1]*tweight div ww[1]); 5911 5915 } 5912 5916 // delete the last entry in zero, since that one has … … 6033 6037 { 6034 6038 I=subst(i,var(lastvar),0); 6035 while ( subst(I[1],t,0)==0)6039 while ((I[1]!=0) and (subst(I[1],t,0)==0)) 6036 6040 { 6037 6041 I[1]=I[1]/t; … … 7814 7818 poly denom=delta*hn^5; 7815 7819 poly ggt=gcd(num,denom); 7816 num=num /ggt;7817 denom=denom /ggt;7820 num=num div ggt; 7821 denom=denom div ggt; 7818 7822 setring BASERING; 7819 7823 poly num=imap(TRING,num); -
Singular/ipid.cc
r9e8ae12 re57255 433 433 else if ((IDTYP(h)==RING_CMD)||(IDTYP(h)==QRING_CMD)) 434 434 rKill(h); 435 else 435 else if (IDDATA(h)!=NULL) 436 436 s_internalDelete(IDTYP(h),IDDATA(h),r); 437 437 // general ------------------------------------------------------------- -
Singular/singular-libs
r27877c re57255 23 23 paraplanecurves.lib phindex.lib \ 24 24 pointid.lib poly.lib \ 25 oldpolymake.lib presolve.lib primdec.lib primdecint.lib \25 polymake.lib presolve.lib primdec.lib primdecint.lib \ 26 26 primitiv.lib qhmoduli.lib random.lib realclassify.lib \ 27 27 realrad.lib reesclos.lib resbinomial.lib \ … … 57 57 ncfactor.lib nctools.lib perron.lib qmatrix.lib \ 58 58 ncall.lib 59 60 59 60 -
Singular/subexpr.cc
r9e8ae12 re57255 455 455 void s_internalDelete(const int t, void *d, const ring r) 456 456 { 457 assume(d!=NULL); 457 458 switch (t) 458 459 { -
Tst/Short/bug_newstruct.res.gz.uu
r9e8ae12 re57255 1 1 begin 640 bug_newstruct.res.gz 2 M'XL(" )/1P5$``V)U9U]N97=S=')U8W0N<F5S`)6236O"0!"&[_D5+\%#`A+=3 M JJUMZI86+P$1P=*K^=K(0K*1_6CIO^_&F(W7GG9FWOEXAMGCYS;9`R`4N^0#4 M OE8ZJGGNQ][QICQ0V.")"ZZ#,/:Z%Y0B-^>38#]*2U/HR%J1TIEV50L*9R\C5 M S&9PR5#:5)535]$H!?ZEY-]<M=*?^C57-M<T329*-471"@:=\=H/1[C'NS%/6 M $:XENU%>T[ZLB#WKO2'MO!1<P8B255RPLA>8E*U$6Q1&2E:""U@W9U4K&?IF7 M M4W&^J5O81NF;L@SQ4"-@YM-YA2':,#?C%"$=$*WR&;`*C(!T6ID2O&SP"398 M ?[WODNTDF(?0+1K6Y,S25="_%W9=,EBN%N&_T`FQ[&ZNHR?VO!;Z&G[M.E//9 =,=_\(?/NI,2>M/L4W<F-"D@83[P_D)E)>TH"````2 M'XL("+JRJ5(``V)U9U]N97=S=')U8W0N<F5S`)62RVK#,!!%]_Z*B\G"AN!$ 3 M;=JF=:/2DHTAA$!*MXD?<A#84I#DEOY]I3B6L^U*,W/G<8;1_G.=;0$0BDWV 4 M@=!HDS2\"--@?U7N*&SPP`4W49P&[@6E*+K30;`?;517FL1:B3:Y\57W%-Y> 5 M))C-X).A35?77GU(1BD*SQ7_YEJJ<!HV7-O<KFUS4>DI2BD83,Z;,![A'F_& 6 M/"6XE&Q&>4G[LC(-K/>&H_..X!J=J%C-!:MZ@2DE%619=DJQ"ES`N@6KI6+H 7 MFS4V&<N7OH5M>/1#GBD&:NS\;#*GV"4#_FJ$(L0);I'5@%7F`D(:Y%KSD\`D 8 MVWZ];[+U))K',!(M:PMFZ6J8WS.[+!DM'A;QO]`)L>Q^KJ<G]KP6^A)^=9UI 9 >X)FO_I!Y<U)B3^H^A3MYIR,2IY/@#R.]3(I*`@`` 10 10 ` 11 11 end -
Tst/Short/polymake.tst
r27877c re57255 3 3 LIB "tst.lib"; 4 4 tst_init(); 5 LIB " oldpolymake.lib"; // TODO: update test result!5 LIB "polymake.lib"; 6 6 /////////////////////////////////////////////////////////////////////////// 7 7 // A) Test for Procedures using Polymake 8 8 /////////////////////////////////////////////////////////////////////////// 9 9 example polymakePolytope; 10 example newtonPolytope ;10 example newtonPolytopeP; 11 11 example newtonPolytopeLP; 12 example normalFan ;12 example normalFanL; 13 13 example groebnerFan; 14 example intmatToPolymake;15 example polymakeToIntmat;16 14 /////////////////////////////////////////////////////////////////////////// 17 15 // B) Test for Procedures using Topcom -
debian/changelog
r9e8ae12 re57255 1 singular ( 3.1.3.sw-1) unstable; urgency=low1 singular (4.0.0-1) unstable; urgency=low 2 2 3 3 * Initial release. -
doc/COPYING.texi
r27877c re57255 131 131 @copyright{} Winfried Bruns and Bogdan Ichim 132 132 @* @uref{http://www.mathematik.uni-osnabrueck.de/normaliz/} 133 @item polymake (used by oldpolymake.lib, @pxref{oldpolymake_lib})133 @item polymake (used by polymake.lib, @pxref{polymake_lib}) 134 134 @copyright{} Ewgenij Gawrilow and Michael Joswig 135 135 @* @uref{http://www.polymake.de/} … … 142 142 @copyright{} Oliver Labs (2001-2008), Stephan Holzer (2004-2005) 143 143 @* @uref{http://surfex.AlgebraicSurface.net} 144 @item TOPCOM (used by oldpolymake.lib, @pxref{oldpolymake_lib})144 @item TOPCOM (used by polymake.lib, @pxref{polymake_lib}) 145 145 @copyright{} J@"org Rambau 146 146 @* @uref{http://www.rambau.wm.uni-bayreuth.de/TOPCOM/} -
doc/Makefile.bsp
r27877c re57255 63 63 CHKSUM_DB = ${DOC_SUBDIR}/chksum 64 64 # which tags to avoid: 65 DOC2TEX_EXAMPLE_EXCLUSIONS = -exclude oldpolymake65 DOC2TEX_EXAMPLE_EXCLUSIONS = -exclude polymake 66 66 # which tags to avoid: 67 TAG = oldpolymake67 TAG = polymake 68 68 DOC2TEX = ${PERL} ./doc2tex.pl -docdir ${DOC_SUBDIR} \ 69 69 -Singular ${SINGULAR} -verbose ${VERBOSE} -make ${MAKE} \ -
doc/NEWS.texi
r9e8ae12 re57255 42 42 @itemize 43 43 @item @nref{sba}: an F5 like Groebner base computation 44 @item @nref{ASSUME}: support for debugging libraries 44 45 @end itemize 45 46 … … 47 48 @itemize 48 49 @item @nref{classifyci_lib}: Isolated complete intersection singularities in characteristic 0 49 @item @ xref{schubert_lib}: Proceduces for Intersection Theory50 @item @nref{derham_lib}: Computation of deRham cohomology 50 51 @end itemize 51 52 … … 54 55 @item 55 56 improved grobcov.lib (@nref{grobcov_lib}) 57 @item 58 fixed normal.lib (@nref{normal_lib}) 56 59 @end itemize 57 60 -
kernel/kstd1.cc
r9e8ae12 re57255 2969 2969 2970 2970 // enter into S, L, and T 2971 //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp)) 2971 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp)) 2972 { 2972 2973 enterT(strat->P, strat); 2973 // posInS only depends on the leading term 2974 strat->enterS(strat->P, pos, strat, strat->tl); 2975 2974 // posInS only depends on the leading term 2975 strat->enterS(strat->P, pos, strat, strat->tl); 2976 2977 if (pos<strat->sl) 2978 { 2979 need_retry++; 2980 // move all "larger" elements fromS to L 2981 // remove them from T 2982 int ii=pos+1; 2983 for(;ii<=strat->sl;ii++) 2984 { 2985 LObject h; 2986 memset(&h,0,sizeof(h)); 2987 h.tailRing=strat->tailRing; 2988 h.p=strat->S[ii]; strat->S[ii]=NULL; 2989 strat->initEcart(&h); 2990 h.sev=strat->sevS[ii]; 2991 int jj=strat->tl; 2992 while (jj>=0) 2993 { 2994 if (strat->T[jj].p==h.p) 2995 { 2996 strat->T[jj].p=NULL; 2997 if (jj<strat->tl) 2998 { 2999 memmove(&(strat->T[jj]),&(strat->T[jj+1]), 3000 (strat->tl-jj)*sizeof(strat->T[jj])); 3001 memmove(&(strat->sevT[jj]),&(strat->sevT[jj+1]), 3002 (strat->tl-jj)*sizeof(strat->sevT[jj])); 3003 } 3004 strat->tl--; 3005 break; 3006 } 3007 jj--; 3008 } 3009 int lpos=strat->posInL(strat->L,strat->Ll,&h,strat); 3010 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,lpos); 3011 #ifdef KDEBUG 3012 if (TEST_OPT_DEBUG) 3013 { 3014 Print("move S[%d] -> L[%d]: ",ii,pos); 3015 p_wrp(h.p,currRing, strat->tailRing); 3016 PrintLn(); 3017 } 3018 #endif 3019 } 3020 if (strat->fromQ!=NULL) 3021 { 3022 for(ii=pos+1;ii<=strat->sl;ii++) strat->fromQ[ii]=0; 3023 } 3024 strat->sl=pos; 3025 } 3026 } 3027 else 3028 { 3029 // clean P 3030 } 2976 3031 if (strat->P.lcm!=NULL) 2977 3032 #ifdef HAVE_RINGS … … 2980 3035 pLmFree(strat->P.lcm); 2981 3036 #endif 2982 if (pos<strat->sl)2983 {2984 need_retry++;2985 // move all "larger" elements fromS to L2986 // remove them from T2987 int ii=pos+1;2988 for(;ii<=strat->sl;ii++)2989 {2990 LObject h;2991 memset(&h,0,sizeof(h));2992 h.tailRing=strat->tailRing;2993 h.p=strat->S[ii]; strat->S[ii]=NULL;2994 strat->initEcart(&h);2995 h.sev=strat->sevS[ii];2996 int jj=strat->tl;2997 while (jj>=0)2998 {2999 if (strat->T[jj].p==h.p)3000 {3001 strat->T[jj].p=NULL;3002 if (jj<strat->tl)3003 {3004 memmove(&(strat->T[jj]),&(strat->T[jj+1]),3005 (strat->tl-jj)*sizeof(strat->T[jj]));3006 memmove(&(strat->sevT[jj]),&(strat->sevT[jj+1]),3007 (strat->tl-jj)*sizeof(strat->sevT[jj]));3008 }3009 strat->tl--;3010 break;3011 }3012 jj--;3013 }3014 int lpos=strat->posInL(strat->L,strat->Ll,&h,strat);3015 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,lpos);3016 #ifdef KDEBUG3017 if (TEST_OPT_DEBUG)3018 {3019 Print("move S[%d] -> L[%d]: ",ii,pos);3020 p_wrp(h.p,currRing, strat->tailRing);3021 PrintLn();3022 }3023 #endif3024 }3025 if (strat->fromQ!=NULL)3026 {3027 for(ii=pos+1;ii<=strat->sl;ii++) strat->fromQ[ii]=0;3028 }3029 strat->sl=pos;3030 }3031 3037 } 3032 3038 -
kernel/kstd2.cc
r9e8ae12 re57255 1390 1390 1391 1391 // enter into S, L, and T 1392 //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp)) 1392 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp)) 1393 { 1393 1394 enterT(strat->P, strat); 1394 1395 #ifdef HAVE_RINGS 1395 if (rField_is_Ring(currRing))1396 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);1397 else1398 #endif 1399 enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);1400 // posInS only depends on the leading term1401 strat->enterS(strat->P, pos, strat, strat->tl);1396 if (rField_is_Ring(currRing)) 1397 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl); 1398 else 1399 #endif 1400 enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl); 1401 // posInS only depends on the leading term 1402 strat->enterS(strat->P, pos, strat, strat->tl); 1402 1403 #if 0 1403 int pl=pLength(strat->P.p); 1404 if (pl==1) 1405 { 1406 //if (TEST_OPT_PROT) 1407 //PrintS("<1>"); 1408 } 1409 else if (pl==2) 1410 { 1411 //if (TEST_OPT_PROT) 1412 //PrintS("<2>"); 1413 } 1414 #endif 1404 int pl=pLength(strat->P.p); 1405 if (pl==1) 1406 { 1407 //if (TEST_OPT_PROT) 1408 //PrintS("<1>"); 1409 } 1410 else if (pl==2) 1411 { 1412 //if (TEST_OPT_PROT) 1413 //PrintS("<2>"); 1414 } 1415 #endif 1416 } 1415 1417 if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat); 1416 1418 // Print("[%d]",hilbeledeg); … … 2449 2451 // enter into S, L, and T 2450 2452 // here we need to recompute new signatures, but those are trivial ones 2451 //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp)) 2452 enterT(strat->P, strat); 2453 // posInS only depends on the leading term 2454 strat->enterS(strat->P, pos, strat, strat->tl); 2453 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp)) 2454 { 2455 enterT(strat->P, strat); 2456 // posInS only depends on the leading term 2457 strat->enterS(strat->P, pos, strat, strat->tl); 2455 2458 //#if 1 2456 2459 #ifdef DEBUGF5 2457 Print("ELEMENT ADDED TO GCURR DURING INTERRED: "); 2458 pWrite(pHead(strat->S[strat->sl])); 2459 pWrite(strat->sig[strat->sl]); 2460 #endif 2461 if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat); 2460 Print("ELEMENT ADDED TO GCURR DURING INTERRED: "); 2461 pWrite(pHead(strat->S[strat->sl])); 2462 pWrite(strat->sig[strat->sl]); 2463 #endif 2464 if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat); 2465 } 2462 2466 // Print("[%d]",hilbeledeg); 2463 2467 if (strat->P.lcm!=NULL)
Note: See TracChangeset
for help on using the changeset viewer.