Changeset 7c9f0a in git
- Timestamp:
- Apr 9, 2021, 11:54:02 AM (3 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- ff30479213ec6f49a52f9a793cdd7b65e3c30424
- Parents:
- a7810b57c14fea04f2790361401e05441ed10540
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/polymake.lib
ra7810b5 r7c9f0a 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="version polymake.lib 4. 1.2.0 Feb_2019";2 version="version polymake.lib 4.2.0.1 Apr_2021 "; 3 3 category="Tropical Geometry"; 4 4 info=" 5 5 LIBRARY: polymake.lib Computations with polytopes and fans, 6 interface to polymake andTOPCOM6 interface to TOPCOM 7 7 AUTHOR: Thomas Markwig, email: keilen@mathematik.uni-kl.de 8 8 Yue Ren, email: ren@mathematik.uni-kl.de … … 25 25 such as the Newton polytope or the Groebner fan of a polynomial, most of 26 26 the hard computations are NOT done by Singular but by the program 27 @* - polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt28 (see @uref{http://www.polymake.org/}),29 @* respectively (only in the procedure triangulations) by the program30 27 @* - topcom by Joerg Rambau, Universitaet Bayreuth (see 31 28 @uref{http://www.rambau.wm.uni-bayreuth.de/TOPCOM/}); 32 29 @* this library should rather be seen as an interface which allows to use a 33 (very limited) number of options which polymake respectivelytopcom offers30 (very limited) number of options which topcom offers 34 31 to compute with polytopes and fans and to make the results available in 35 32 Singular for further computations; 36 33 moreover, the user familiar with Singular does not have to learn the syntax 37 of polymake ortopcom, if the options offered here are sufficient for his34 of topcom, if the options offered here are sufficient for his 38 35 purposes. 39 36 @* Note, though, that the procedures concerned with planar polygons are 40 independent of both, polymake andtopcom.37 independent of topcom. 41 38 @end texinfo 42 43 PROCEDURES USING POLYMAKE:44 polymakePolytope() computes the vertices of a polytope using polymake45 newtonPolytopeP() computes the Newton polytope of a polynomial46 newtonPolytopeLP() computes the lattice points of the Newton polytope47 39 48 40 PROCEDURES USING TOPCOM: … … 50 42 secondaryPolytope() computes the secondary polytope of a marked polytope 51 43 52 PROCEDURES CON ERNED WITH PLANAR POLYGONS:44 PROCEDURES CONCERNED WITH PLANAR POLYGONS: 53 45 cycleLength() computes the cycleLength of cycle 54 46 splitPolygon() splits a marked polygon into vertices, facets, interior points … … 61 53 ellipticNFDB() displays the 16 normal forms of elliptic polygons 62 54 63 PROCEDURES USING LIBPOLYMAKE: 64 boundaryLatticePoints() 65 ehrhartPolynomialCoeff() 66 fVectorP() 67 facetVertexLatticeDistances() 68 facetWidth() 69 facetWidths() 70 gorensteinIndex() 71 gorensteinVector() 72 hStarVector() 73 hVector() 74 hilbertBasis() 75 interiorLatticePoints() 76 isBounded() 77 isCanonical() 78 isCompressed() 79 isGorenstein() 80 isLatticeEmpty() 81 isNormal() 82 isReflexive() 83 isSmooth() 84 isTerminal() 85 isVeryAmple() 86 latticeCodegree() 87 latticeDegree() 88 latticePoints() 89 latticeVolume() 90 maximalFace() 91 maximalValue() 92 minimalFace() 93 minimalValue() 94 minkowskiSum() 95 nBoundaryLatticePoints() 96 nHilbertBasis() 97 nInteriorLatticePoints() 98 nLatticePoints() 99 normalFan() 100 vertexAdjacencyGraph() 101 vertexEdgeGraph() 102 visual() 103 104 KEYWORDS: polytope; fan; secondary fan; secondary polytope; polymake; 55 KEYWORDS: polytope; fan; secondary fan; secondary polytope; 105 56 Newton polytope; Groebner fan 106 57 "; … … 137 88 load("polymake.so","try"); 138 89 option(set,save); 139 }140 141 /////////////////////////////////////////////////////////////////////////////142 /// PROCEDURES USING POLYMAKE143 /////////////////////////////////////////////////////////////////////////////144 145 proc polymakePolytope (intmat points)146 "USAGE: polymakePolytope(points); polytope intmat147 ASSUME: each row of points gives the coordinates of a lattice point of a148 polytope with their affine coordinates as given by the output of149 secondaryPolytope150 PURPOSE: the procedure calls polymake to compute the vertices of the polytope151 as well as its dimension and information on its facets152 RETURN: list, L with four entries153 @* L[1] : an integer matrix whose rows are the coordinates of vertices154 of the polytope155 @* L[2] : the dimension of the polytope156 @* L[3] : a list whose ith entry explains to which vertices the157 ith vertex of the Newton polytope is connected158 -- i.e. L[3][i] is an integer vector and an entry k in159 there means that the vertex L[1][i] is connected to the160 vertex L[1][k]161 @* L[4] : an matrix of type bigintmat whose rows multiplied by162 (1,var(1),...,var(nvar)) give a linear system of equations163 describing the affine hull of the polytope,164 i.e. the smallest affine space containing the polytope165 NOTE: - for its computations the procedure calls the program polymake by166 Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt;167 it therefore is necessary that this program is installed in order168 to use this procedure;169 see http://www.polymake.org/170 @* - note that in the vertex edge graph we have changed the polymake171 convention which starts indexing its vertices by zero while we start172 with one !173 EXAMPLE: example polymakePolytope; shows an example"174 {175 // add a first column to polytope as homogenising coordinate176 points=intmatAddFirstColumn(points,"points");177 polytope polytop=polytopeViaPoints(points);178 list graph=vertexAdjacencyGraph(polytop)[2];179 int i,j;180 for (i=1;i<=size(graph);i++)181 {182 for (j=1;j<=size(graph[i]);j++)183 {184 graph[i][j]=graph[i][j]+1;185 }186 }187 return(list(intmatcoldelete(vertices(polytop),1),dimension(polytop),graph,equations(polytop)));188 }189 example190 {191 "EXAMPLE:";192 echo=2;193 // the lattice points of the unit square in the plane194 list points=intvec(0,0),intvec(0,1),intvec(1,0),intvec(1,1);195 // the secondary polytope of this lattice point configuration is computed196 intmat secpoly=secondaryPolytope(points)[1];197 list np=polymakePolytope(secpoly);198 // the vertices of the secondary polytope are:199 np[1];200 // its dimension is201 np[2];202 // np[3] contains information how the vertices are connected to each other,203 // e.g. the first vertex (number 0) is connected to the second one204 np[3][1];205 // the affine hull has the equation206 ring r=0,x(1..4),dp;207 matrix M[5][1]=1,x(1),x(2),x(3),x(4);208 intmat(np[4])*M;209 }210 211 /////////////////////////////////////////////////////////////////////////////212 213 proc newtonPolytopeP (poly f)214 "USAGE: newtonPolytopeP(f); f poly215 RETURN: list, L with four entries216 @* L[1] : an integer matrix whose rows are the coordinates of vertices217 of the Newton polytope of f218 @* L[2] : the dimension of the Newton polytope of f219 @* L[3] : a list whose ith entry explains to which vertices the220 ith vertex of the Newton polytope is connected221 -- i.e. L[3][i] is an integer vector and an entry k in222 there means that the vertex L[1][i] is223 connected to the vertex L[1][k]224 @* L[4] : an matrix of type bigintmat whose rows multiplied by225 (1,var(1),...,var(nvar)) give a linear system of equations226 describing the affine hull of the Newton polytope, i.e. the227 smallest affine space containing the Newton polytope228 NOTE: - if we replace the first column of L[4] by zeros, i.e. if we move229 the affine hull to the origin, then we get the equations for the230 orthogonal complement of the linearity space of the normal fan dual231 to the Newton polytope, i.e. we get the EQUATIONS that232 we need as input for polymake when computing the normal fan233 @* - the procedure calls for its computation polymake by Ewgenij Gawrilow,234 TU Berlin and Michael Joswig, so it only works if polymake is installed;235 see http://www.polymake.org/236 EXAMPLE: example newtonPolytopeP; shows an example"237 {238 int i,j;239 // compute the list of exponent vectors of the polynomial,240 // which are the lattice points241 // whose convex hull is the Newton polytope of f242 intmat exponents[size(f)][nvars(basering)];243 while (f!=0)244 {245 i++;246 exponents[i,1..nvars(basering)]=leadexp(f);247 f=f-lead(f);248 }249 // call polymakePolytope with exponents250 return(polymakePolytope(exponents));251 }252 example253 {254 "EXAMPLE:";255 echo=2;256 ring r=0,(x,y,z),dp;257 matrix M[4][1]=1,x,y,z;258 poly f=y3+x2+xy+2xz+yz+z2+1;259 // the Newton polytope of f is260 list np=newtonPolytopeP(f);261 // the vertices of the Newton polytope are:262 np[1];263 // its dimension is264 np[2];265 // np[3] contains information how the vertices are connected to each other,266 // e.g. the first vertex (number 0) is connected to the second, third and267 // fourth vertex268 np[3][1];269 //////////////////////////270 f=x2-y3;271 // the Newton polytope of f is272 np=newtonPolytopeP(f);273 // the vertices of the Newton polytope are:274 np[1];275 // its dimension is276 np[2];277 // the Newton polytope is contained in the affine space given278 // by the equations279 intmat(np[4])*M;280 }281 282 /////////////////////////////////////////////////////////////////////////////283 284 proc newtonPolytopeLP (poly f)285 "USAGE: newtonPolytopeLP(f); f poly286 RETURN: list, the exponent vectors of the monomials occurring in f,287 i.e. the lattice points of the Newton polytope of f288 EXAMPLE: example newtonPolytopeLP; shows an example"289 {290 list np;291 int i=1;292 while (f!=0)293 {294 np[i]=leadexp(f);295 f=f-lead(f);296 i++;297 }298 return(np);299 }300 example301 {302 "EXAMPLE:";303 echo=2;304 ring r=0,(x,y,z),dp;305 poly f=y3+x2+xy+2xz+yz+z2+1;306 // the lattice points of the Newton polytope of f are307 newtonPolytopeLP(f);308 90 } 309 91 … … 2181 1963 } 2182 1964 2183 2184 ///////////////////////////////////////////////////////////////////////////////2185 //2186 // wrappers for polymake.so2187 //2188 ///////////////////////////////////////////////////////////////////////////////2189 2190 proc boundaryLatticePoints()2191 "USAGE: boundaryLatticePoints(p); p polytope2192 ASSUME: isBounded(p)==12193 RETURN: intmat, all lattice points on the relative boundary of p2194 EXAMPLE: example boundaryLatticePoints; shows an example2195 "2196 {2197 ERROR("polymake.so not loaded");2198 }2199 example2200 {2201 "EXAMPLE:"; echo = 2;2202 intmat M[3][3]=2203 1,2,-1,2204 1,-1,2,2205 1,-1,-1;2206 polytope p = polytopeViaPoints(M);2207 boundaryLatticePoints(p);2208 intmat N[2][3]=2209 1,2,0,2210 1,0,2;2211 polytope q = polytopeViaPoints(N);2212 boundaryLatticePoints(q);2213 }2214 2215 proc ehrhartPolynomialCoeff()2216 "USAGE: ehrhartPolynomialCoeff(p); p polytope2217 ASSUME: isBounded(p)==12218 RETURN: intvec, all lattice points on the relative boundary of p2219 EXAMPLE: example ehrhartPolynomialCoeff; shows an example2220 "2221 {2222 ERROR("polymake.so not loaded");2223 }2224 example2225 {2226 "EXAMPLE:"; echo = 2;2227 intmat M[6][4]=2228 1,1,1,2,2229 1,-1,-1,-2,2230 1,1,0,0,2231 1,-1,0,0,2232 1,0,1,0,2233 1,0,-1,0;2234 polytope p = polytopeViaPoints(M);2235 ehrhartPolynomialCoeff(p);2236 }2237 2238 proc fVectorP()2239 "USAGE: fVectorP(p); p polytope2240 RETURN: intvec, the f-vector or p2241 EXAMPLE: example fVectorP; shows an example2242 "2243 {2244 ERROR("polymake.so not loaded");2245 }2246 example2247 {2248 "EXAMPLE:"; echo = 2;2249 intmat M[6][4]=2250 1,1,1,2,2251 1,-1,-1,-2,2252 1,1,0,0,2253 1,-1,0,0,2254 1,0,1,0,2255 1,0,-1,0;2256 polytope p = polytopeViaPoints(M);2257 fVectorP(p);2258 }2259 2260 proc facetVertexLatticeDistances()2261 "USAGE: facetVertexLatticeDistances(p); p polytope2262 RETURN: intmat, encodes the lattice distances between vertices (columns) and facets (rows) of p.2263 EXAMPLE: example facetVertexLatticeDistances; shows an example2264 "2265 {2266 ERROR("polymake.so not loaded");2267 }2268 example2269 {2270 "EXAMPLE:"; echo = 2;2271 intmat M[4][3]=2272 1,2,0,2273 1,0,1,2274 1,2,1,2275 1,0,0;2276 polytope p = polytopeViaPoints(M);2277 facetVertexLatticeDistances(p);2278 }2279 2280 proc facetWidth()2281 "USAGE: facetWidth(p); p polytope2282 ASSUME: isBounded(p)==12283 RETURN: int, maximal integral width going over all facet normals2284 EXAMPLE: example facetWidth; shows an example2285 "2286 {2287 ERROR("polymake.so not loaded");2288 }2289 example2290 {2291 "EXAMPLE:"; echo = 2;2292 intmat M[4][3]=2293 1,2,0,2294 1,0,1,2295 1,2,1,2296 1,0,0;2297 polytope p = polytopeViaPoints(M);2298 facetWidth(p);2299 }2300 2301 proc facetWidths()2302 "USAGE: facetWidths(p); p polytope2303 ASSUME: isBounded(p)==12304 RETURN: intvec, vector with the integral widths of all facet normals2305 EXAMPLE: example facetWidths; shows an example2306 "2307 {2308 ERROR("polymake.so not loaded");2309 }2310 example2311 {2312 "EXAMPLE:"; echo = 2;2313 intmat M[4][3]=2314 1,2,0,2315 1,0,1,2316 1,2,1,2317 1,0,0;2318 polytope p = polytopeViaPoints(M);2319 facetWidths(p);2320 }2321 2322 proc gorensteinIndex()2323 "USAGE: gorensteinIndex(p); p polytope2324 ASSUME: isGorenstein(p)==12325 RETURN: int, a factor n such that n*p+v is reflexive for some translation v2326 NOTE: the translation v can be computed via gorensteinVector(p)2327 EXAMPLE: example gorensteinIndex; shows an example2328 "2329 {2330 ERROR("polymake.so not loaded");2331 }2332 example2333 {2334 "EXAMPLE:"; echo = 2;2335 intmat M[4][3]=1,1,0, 1,0,1, 1,0,0, 1,1,1;2336 polytope p = polytopeViaPoints(M);2337 gorensteinIndex(p);2338 }2339 2340 proc gorensteinVector()2341 "USAGE: gorensteinVector(p); p polytope2342 ASSUME: isGorenstein(p)==12343 RETURN: intvec, a vector v such that n*p+v is reflexive for some factor n2344 NOTE: the factor n can be computed via gorensteinIndex(p)2345 EXAMPLE: example gorensteinVector; shows an example2346 "2347 {2348 ERROR("polymake.so not loaded");2349 }2350 example2351 {2352 "EXAMPLE:"; echo = 2;2353 intmat M[4][3]=1,1,0, 1,0,1, 1,0,0, 1,1,1;2354 polytope p = polytopeViaPoints(M);2355 gorensteinVector(p);2356 }2357 2358 proc hStarVector()2359 "USAGE: hStarVector(p); p polytope2360 RETURN: intvec, the h* vector of p2361 EXAMPLE: example hStarVector; shows an example2362 "2363 {2364 ERROR("polymake.so not loaded");2365 }2366 example2367 {2368 "EXAMPLE:"; echo = 2;2369 intmat2370 M[6][4]=2371 1,1,1,2,2372 1,-1,-1,-2,2373 1,1,0,0,2374 1,-1,0,0,2375 1,0,1,0,2376 1,0,-1,0;2377 polytope p = polytopeViaPoints(M);2378 hStarVector(p);2379 }2380 2381 proc hVector()2382 "USAGE: hVector(p); p polytope2383 RETURN: intvec, the h vector of p2384 EXAMPLE: example hVector; shows an example2385 "2386 {2387 ERROR("polymake.so not loaded");2388 }2389 example2390 {2391 "EXAMPLE:"; echo = 2;2392 intmat2393 M[6][4]=2394 1,1,1,2,2395 1,-1,-1,-2,2396 1,1,0,0,2397 1,-1,0,0,2398 1,0,1,0,2399 1,0,-1,0;2400 polytope p = polytopeViaPoints(M);2401 hVector(p);2402 }2403 2404 proc hilbertBasis()2405 "USAGE: hilbertBasis(c); c cone2406 RETURN: intmat, the Hilbert basis of c intersected with Z^n2407 EXAMPLE: example hilbertBasis; shows an example2408 "2409 {2410 ERROR("polymake.so not loaded");2411 }2412 example2413 {2414 "EXAMPLE:"; echo = 2;2415 intmat M[3][3]=2416 1,2,-1,2417 1,-1,2,2418 1,-1,-1;2419 cone c = coneViaPoints(M);2420 hilbertBasis(c);2421 }2422 2423 proc interiorLatticePoints()2424 "USAGE: interiorLatticePoints(p); p polytope2425 ASSUME: isBounded(p)==12426 RETURN: intmat, all lattice points in the relative interior of p2427 EXAMPLE: example interiorLatticePoints; shows an example2428 "2429 {2430 ERROR("polymake.so not loaded");2431 }2432 example2433 {2434 "EXAMPLE:"; echo = 2;2435 intmat M[3][3]=2436 1,2,-1,2437 1,-1,2,2438 1,-1,-1;2439 polytope p = polytopeViaPoints(M);2440 interiorLatticePoints(p);2441 intmat N[2][3]=2442 1,2,0,2443 1,0,2;2444 polytope q = polytopeViaPoints(N);2445 interiorLatticePoints(q);2446 }2447 2448 proc isBounded()2449 "USAGE: isBounded(p); p polytope2450 RETURN: 1, if p is bounded; 0 otherwise2451 EXAMPLE: example isBounded; shows an example2452 "2453 {2454 ERROR("polymake.so not loaded");2455 }2456 example2457 {2458 "EXAMPLE:"; echo = 2;2459 intmat M[4][4]=2460 1,1,0,0,2461 1,0,1,0,2462 1,0,0,1,2463 1,-1,-1,-1;2464 polytope p = polytopeViaPoints(M);2465 isBounded(p);2466 M=2467 1,1,0,0,2468 1,0,1,0,2469 0,0,0,1,2470 1,-1,-1,-1;2471 p = polytopeViaPoints(M);2472 isBounded(p);2473 }2474 2475 proc isCanonical()2476 "USAGE: isCanonical(p); p polytope2477 RETURN: 1, if p has exactly one interior lattice point; 0 otherwise2478 EXAMPLE: example isCanonical; shows an example2479 "2480 {2481 ERROR("polymake.so not loaded");2482 }2483 example2484 {2485 "EXAMPLE:"; echo = 2;2486 intmat M[6][4]=2487 1,1,1,2,2488 1,-1,-1,-2,2489 1,1,0,0,2490 1,-1,0,0,2491 1,0,1,0,2492 1,0,-1,0;2493 polytope p = polytopeViaPoints(M);2494 isCanonical(p);2495 isReflexive(p);2496 intmat N[3][3]=2497 1,2,0,2498 1,0,2,2499 1,-2,-2;2500 polytope q = polytopeViaPoints(N);2501 isCanonical(q);2502 }2503 2504 proc isCompressed()2505 "USAGE: isCompressed(p); p polytope2506 RETURN: 1, if p has maximal facet width 1; 0 otherwise2507 EXAMPLE: example isCompressed; shows an example2508 "2509 {2510 ERROR("polymake.so not loaded");2511 }2512 example2513 {2514 "EXAMPLE:"; echo = 2;2515 intmat M[4][3]=2516 1,2,0,2517 1,0,1,2518 1,2,1,2519 1,0,0;2520 polytope p = polytopeViaPoints(M);2521 isCompressed(p);2522 intmat N[4][3]=2523 1,1,0,2524 1,0,1,2525 1,1,1,2526 1,0,0;2527 polytope q = polytopeViaPoints(N);2528 isCompressed(q);2529 }2530 2531 proc isGorenstein()2532 "USAGE: isGorenstein(p); p polytope2533 RETURN: 1, if p is Gorenstein, i.e. reflexive modulo dilatation and translation; 0 otherwise2534 EXAMPLE: example isGorenstein; shows an example2535 "2536 {2537 ERROR("polymake.so not loaded");2538 }2539 example2540 {2541 "EXAMPLE:"; echo = 2;2542 intmat M[4][3]=2543 1,1,0,2544 1,0,1,2545 1,0,0,2546 1,1,1;2547 polytope p = polytopeViaPoints(M);2548 isGorenstein(p);2549 intmat N[3][3]=2550 1,2,0,2551 1,0,2,2552 1,-2,-2;2553 polytope q = polytopeViaPoints(N);2554 isGorenstein(q);2555 }2556 2557 proc isLatticeEmpty()2558 "USAGE: isLatticeEmpty(p); p polytope2559 RETURN: 1, if p contains no lattice points other than the vertices; 0 otherwise2560 EXAMPLE: example isLatticeEmpty; shows an example2561 "2562 {2563 ERROR("polymake.so not loaded");2564 }2565 example2566 {2567 "EXAMPLE:"; echo = 2;2568 intmat M[4][3]=2569 1,1,0,2570 1,1,1,2571 1,0,1,2572 1,0,0;2573 polytope p = polytopeViaPoints(M);2574 isLatticeEmpty(p);2575 intmat N[4][3]=2576 1,1,0,2577 1,2,1,2578 1,0,1,2579 1,0,0;2580 polytope q = polytopeViaPoints(N);2581 isLatticeEmpty(q);2582 }2583 2584 proc isNormal()2585 "USAGE: isNormal(p); p polytope2586 RETURN: 1, if the projective toric variety defined by p is projectively normal; 0 otherwise2587 EXAMPLE: example isNormal; shows an example2588 "2589 {2590 ERROR("polymake.so not loaded");2591 }2592 example2593 {2594 "EXAMPLE:"; echo = 2;2595 intmat M[6][4]=2596 1,1,1,2,2597 1,-1,-1,-2,2598 1,1,0,0,2599 1,-1,0,0,2600 1,0,1,0,2601 1,0,-1,0;2602 polytope p = polytopeViaPoints(M);2603 isNormal(p);2604 }2605 2606 proc isReflexive()2607 "USAGE: isReflexive(p); p polytope2608 RETURN: 1, if p is reflexive; 0 otherwise2609 EXAMPLE: example isReflexive; shows an example2610 "2611 {2612 ERROR("polymake.so not loaded");2613 }2614 example2615 {2616 "EXAMPLE:"; echo = 2;2617 intmat M[4][4]=2618 1,1,0,0,2619 1,0,1,0,2620 1,0,0,1,2621 1,-1,-1,-1;2622 polytope p = polytopeViaPoints(M);2623 isReflexive(p);2624 intmat N[4][4]=2625 1,2,0,0,2626 1,0,2,0,2627 1,0,0,2,2628 1,-2,-2,-2;2629 polytope q = polytopeViaPoints(M);2630 isReflexive(q);2631 }2632 2633 proc isSmooth()2634 "USAGE: isSmooth(c); c cone2635 isSmooth(f); f fan2636 isSmooth(p); p polytope2637 RETURN: 1, if the input is smooth; 0 otherwise2638 EXAMPLE: example isSmooth; shows an example2639 "2640 {2641 ERROR("polymake.so not loaded");2642 }2643 example2644 {2645 "EXAMPLE:"; echo = 2;2646 intmat M1[2][2]=2647 1,0,2648 0,1;2649 cone c1 = coneViaPoints(M1);2650 isSmooth(c1);2651 intmat M2[3][3]=2652 1,0,2653 1,2;2654 cone c2 = coneViaPoints(M2);2655 fan F1 = emptyFan(2);2656 insertCone(F1,c1);2657 isSmooth(F1);2658 fan F2 = emptyFan(3);2659 insertCone(F2,c2);2660 isSmooth(F2);2661 intmat Mp[3][3]=2662 1,-2,-3,2663 1,1,0,2664 1,0,1;2665 polytope p = polytopeViaPoints(Mp);2666 isSmooth(p);2667 fan F = normalFan(p);2668 isSmooth(F);2669 intmat Mq[4][3]=2670 1,2,0,2671 1,0,1,2672 1,2,1,2673 1,0,0;2674 polytope q = polytopeViaPoints(Mq);2675 isSmooth(q);2676 }2677 2678 proc isTerminal()2679 "USAGE: isTerminal(p); p polytope2680 RETURN: 1, if p has exactly one interior lattice point and all other lattice points are vertices; 0 otherwise2681 EXAMPLE: example isTerminal; shows an example2682 "2683 {2684 ERROR("polymake.so not loaded");2685 }2686 example2687 {2688 "EXAMPLE:"; echo = 2;2689 intmat M[6][4]=2690 1,1,1,2,2691 1,-1,-1,-2,2692 1,1,0,0,2693 1,-1,0,0,2694 1,0,1,0,2695 1,0,-1,0;2696 polytope p = polytopeViaPoints(M);2697 isTerminal(p);2698 isReflexive(p);2699 intmat N[6][4]=2700 1,1,1,2,2701 1,-1,-1,-2,2702 1,1,1,0,2703 1,-1,-1,0,2704 1,-1,1,0,2705 1,1,-1,0;2706 polytope q = polytopeViaPoints(N);2707 isTerminal(q);2708 isCanonical(q);2709 }2710 2711 proc isVeryAmple()2712 "USAGE: isVeryAmple(p); p polytope2713 RETURN: 1, if p is very ample; 0 otherwise2714 EXAMPLE: example isVeryAmple; shows an example2715 "2716 {2717 ERROR("polymake.so not loaded");2718 }2719 example2720 {2721 "EXAMPLE:"; echo = 2;2722 intmat M[3][3]=2723 1,1,0,2724 1,0,1,2725 1,-1,-1;2726 polytope p = polytopeViaPoints(M);2727 isVeryAmple(p);2728 intmat N[3][4]=2729 1,1,0,0,2730 1,0,1,0,2731 1,1,1,2;2732 polytope q = polytopeViaPoints(N);2733 isVeryAmple(q);2734 }2735 2736 proc latticeCodegree()2737 "USAGE: latticeCodegree(p); p polytope2738 RETURN: int, the smallest number n such that n*p has a relative interior lattice point2739 NOTE: dimension(p)+1==latticeDegree(p)+latticeCodegree(p)2740 EXAMPLE: example latticeCodegree; shows an example2741 "2742 {2743 ERROR("polymake.so not loaded");2744 }2745 example2746 {2747 "EXAMPLE:"; echo = 2;2748 intmat M[4][3]=2749 1,1,0,2750 1,1,1,2751 1,0,1,2752 1,0,0;2753 polytope p = polytopeViaPoints(M);2754 latticeCodegree(p);2755 intmat N[4][4]=2756 1,1,0,0,2757 1,0,1,0,2758 1,0,0,1,2759 1,0,0,0;2760 polytope q = polytopeViaPoints(N);2761 latticeCodegree(q);2762 }2763 2764 proc latticeDegree()2765 "USAGE: latticeDegree(p); p polytope2766 RETURN: int, the degree of the Ehrhart polynomial of p2767 NOTE: dimension(p)+1==latticeDegree(p)+latticeCodegree(p)2768 EXAMPLE: example latticeDegree; shows an example2769 "2770 {2771 ERROR("polymake.so not loaded");2772 }2773 example2774 {2775 "EXAMPLE:"; echo = 2;2776 intmat M[4][3]=2777 1,1,0,2778 1,1,1,2779 1,0,1,2780 1,0,0;2781 polytope p = polytopeViaPoints(M);2782 latticeDegree(p);2783 intmat N[4][4]=2784 1,1,0,0,2785 1,0,1,0,2786 1,0,0,1,2787 1,0,0,0;2788 polytope q = polytopeViaPoints(N);2789 latticeDegree(q);2790 }2791 2792 proc latticePoints()2793 "USAGE: latticePoints(p); p polytope2794 ASSUME: isBounded(p)==12795 RETURN: intmat, all lattice points in p2796 EXAMPLE: example latticePoints; shows an example2797 "2798 {2799 ERROR("polymake.so not loaded");2800 }2801 example2802 {2803 "EXAMPLE:"; echo = 2;2804 intmat M[3][3]=2805 1,2,-1,2806 1,-1,2,2807 1,-1,-1;2808 polytope p = polytopeViaPoints(M);2809 latticePoints(p);2810 intmat N[2][3]=2811 1,2,0,2812 1,0,2;2813 polytope q = polytopeViaPoints(N);2814 latticePoints(q);2815 }2816 2817 proc latticeVolume()2818 "USAGE: latticeVolume(p); p polytope2819 ASSUME: isBounded(p)==12820 RETURN: int, the lattice volume of p2821 EXAMPLE: example latticeVolume; shows an example2822 "2823 {2824 ERROR("polymake.so not loaded");2825 }2826 example2827 {2828 "EXAMPLE:"; echo = 2;2829 intmat M[4][3]=2830 1,1,0,2831 1,1,1,2832 1,0,1,2833 1,0,0;2834 polytope p = polytopeViaPoints(M);2835 latticeVolume(p);2836 intmat N[4][3]=2837 1,1,0,2838 1,2,1,2839 1,0,1,2840 1,0,0;2841 polytope q = polytopeViaPoints(N);2842 latticeVolume(q);2843 intmat W[4][4]=2844 1,1,0,0,2845 1,0,1,0,2846 1,0,0,1,2847 1,0,0,0;2848 polytope r = polytopeViaPoints(W);2849 latticeVolume(r);2850 }2851 2852 proc maximalFace()2853 "USAGE: maximalFace(p,v); p polytope, v intvec2854 ASSUME: v lies in the negative dual tail cone of p2855 RETURN: intmat, vertices of the face of p on which the linear form v is maximal2856 NOTE: the maximal face is independent of the first coordinate of v2857 since p is considered as a polytope in the plane (first coordinate) = 1.2858 EXAMPLE: example maximalFace; shows an example2859 "2860 {2861 ERROR("polymake.so not loaded");2862 }2863 example2864 {2865 "EXAMPLE:"; echo = 2;2866 intmat M[3][3]=2867 1,1,0,2868 1,0,1,2869 1,-1,-1;2870 intvec v = 0,1,1;2871 polytope p = polytopeViaPoints(M);2872 maximalFace(p,v);2873 intvec w = -5,1,1;2874 maximalFace(p,w);2875 }2876 2877 proc maximalValue()2878 "USAGE: maximalValue(p,v); p polytope, v intvec2879 ASSUME: v lies in the negative dual tail cone of p2880 RETURN: intmat, vertices of the face of p on which the linear form v is maximal2881 NOTE: first coordinate of v corresponds to a shift of the maximal value2882 since p is considered as a polytope in the plane (first coordinate) = 1.2883 EXAMPLE: example maximalValue; shows an example2884 "2885 {2886 ERROR("polymake.so not loaded");2887 }2888 example2889 {2890 "EXAMPLE:"; echo = 2;2891 intmat M[3][3]=2892 1,1,0,2893 1,0,1,2894 1,-1,-1;2895 intvec v = 0,1,1;2896 polytope p = polytopeViaPoints(M);2897 maximalValue(p,v);2898 intvec w = -5,1,1;2899 maximalValue(p,w);2900 }2901 2902 proc minimalFace()2903 "USAGE: minimalFace(p,v); p polytope, v intvec2904 ASSUME: v lies in the dual tail cone of p2905 RETURN: intmat, vertices of the face of p on which the linear form v is minimal2906 NOTE: the minimal face is independent of the first coordinate of v2907 since p is considered as a polytope in the plane (first coordinate) = 1.2908 EXAMPLE: example minimalFace; shows an example2909 "2910 {2911 ERROR("polymake.so not loaded");2912 }2913 example2914 {2915 "EXAMPLE:"; echo = 2;2916 intmat M[3][3]=2917 1,1,0,2918 1,0,1,2919 1,-1,-1;2920 intvec v = 0,-1,-1;2921 polytope p = polytopeViaPoints(M);2922 minimalFace(p,v);2923 intvec w = 5,-1,-1;2924 minimalFace(p,w);2925 }2926 2927 proc minimalValue()2928 "USAGE: minimalValue(p,v); p polytope, v intvec2929 ASSUME: v lies in the negative dual tail cone of p2930 RETURN: intmat, vertices of the face of p on which the linear form v is minimal2931 NOTE: first coordinate of v corresponds to a shift of the minimal value2932 since p is considered as a polytope in the plane (first coordinate) = 1.2933 EXAMPLE: example minimalValue; shows an example2934 "2935 {2936 ERROR("polymake.so not loaded");2937 }2938 example2939 {2940 "EXAMPLE:"; echo = 2;2941 intmat M[3][3]=2942 1,1,0,2943 1,0,1,2944 1,-1,-1;2945 intvec v = 0,-1,-1;2946 polytope p = polytopeViaPoints(M);2947 minimalValue(p,v);2948 intvec w = 5,-1,-1;2949 minimalValue(p,w);2950 }2951 2952 proc minkowskiSum()2953 "USAGE: minkowskiSum(c,d); c cone, d cone2954 minkowskiSum(c,q); c cone, q polytope2955 minkowskiSum(p,d); p polytope, d cone2956 minkowskiSum(p,q); p polytope, q polytope2957 ASSUME: input arguments have the same ambient dimension2958 RETURN: cone, if both inputs are cones; polytope, otherwise2959 the minkowski sum of the two input arguments2960 EXAMPLE: example minkowskiSum; shows an example2961 "2962 {2963 ERROR("polymake.so not loaded");2964 }2965 example2966 {2967 "EXAMPLE:"; echo = 2;2968 intmat M[3][4]=2969 1,1,0,0,2970 1,0,1,0,2971 1,0,0,0;2972 intmat N[3][4]=2973 1,0,0,1,2974 1,-1,-1,-1,2975 1,0,0,0;2976 polytope p = polytopeViaPoints(M);2977 polytope q = polytopeViaPoints(N);2978 vertices(minkowskiSum(p,q));2979 }2980 2981 proc nBoundaryLatticePoints()2982 "USAGE: nBoundaryLatticePoints(p); p polytope2983 ASSUME: isBounded(p)==12984 RETURN: int, the number of lattice points in the relative boundary of p2985 EXAMPLE: example nBoundaryLatticePoints; shows an example2986 "2987 {2988 ERROR("polymake.so not loaded");2989 }2990 example2991 {2992 "EXAMPLE:"; echo = 2;2993 intmat M[3][3]=2994 1,2,-1,2995 1,-1,2,2996 1,-1,-1;2997 polytope p = polytopeViaPoints(M);2998 nBoundaryLatticePoints(p);2999 intmat N[2][3]=3000 1,2,0,3001 1,0,2;3002 polytope q = polytopeViaPoints(N);3003 nBoundaryLatticePoints(q);3004 }3005 3006 proc nHilbertBasis()3007 "USAGE: nHilbertBasis(c); c cone3008 RETURN: int, the number of elements in the Hilbert basis of c intersected with Z^n3009 EXAMPLE: example nHilbertBasis; shows an example3010 "3011 {3012 ERROR("polymake.so not loaded");3013 }3014 example3015 {3016 "EXAMPLE:"; echo = 2;3017 intmat M[3][3]=3018 1,2,-1,3019 1,-1,2,3020 1,-1,-1;3021 cone c = coneViaPoints(M);3022 nHilbertBasis(c);3023 }3024 3025 proc nInteriorLatticePoints()3026 "USAGE: nInteriorLatticePoints(p); p polytope3027 ASSUME: isBounded(p)==13028 RETURN: int, the number of lattice points in the relative interior of p3029 EXAMPLE: example nInteriorLatticePoints; shows an example3030 "3031 {3032 ERROR("polymake.so not loaded");3033 }3034 example3035 {3036 "EXAMPLE:"; echo = 2;3037 intmat M[3][3]=3038 1,2,-1,3039 1,-1,2,3040 1,-1,-1;3041 polytope p = polytopeViaPoints(M);3042 nInteriorLatticePoints(p);3043 intmat N[2][3]=3044 1,2,0,3045 1,0,2;3046 polytope q = polytopeViaPoints(N);3047 nInteriorLatticePoints(q);3048 }3049 3050 proc nLatticePoints()3051 "USAGE: nLatticePoints(p); p polytope3052 ASSUME: isBounded(p)==13053 RETURN: intmat, the number of lattice points in p3054 EXAMPLE: example nLatticePoints; shows an example3055 "3056 {3057 ERROR("polymake.so not loaded");3058 }3059 example3060 {3061 "EXAMPLE:"; echo = 2;3062 intmat M[3][3]=3063 1,2,-1,3064 1,-1,2,3065 1,-1,-1;3066 polytope p = polytopeViaPoints(M);3067 nLatticePoints(p);3068 intmat N[2][3]=3069 1,2,0,3070 1,0,2;3071 polytope q = polytopeViaPoints(N);3072 nLatticePoints(q);3073 }3074 3075 proc normalFan()3076 "USAGE: normalFan(p); p polytope3077 RETURN: fan, the normal fan of p3078 EXAMPLE: example normalFan; shows an example3079 "3080 {3081 ERROR("polymake.so not loaded");3082 }3083 example3084 {3085 "EXAMPLE:"; echo = 2;3086 intmat M[6][4] =3087 1,1,0,0,3088 1,0,1,0,3089 1,0,-1,0,3090 1,0,0,1,3091 1,0,0,-1,3092 1,-1,0,0;3093 polytope p = polytopeViaPoints(M);3094 normalFan(p);3095 }3096 3097 proc vertexAdjacencyGraph()3098 "USAGE: vertexAdjacencyGraph(p); p polytope3099 RETURN: list, the first entry is a bigintmat containing all vertices as row vectors, and therefore assigning all vertices an integer.3100 the second entry is a list of intvecs representing the adjacency graph of the vertices of p,3101 the intvec in position i contains all vertices j which are connected to vertex i via an edge of p.3102 EXAMPLE: example vertexAdjacencyGraph; shows an example3103 "3104 {3105 ERROR("polymake.so not loaded");3106 }3107 example3108 {3109 "EXAMPLE:"; echo = 2;3110 intmat M[6][4] =3111 1,1,0,0,3112 1,0,1,0,3113 1,0,-1,0,3114 1,0,0,1,3115 1,0,0,-1,3116 1,-1,0,0;3117 polytope p = polytopeViaPoints(M);3118 vertexAdjacencyGraph(p);3119 }3120 3121 proc vertexEdgeGraph()3122 "USAGE: vertexEdgeGraph(p); p polytope3123 RETURN: list, the first entry is a bigintmat containing all vertices as row vectors, and therefore assigning all vertices an integer.3124 the second entry is a list of intvecs representing the edge graph of the vertices of p,3125 each intvec represents an edge of p connecting vertex i with vertex j.3126 EXAMPLE: example vertexEdgeGraph; shows an example3127 "3128 {3129 ERROR("polymake.so not loaded");3130 }3131 example3132 {3133 "EXAMPLE:"; echo = 2;3134 intmat M[6][4] =3135 1,1,0,0,3136 1,0,1,0,3137 1,0,-1,0,3138 1,0,0,1,3139 1,0,0,-1,3140 1,-1,0,0;3141 polytope p = polytopeViaPoints(M);3142 vertexEdgeGraph(p);3143 }3144 3145 3146 proc visual()3147 "USAGE: visual(f); f fan3148 visual(p); p polytope3149 ASSUME: ambientDimension(f) resp ambientDimension(p) less or equal 33150 RETURN: none3151 EXAMPLE: example visual; shows an example3152 "3153 {3154 ERROR("polymake.so not loaded");3155 }3156 example3157 {3158 "EXAMPLE:"; echo = 2;3159 intmat M[6][4] =3160 1,1,0,0,3161 1,0,1,0,3162 1,0,-1,0,3163 1,0,0,1,3164 1,0,0,-1,3165 1,-1,0,0;3166 polytope p = polytopeViaPoints(M);3167 // visual(p);3168 fan f = normalFan(p);3169 // visual(f);3170 } -
Singular/dyn_modules/Makefile.am
ra7810b5 r7c9f0a 1 1 ACLOCAL_AMFLAGS = -I ../m4 2 2 3 DIST_SUBDIRS=staticdemo bigintm subsets syzextra pyobject customstd gfanlib python gitfan polymakesingmathic Order interval cohomo freealgebra partialgb systhreads loctriv machinelearning3 DIST_SUBDIRS=staticdemo bigintm subsets syzextra pyobject customstd gfanlib python gitfan singmathic Order interval cohomo freealgebra partialgb systhreads loctriv machinelearning 4 4 5 5 SUBDIRS = … … 31 31 SUBDIRS += gitfan 32 32 endif 33 if ENABLE_POLYMAKE_MODULE34 SUBDIRS += polymake35 endif36 33 if ENABLE_SINGMATHIC_MODULE 37 34 SUBDIRS += singmathic -
configure.ac
ra7810b5 r7c9f0a 128 128 129 129 SING_CHECK_GFANLIB 130 SING_CHECK_POLYMAKE131 130 132 131 SING_CHECK_PLURAL … … 263 262 AC_CONFIG_FILES([Singular/dyn_modules/syzextra/Makefile]) 264 263 AC_CONFIG_FILES([Singular/dyn_modules/gfanlib/Makefile]) 265 AC_CONFIG_FILES([Singular/dyn_modules/polymake/Makefile])266 264 AC_CONFIG_FILES([Singular/dyn_modules/python/Makefile]) 267 265 AC_CONFIG_FILES([Singular/dyn_modules/customstd/Makefile]) … … 299 297 dnl Check for executables used by library files. 300 298 dnl Found by: git grep 'system("\(sh\|executable\)"' 301 AS_VAR_SET([DOC2TEX_EXAMPLE_EXCLUSIONS], [" -exclude polymake"])299 AS_VAR_SET([DOC2TEX_EXAMPLE_EXCLUSIONS], [""]) 302 300 AC_CHECK_PROGS([QEPCAD], [qepcad]) 303 301 AS_IF([test -z "$QEPCAD"], [ … … 312 310 AS_IF([test -z "$GFAN"], [ 313 311 AS_VAR_APPEND([DOC2TEX_EXAMPLE_EXCLUSIONS], ["-exclude gfan "])]) 312 AC_CHECK_PROGS([TOPCOM], [topcom]) 313 AS_IF([test -z "$TOPCOM"], [ 314 AS_VAR_APPEND([DOC2TEX_EXAMPLE_EXCLUSIONS], ["-exclude topcom "])]) 314 315 AS_IF([test -z "$PYTHON"], [ 315 316 AS_VAR_APPEND([DOC2TEX_EXAMPLE_EXCLUSIONS], ["-exclude pyobject "])]) -
doc/COPYING.texi
ra7810b5 r7c9f0a 127 127 @copyright{} Winfried Bruns and Bogdan Ichim 128 128 @* @uref{https://www.normaliz.uni-osnabrueck.de} 129 @item polymake (used by polymake.lib, @pxref{polymake_lib})130 @copyright{} Ewgenij Gawrilow and Michael Joswig131 @* @uref{https://polymake.org/}132 129 @item surf (used by surf.lib, @pxref{surf_lib}) 133 130 @copyright{} Stephan Endrass
Note: See TracChangeset
for help on using the changeset viewer.