Changeset 78c0d45 in git for Singular


Ignore:
Timestamp:
Oct 1, 2016, 3:38:13 PM (7 years ago)
Author:
Yue <ren@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
438670d77815ff36a3900d811b1db05f098c9a3d
Parents:
e946361c872c62f94d3098cd85858e5069cb55fa
git-author:
Yue <ren@mathematik.uni-kl.de>2016-10-01 15:38:13+02:00
git-committer:
Yue <ren@mathematik.uni-kl.de>2016-10-04 13:10:39+02:00
Message:
chg: crudely merged polymakeInterface.lib into polymake.lib
Location:
Singular/LIB
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/polymake.lib

    re946361 r78c0d45  
    55                           interface to polymake and TOPCOM
    66AUTHOR:    Thomas Markwig,  email: keilen@mathematik.uni-kl.de
     7           Yue Ren,         email: ren@mathematik.uni-kl.de
    78
    89WARNING:
     
    6465  ellipticNFDB()   displays the 16 normal forms of elliptic polygons
    6566
     67PROCEDURES USING POLYMAKE (LOW LEVEL INTERFACE)
     68    boundaryLatticePoints()
     69    ehrhartPolynomialCoeff()
     70    fVectorP()
     71    facetVertexLatticeDistances()
     72    facetWidth()
     73    facetWidths()
     74    gorensteinIndex()
     75    gorensteinVector()
     76    hStarVector()
     77    hVector()
     78    hilbertBasis()
     79    interiorLatticePoints()
     80    isBounded()
     81    isCanonical()
     82    isCompressed()
     83    isGorenstein()
     84    isLatticeEmpty()
     85    isNormal()
     86    isReflexive()
     87    isSmooth()
     88    isTerminal()
     89    isVeryAmple()
     90    latticeCodegree()
     91    latticeDegree()
     92    latticePoints()
     93    latticeVolume()
     94    maximalFace()
     95    maximalValue()
     96    minimalFace()
     97    minimalValue()
     98    minkowskiSum()
     99    nBoundaryLatticePoints()
     100    nHilbertBasis()
     101    nInteriorLatticePoints()
     102    nLatticePoints()
     103    normalFan()
     104    vertexAdjacencyGraph()
     105    vertexEdgeGraph()
     106    visual()
     107
    66108KEYWORDS:    polytope; fan; secondary fan; secondary polytope; polymake;
    67109             Newton polytope; Groebner fan
     
    91133////////////////////////////////////////////////////////////////////////////////
    92134
    93 static proc mod_init ()
    94 {
     135static proc mod_init()
     136{
     137  intvec save=option(get);
     138  option(noredefine);
    95139  LIB "customstd.so";
    96140  LIB "gfanlib.so";
    97141  LIB "polymake.so";
     142  option(set,save);
    98143}
    99144
     
    24832528
    24842529
    2485 
     2530///////////////////////////////////////////////////////////////////////////////
     2531//
     2532//   wrappers for polymake.so
     2533//
     2534///////////////////////////////////////////////////////////////////////////////
     2535
     2536proc boundaryLatticePoints()
     2537"USAGE:   boundaryLatticePoints(p);  p polytope
     2538ASSUME:  isBounded(p)==1
     2539RETURN:  intmat, all lattice points on the relative boundary of p
     2540EXAMPLE: example boundaryLatticePoints; shows an example
     2541"
     2542{
     2543
     2544}
     2545example
     2546{
     2547  "EXAMPLE:"; echo = 2;
     2548  intmat M[3][3]=
     2549    1,2,-1,
     2550    1,-1,2,
     2551    1,-1,-1;
     2552  polytope p = polytopeViaPoints(M);
     2553  boundaryLatticePoints(p);
     2554  intmat N[2][3]=
     2555    1,2,0,
     2556    1,0,2;
     2557  polytope q = polytopeViaPoints(N);
     2558  boundaryLatticePoints(q);
     2559}
     2560
     2561proc ehrhartPolynomialCoeff()
     2562"USAGE:   ehrhartPolynomialCoeff(p);  p polytope
     2563ASSUME:  isBounded(p)==1
     2564RETURN:  intvec, all lattice points on the relative boundary of p
     2565EXAMPLE: example ehrhartPolynomialCoeff; shows an example
     2566"
     2567{
     2568
     2569}
     2570example
     2571{
     2572  "EXAMPLE:"; echo = 2;
     2573  intmat M[6][4]=
     2574    1,1,1,2,
     2575    1,-1,-1,-2,
     2576    1,1,0,0,
     2577    1,-1,0,0,
     2578    1,0,1,0,
     2579    1,0,-1,0;
     2580  polytope p = polytopeViaPoints(M);
     2581  ehrhartPolynomialCoeff(p);
     2582}
     2583
     2584proc fVectorP()
     2585"USAGE:   fVectorP(p);  p polytope
     2586RETURN:  intvec, the f-vector or p
     2587EXAMPLE: example fVectorP; shows an example
     2588"
     2589{
     2590
     2591}
     2592example
     2593{
     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  fVectorP(p);
     2604}
     2605
     2606proc facetVertexLatticeDistances()
     2607"USAGE:   facetVertexLatticeDistances(p);  p polytope
     2608RETURN:  intmat, encodes the lattice distances between vertices (columns) and facets (rows) of p.
     2609EXAMPLE: example facetVertexLatticeDistances; shows an example
     2610"
     2611{
     2612
     2613}
     2614example
     2615{
     2616  "EXAMPLE:"; echo = 2;
     2617  intmat M[4][3]=
     2618    1,2,0,
     2619    1,0,1,
     2620    1,2,1,
     2621    1,0,0;
     2622  polytope p = polytopeViaPoints(M);
     2623  facetVertexLatticeDistances(p);
     2624}
     2625
     2626proc facetWidth()
     2627"USAGE:   facetWidth(p);  p polytope
     2628ASSUME:  isBounded(p)==1
     2629RETURN:  int, maximal integral width going over all facet normals
     2630EXAMPLE: example facetWidth; shows an example
     2631"
     2632{
     2633
     2634}
     2635example
     2636{
     2637  "EXAMPLE:"; echo = 2;
     2638  intmat M[4][3]=
     2639    1,2,0,
     2640    1,0,1,
     2641    1,2,1,
     2642    1,0,0;
     2643  polytope p = polytopeViaPoints(M);
     2644  facetWidth(p);
     2645}
     2646
     2647proc facetWidths()
     2648"USAGE:   facetWidths(p);  p polytope
     2649ASSUME:  isBounded(p)==1
     2650RETURN:  intvec, vector with the integral widths of all facet normals
     2651EXAMPLE: example facetWidths; shows an example
     2652"
     2653{
     2654
     2655}
     2656example
     2657{
     2658  "EXAMPLE:"; echo = 2;
     2659  intmat M[4][3]=
     2660    1,2,0,
     2661    1,0,1,
     2662    1,2,1,
     2663    1,0,0;
     2664  polytope p = polytopeViaPoints(M);
     2665  facetWidths(p);
     2666}
     2667
     2668proc gorensteinIndex()
     2669"USAGE:   gorensteinIndex(p);  p polytope
     2670ASSUME:  isGorenstein(p)==1
     2671RETURN:  int, a factor n such that n*p+v is reflexive for some translation v
     2672NOTE:    the translation v can be computed via gorensteinVector(p)
     2673EXAMPLE: example gorensteinIndex; shows an example
     2674"
     2675{
     2676
     2677}
     2678example
     2679{
     2680  "EXAMPLE:"; echo = 2;
     2681  intmat M[4][3]=1,1,0, 1,0,1, 1,0,0, 1,1,1;
     2682  polytope p = polytopeViaPoints(M);
     2683  gorensteinIndex(p);
     2684}
     2685
     2686proc gorensteinVector()
     2687"USAGE:   gorensteinVector(p);  p polytope
     2688ASSUME:  isGorenstein(p)==1
     2689RETURN:  intvec, a vector v such that n*p+v is reflexive for some factor n
     2690NOTE:    the factor n can be computed via gorensteinIndex(p)
     2691EXAMPLE: example gorensteinVector; shows an example
     2692"
     2693{
     2694
     2695}
     2696example
     2697{
     2698  "EXAMPLE:"; echo = 2;
     2699  intmat M[4][3]=1,1,0, 1,0,1, 1,0,0, 1,1,1;
     2700  polytope p = polytopeViaPoints(M);
     2701  gorensteinVector(p);
     2702}
     2703
     2704proc hStarVector()
     2705"USAGE:   hStarVector(p);  p polytope
     2706RETURN:  intvec, the h* vector of p
     2707EXAMPLE: example hStarVector; shows an example
     2708"
     2709{
     2710
     2711}
     2712example
     2713{
     2714  "EXAMPLE:"; echo = 2;
     2715  intmat
     2716  M[6][4]=
     2717    1,1,1,2,
     2718    1,-1,-1,-2,
     2719    1,1,0,0,
     2720    1,-1,0,0,
     2721    1,0,1,0,
     2722    1,0,-1,0;
     2723  polytope p = polytopeViaPoints(M);
     2724  hStarVector(p);
     2725}
     2726
     2727proc hVector()
     2728"USAGE:   hVector(p);  p polytope
     2729RETURN:  intvec, the h vector of p
     2730EXAMPLE: example hVector; shows an example
     2731"
     2732{
     2733
     2734}
     2735example
     2736{
     2737  "EXAMPLE:"; echo = 2;
     2738  intmat
     2739  M[6][4]=
     2740    1,1,1,2,
     2741    1,-1,-1,-2,
     2742    1,1,0,0,
     2743    1,-1,0,0,
     2744    1,0,1,0,
     2745    1,0,-1,0;
     2746  polytope p = polytopeViaPoints(M);
     2747  hVector(p);
     2748}
     2749
     2750proc hilbertBasis()
     2751"USAGE:   hilbertBasis(c);  c cone
     2752RETURN:  intmat, the Hilbert basis of c intersected with Z^n
     2753EXAMPLE: example hilbertBasis; shows an example
     2754"
     2755{
     2756
     2757}
     2758example
     2759{
     2760  "EXAMPLE:"; echo = 2;
     2761  intmat M[3][3]=
     2762    1,2,-1,
     2763    1,-1,2,
     2764    1,-1,-1;
     2765  cone c = coneViaPoints(M);
     2766  hilbertBasis(c);
     2767}
     2768
     2769proc interiorLatticePoints()
     2770"USAGE:   interiorLatticePoints(p);  p polytope
     2771ASSUME:  isBounded(p)==1
     2772RETURN:  intmat, all lattice points in the relative interior of p
     2773EXAMPLE: example interiorLatticePoints; shows an example
     2774"
     2775{
     2776
     2777}
     2778example
     2779{
     2780  "EXAMPLE:"; echo = 2;
     2781  intmat M[3][3]=
     2782    1,2,-1,
     2783    1,-1,2,
     2784    1,-1,-1;
     2785  polytope p = polytopeViaPoints(M);
     2786  interiorLatticePoints(p);
     2787  intmat N[2][3]=
     2788    1,2,0,
     2789    1,0,2;
     2790  polytope q = polytopeViaPoints(N);
     2791  interiorLatticePoints(q);
     2792}
     2793
     2794proc isBounded()
     2795"USAGE:   isBounded(p);  p polytope
     2796RETURN:  1, if p is bounded; 0 otherwise
     2797EXAMPLE: example isBounded; shows an example
     2798"
     2799{
     2800
     2801}
     2802example
     2803{
     2804  "EXAMPLE:"; echo = 2;
     2805  intmat M[4][4]=
     2806    1,1,0,0,
     2807    1,0,1,0,
     2808    1,0,0,1,
     2809    1,-1,-1,-1;
     2810  polytope p = polytopeViaPoints(M);
     2811  isBounded(p);
     2812  M=
     2813    1,1,0,0,
     2814    1,0,1,0,
     2815    0,0,0,1,
     2816    1,-1,-1,-1;
     2817  p = polytopeViaPoints(M);
     2818  isBounded(p);
     2819}
     2820
     2821proc isCanonical()
     2822"USAGE:   isCanonical(p);  p polytope
     2823RETURN:  1, if p has exactly one interior lattice point; 0 otherwise
     2824EXAMPLE: example isCanonical; shows an example
     2825"
     2826{
     2827
     2828}
     2829example
     2830{
     2831  "EXAMPLE:"; echo = 2;
     2832  intmat M[6][4]=
     2833    1,1,1,2,
     2834    1,-1,-1,-2,
     2835    1,1,0,0,
     2836    1,-1,0,0,
     2837    1,0,1,0,
     2838    1,0,-1,0;
     2839  polytope p = polytopeViaPoints(M);
     2840  isCanonical(p);
     2841  isReflexive(p);
     2842  intmat N[3][3]=
     2843    1,2,0,
     2844    1,0,2,
     2845    1,-2,-2;
     2846  polytope q = polytopeViaPoints(N);
     2847  isCanonical(q);
     2848}
     2849
     2850proc isCompressed()
     2851"USAGE:   isCompressed(p);  p polytope
     2852RETURN:  1, if p has maximal facet width 1; 0 otherwise
     2853EXAMPLE: example isCompressed; shows an example
     2854"
     2855{
     2856
     2857}
     2858example
     2859{
     2860  "EXAMPLE:"; echo = 2;
     2861  intmat M[4][3]=
     2862    1,2,0,
     2863    1,0,1,
     2864    1,2,1,
     2865    1,0,0;
     2866  polytope p = polytopeViaPoints(M);
     2867  isCompressed(p);
     2868  intmat N[4][3]=
     2869    1,1,0,
     2870    1,0,1,
     2871    1,1,1,
     2872    1,0,0;
     2873  polytope q = polytopeViaPoints(N);
     2874  isCompressed(q);
     2875}
     2876
     2877proc isGorenstein()
     2878"USAGE:   isGorenstein(p);  p polytope
     2879RETURN:  1, if p is Gorenstein, i.e. reflexive modulo dilatation and translation; 0 otherwise
     2880EXAMPLE: example isGorenstein; shows an example
     2881"
     2882{
     2883
     2884}
     2885example
     2886{
     2887  "EXAMPLE:"; echo = 2;
     2888  intmat M[4][3]=
     2889    1,1,0,
     2890    1,0,1,
     2891    1,0,0,
     2892    1,1,1;
     2893  polytope p = polytopeViaPoints(M);
     2894  isGorenstein(p);
     2895  intmat N[3][3]=
     2896    1,2,0,
     2897    1,0,2,
     2898    1,-2,-2;
     2899  polytope q = polytopeViaPoints(N);
     2900  isGorenstein(q);
     2901}
     2902
     2903proc isLatticeEmpty()
     2904"USAGE:   isLatticeEmpty(p);  p polytope
     2905RETURN:  1, if p contains no lattice points other than the vertices; 0 otherwise
     2906EXAMPLE: example isLatticeEmpty; shows an example
     2907"
     2908{
     2909
     2910}
     2911example
     2912{
     2913  "EXAMPLE:"; echo = 2;
     2914  intmat M[4][3]=
     2915    1,1,0,
     2916    1,1,1,
     2917    1,0,1,
     2918    1,0,0;
     2919  polytope p = polytopeViaPoints(M);
     2920  isLatticeEmpty(p);
     2921  intmat N[4][3]=
     2922    1,1,0,
     2923    1,2,1,
     2924    1,0,1,
     2925    1,0,0;
     2926  polytope q = polytopeViaPoints(N);
     2927  isLatticeEmpty(q);
     2928}
     2929
     2930proc isNormal()
     2931"USAGE:   isNormal(p);  p polytope
     2932RETURN:  1, if the projective toric variety defined by p is projectively normal; 0 otherwise
     2933EXAMPLE: example isNormal; shows an example
     2934"
     2935{
     2936
     2937}
     2938example
     2939{
     2940  "EXAMPLE:"; echo = 2;
     2941  intmat M[6][4]=
     2942    1,1,1,2,
     2943    1,-1,-1,-2,
     2944    1,1,0,0,
     2945    1,-1,0,0,
     2946    1,0,1,0,
     2947    1,0,-1,0;
     2948  polytope p = polytopeViaPoints(M);
     2949  isNormal(p);
     2950}
     2951
     2952proc isReflexive()
     2953"USAGE:   isReflexive(p);  p polytope
     2954RETURN:  1, if p is reflexive; 0 otherwise
     2955EXAMPLE: example isReflexive; shows an example
     2956"
     2957{
     2958
     2959}
     2960example
     2961{
     2962  "EXAMPLE:"; echo = 2;
     2963  intmat M[4][4]=
     2964    1,1,0,0,
     2965    1,0,1,0,
     2966    1,0,0,1,
     2967    1,-1,-1,-1;
     2968  polytope p = polytopeViaPoints(M);
     2969  isReflexive(p);
     2970  intmat N[4][4]=
     2971    1,2,0,0,
     2972    1,0,2,0,
     2973    1,0,0,2,
     2974    1,-2,-2,-2;
     2975  polytope q = polytopeViaPoints(M);
     2976  isReflexive(q);
     2977}
     2978
     2979proc isSmooth()
     2980"USAGE:   isSmooth(c);  c cone
     2981         isSmooth(f);  f fan
     2982         isSmooth(p);  p polytope
     2983RETURN:  1, if the input is smooth; 0 otherwise
     2984EXAMPLE: example isSmooth; shows an example
     2985"
     2986{
     2987
     2988}
     2989example
     2990{
     2991  "EXAMPLE:"; echo = 2;
     2992  intmat M1[2][2]=
     2993    1,0,
     2994    0,1;
     2995  cone c1 = coneViaPoints(M1);
     2996  isSmooth(c1);
     2997  intmat M2[3][3]=
     2998    1,0,
     2999    1,2;
     3000  cone c2 = coneViaPoints(M2);
     3001  fan F1 = emptyFan(2);
     3002  insertCone(F1,c1);
     3003  isSmooth(F1);
     3004  fan F2 = emptyFan(3);
     3005  insertCone(F2,c2);
     3006  isSmooth(F2);
     3007  intmat Mp[3][3]=
     3008    1,-2,-3,
     3009    1,1,0,
     3010    1,0,1;
     3011  polytope p = polytopeViaPoints(Mp);
     3012  isSmooth(p);
     3013  fan F = normalFan(p);
     3014  isSmooth(F);
     3015  intmat Mq[4][3]=
     3016    1,2,0,
     3017    1,0,1,
     3018    1,2,1,
     3019    1,0,0;
     3020  polytope q = polytopeViaPoints(Mq);
     3021  isSmooth(q);
     3022}
     3023
     3024proc isTerminal()
     3025"USAGE:   isTerminal(p);  p polytope
     3026RETURN:  1, if p has exactly one interior lattice point and all other lattice points are vertices; 0 otherwise
     3027EXAMPLE: example isTerminal; shows an example
     3028"
     3029{
     3030
     3031}
     3032example
     3033{
     3034  "EXAMPLE:"; echo = 2;
     3035  intmat M[6][4]=
     3036    1,1,1,2,
     3037    1,-1,-1,-2,
     3038    1,1,0,0,
     3039    1,-1,0,0,
     3040    1,0,1,0,
     3041    1,0,-1,0;
     3042  polytope p = polytopeViaPoints(M);
     3043  isTerminal(p);
     3044  isReflexive(p);
     3045  intmat N[6][4]=
     3046    1,1,1,2,
     3047    1,-1,-1,-2,
     3048    1,1,1,0,
     3049    1,-1,-1,0,
     3050    1,-1,1,0,
     3051    1,1,-1,0;
     3052  polytope q = polytopeViaPoints(N);
     3053  isTerminal(q);
     3054  isCanonical(q);
     3055}
     3056
     3057proc isVeryAmple()
     3058"USAGE:   isVeryAmple(p);  p polytope
     3059RETURN:  1, if p is very ample; 0 otherwise
     3060EXAMPLE: example isVeryAmple; shows an example
     3061"
     3062{
     3063
     3064}
     3065example
     3066{
     3067  "EXAMPLE:"; echo = 2;
     3068  intmat M[3][3]=
     3069    1,1,0,
     3070    1,0,1,
     3071    1,-1,-1;
     3072  polytope p = polytopeViaPoints(M);
     3073  isVeryAmple(p);
     3074  intmat N[3][4]=
     3075    1,1,0,0,
     3076    1,0,1,0,
     3077    1,1,1,2;
     3078  polytope q = polytopeViaPoints(N);
     3079  isVeryAmple(q);
     3080}
     3081
     3082proc latticeCodegree()
     3083"USAGE:   latticeCodegree(p);  p polytope
     3084RETURN:  int, the smalles number n such that n*p has a relative interior lattice point
     3085NOTE:    dimension(p)+1==latticeDegree(p)+latticeCodegree(p)
     3086EXAMPLE: example latticeCodegree; shows an example
     3087"
     3088{
     3089
     3090}
     3091example
     3092{
     3093  "EXAMPLE:"; echo = 2;
     3094  intmat M[4][3]=
     3095    1,1,0,
     3096    1,1,1,
     3097    1,0,1,
     3098    1,0,0;
     3099  polytope p = polytopeViaPoints(M);
     3100  latticeCodegree(p);
     3101  intmat N[4][4]=
     3102    1,1,0,0,
     3103    1,0,1,0,
     3104    1,0,0,1,
     3105    1,0,0,0;
     3106  polytope q = polytopeViaPoints(N);
     3107  latticeCodegree(q);
     3108}
     3109
     3110proc latticeDegree()
     3111"USAGE:   latticeDegree(p);  p polytope
     3112RETURN:  int, the degree of the Ehrhart polynomial of p
     3113NOTE:    dimension(p)+1==latticeDegree(p)+latticeCodegree(p)
     3114EXAMPLE: example latticeDegree; shows an example
     3115"
     3116{
     3117
     3118}
     3119example
     3120{
     3121  "EXAMPLE:"; echo = 2;
     3122  intmat M[4][3]=
     3123    1,1,0,
     3124    1,1,1,
     3125    1,0,1,
     3126    1,0,0;
     3127  polytope p = polytopeViaPoints(M);
     3128  latticeDegree(p);
     3129  intmat N[4][4]=
     3130    1,1,0,0,
     3131    1,0,1,0,
     3132    1,0,0,1,
     3133    1,0,0,0;
     3134  polytope q = polytopeViaPoints(N);
     3135  latticeDegree(q);
     3136}
     3137
     3138proc latticePoints()
     3139"USAGE:   latticePoints(p);  p polytope
     3140ASSUME:  isBounded(p)==1
     3141RETURN:  intmat, all lattice points in p
     3142EXAMPLE: example latticePoints; shows an example
     3143"
     3144{
     3145
     3146}
     3147example
     3148{
     3149  "EXAMPLE:"; echo = 2;
     3150  intmat M[3][3]=
     3151    1,2,-1,
     3152    1,-1,2,
     3153    1,-1,-1;
     3154  polytope p = polytopeViaPoints(M);
     3155  latticePoints(p);
     3156  intmat N[2][3]=
     3157    1,2,0,
     3158    1,0,2;
     3159  polytope q = polytopeViaPoints(N);
     3160  latticePoints(q);
     3161}
     3162
     3163proc latticeVolume()
     3164"USAGE:   latticeVolume(p);  p polytope
     3165ASSUME:  isBounded(p)==1
     3166RETURN:  int, the lattice volume of p
     3167EXAMPLE: example latticeVolume; shows an example
     3168"
     3169{
     3170
     3171}
     3172example
     3173{
     3174  "EXAMPLE:"; echo = 2;
     3175  intmat M[4][3]=
     3176    1,1,0,
     3177    1,1,1,
     3178    1,0,1,
     3179    1,0,0;
     3180  polytope p = polytopeViaPoints(M);
     3181  latticeVolume(p);
     3182  intmat N[4][3]=
     3183    1,1,0,
     3184    1,2,1,
     3185    1,0,1,
     3186    1,0,0;
     3187  polytope q = polytopeViaPoints(N);
     3188  latticeVolume(q);
     3189  intmat W[4][4]=
     3190    1,1,0,0,
     3191    1,0,1,0,
     3192    1,0,0,1,
     3193    1,0,0,0;
     3194  polytope r = polytopeViaPoints(W);
     3195  latticeVolume(r);
     3196}
     3197
     3198proc maximalFace()
     3199"USAGE:   maximalFace(p,v);  p polytope, v intvec
     3200ASSUME:  v lies in the negative dual tail cone of p
     3201RETURN:  intmat, vertices of the face of p on which the linear form v is maximal
     3202NOTE:    the maximal face is independent of the first coordinate of v
     3203         since p is considered as a polytope in the plane (first coordinate) = 1.
     3204EXAMPLE: example maximalFace; shows an example
     3205"
     3206{
     3207
     3208}
     3209example
     3210{
     3211  "EXAMPLE:"; echo = 2;
     3212  intmat M[3][3]=
     3213    1,1,0,
     3214    1,0,1,
     3215    1,-1,-1;
     3216  intvec v = 0,1,1;
     3217  polytope p = polytopeViaPoints(M);
     3218  maximalFace(p,v);
     3219  intvec w = -5,1,1;
     3220  maximalFace(p,w);
     3221}
     3222
     3223proc maximalValue()
     3224"USAGE:   maximalValue(p,v);  p polytope, v intvec
     3225ASSUME:  v lies in the negative dual tail cone of p
     3226RETURN:  intmat, vertices of the face of p on which the linear form v is maximal
     3227NOTE:    first coordinate of v corresponds to a shift of the maximal value
     3228         since p is considered as a polytope in the plane (first coordinate) = 1.
     3229EXAMPLE: example maximalValue; shows an example
     3230"
     3231{
     3232
     3233}
     3234example
     3235{
     3236  "EXAMPLE:"; echo = 2;
     3237  intmat M[3][3]=
     3238    1,1,0,
     3239    1,0,1,
     3240    1,-1,-1;
     3241  intvec v = 0,1,1;
     3242  polytope p = polytopeViaPoints(M);
     3243  maximalValue(p,v);
     3244  intvec w = -5,1,1;
     3245  maximalValue(p,w);
     3246}
     3247
     3248proc minimalFace()
     3249"USAGE:   minimalFace(p,v);  p polytope, v intvec
     3250ASSUME:  v lies in the dual tail cone of p
     3251RETURN:  intmat, vertices of the face of p on which the linear form v is minimal
     3252NOTE:    the minimal face is independent of the first coordinate of v
     3253         since p is considered as a polytope in the plane (first coordinate) = 1.
     3254EXAMPLE: example minimalFace; shows an example
     3255"
     3256{
     3257
     3258}
     3259example
     3260{
     3261  "EXAMPLE:"; echo = 2;
     3262  intmat M[3][3]=
     3263    1,1,0,
     3264    1,0,1,
     3265    1,-1,-1;
     3266  intvec v = 0,-1,-1;
     3267  polytope p = polytopeViaPoints(M);
     3268  minimalFace(p,v);
     3269  intvec w = 5,-1,-1;
     3270  minimalFace(p,w);
     3271}
     3272
     3273proc minimalValue()
     3274"USAGE:   minimalValue(p,v);  p polytope, v intvec
     3275ASSUME:  v lies in the negative dual tail cone of p
     3276RETURN:  intmat, vertices of the face of p on which the linear form v is minimal
     3277NOTE:    first coordinate of v corresponds to a shift of the minimal value
     3278         since p is considered as a polytope in the plane (first coordinate) = 1.
     3279EXAMPLE: example minimalValue; shows an example
     3280"
     3281{
     3282
     3283}
     3284example
     3285{
     3286  "EXAMPLE:"; echo = 2;
     3287  intmat M[3][3]=
     3288    1,1,0,
     3289    1,0,1,
     3290    1,-1,-1;
     3291  intvec v = 0,-1,-1;
     3292  polytope p = polytopeViaPoints(M);
     3293  minimalValue(p,v);
     3294  intvec w = 5,-1,-1;
     3295  minimalValue(p,w);
     3296}
     3297
     3298proc minkowskiSum()
     3299"USAGE:   minkowskiSum(c,d);  c cone, d cone
     3300         minkowskiSum(c,q);  c cone, q polytope
     3301         minkowskiSum(p,d);  p polytope, d cone
     3302         minkowskiSum(p,q);  p polytope, q polytope
     3303ASSUME:  input arguments have the same ambient dimension
     3304RETURN:  cone, if both inputs are cones; polytope, otherwise
     3305         the minkowski sum of the two input arguments
     3306EXAMPLE: example minkowskiSum; shows an example
     3307"
     3308{
     3309
     3310}
     3311example
     3312{
     3313  "EXAMPLE:"; echo = 2;
     3314  intmat M[3][4]=
     3315    1,1,0,0,
     3316    1,0,1,0,
     3317    1,0,0,0;
     3318  intmat N[3][4]=
     3319    1,0,0,1,
     3320    1,-1,-1,-1,
     3321    1,0,0,0;
     3322  polytope p = polytopeViaPoints(M);
     3323  polytope q = polytopeViaPoints(N);
     3324  vertices(minkowskiSum(p,q));
     3325}
     3326
     3327proc nBoundaryLatticePoints()
     3328"USAGE:   nBoundaryLatticePoints(p);  p polytope
     3329ASSUME:  isBounded(p)==1
     3330RETURN:  int, the number of lattice points in the relative boundary of p
     3331EXAMPLE: example nBoundaryLatticePoints; shows an example
     3332"
     3333{
     3334
     3335}
     3336example
     3337{
     3338  "EXAMPLE:"; echo = 2;
     3339  intmat M[3][3]=
     3340    1,2,-1,
     3341    1,-1,2,
     3342    1,-1,-1;
     3343  polytope p = polytopeViaPoints(M);
     3344  nBoundaryLatticePoints(p);
     3345  intmat N[2][3]=
     3346    1,2,0,
     3347    1,0,2;
     3348  polytope q = polytopeViaPoints(N);
     3349  nBoundaryLatticePoints(q);
     3350}
     3351
     3352proc nHilbertBasis()
     3353"USAGE:   nHilbertBasis(c);  c cone
     3354RETURN:  int, the number of elements in the Hilbert basis of c intersected with Z^n
     3355EXAMPLE: example nHilbertBasis; shows an example
     3356"
     3357{
     3358
     3359}
     3360example
     3361{
     3362  "EXAMPLE:"; echo = 2;
     3363  intmat M[3][3]=
     3364    1,2,-1,
     3365    1,-1,2,
     3366    1,-1,-1;
     3367  cone c = coneViaPoints(M);
     3368  nHilbertBasis(c);
     3369}
     3370
     3371proc nInteriorLatticePoints()
     3372"USAGE:   nInteriorLatticePoints(p);  p polytope
     3373ASSUME:  isBounded(p)==1
     3374RETURN:  int, the number of lattice points in the relative interior of p
     3375EXAMPLE: example nInteriorLatticePoints; shows an example
     3376"
     3377{
     3378
     3379}
     3380example
     3381{
     3382  "EXAMPLE:"; echo = 2;
     3383  intmat M[3][3]=
     3384    1,2,-1,
     3385    1,-1,2,
     3386    1,-1,-1;
     3387  polytope p = polytopeViaPoints(M);
     3388  nInteriorLatticePoints(p);
     3389  intmat N[2][3]=
     3390    1,2,0,
     3391    1,0,2;
     3392  polytope q = polytopeViaPoints(N);
     3393  nInteriorLatticePoints(q);
     3394}
     3395
     3396proc nLatticePoints()
     3397"USAGE:   nLatticePoints(p);  p polytope
     3398ASSUME:  isBounded(p)==1
     3399RETURN:  intmat, the number of lattice points in p
     3400EXAMPLE: example nLatticePoints; shows an example
     3401"
     3402{
     3403
     3404}
     3405example
     3406{
     3407  "EXAMPLE:"; echo = 2;
     3408  intmat M[3][3]=
     3409    1,2,-1,
     3410    1,-1,2,
     3411    1,-1,-1;
     3412  polytope p = polytopeViaPoints(M);
     3413  nLatticePoints(p);
     3414  intmat N[2][3]=
     3415    1,2,0,
     3416    1,0,2;
     3417  polytope q = polytopeViaPoints(N);
     3418  nLatticePoints(q);
     3419}
     3420
     3421proc normalFan()
     3422"USAGE:   normalFan(p);  p polytope
     3423RETURN:  fan, the normal fan of p
     3424EXAMPLE: example normalFan; shows an example
     3425"
     3426{
     3427
     3428}
     3429example
     3430{
     3431  "EXAMPLE:"; echo = 2;
     3432  intmat M[6][4] =
     3433    1,1,0,0,
     3434    1,0,1,0,
     3435    1,0,-1,0,
     3436    1,0,0,1,
     3437    1,0,0,-1,
     3438    1,-1,0,0;
     3439  polytope p = polytopeViaPoints(M);
     3440  normalFan(p);
     3441}
     3442
     3443proc vertexAdjacencyGraph()
     3444"USAGE:   vertexAdjacencyGraph(p);  p polytope
     3445RETURN:  list, the first entry is a bigintmat containing all vertices as row vectors, and therefore assigning all vertices an integer.
     3446               the second entry is a list of intvecs representing the adjacency graph of the vertices of p,
     3447               the intvec in position i contains all vertices j which are connected to vertex i via an edge of p.
     3448EXAMPLE: example vertexAdjacencyGraph; shows an example
     3449"
     3450{
     3451
     3452}
     3453example
     3454{
     3455  "EXAMPLE:"; echo = 2;
     3456  intmat M[6][4] =
     3457    1,1,0,0,
     3458    1,0,1,0,
     3459    1,0,-1,0,
     3460    1,0,0,1,
     3461    1,0,0,-1,
     3462    1,-1,0,0;
     3463  polytope p = polytopeViaPoints(M);
     3464  vertexAdjacencyGraph(p);
     3465}
     3466
     3467proc vertexEdgeGraph()
     3468"USAGE:   vertexEdgeGraph(p);  p polytope
     3469RETURN:  list, the first entry is a bigintmat containing all vertices as row vectors, and therefore assigning all vertices an integer.
     3470               the second entry is a list of intvecs representing the edge graph of the vertices of p,
     3471               each intvec represents an edge of p connecting vertex i with vertex j.
     3472EXAMPLE: example vertexEdgeGraph; shows an example
     3473"
     3474{
     3475
     3476}
     3477example
     3478{
     3479  "EXAMPLE:"; echo = 2;
     3480  intmat M[6][4] =
     3481    1,1,0,0,
     3482    1,0,1,0,
     3483    1,0,-1,0,
     3484    1,0,0,1,
     3485    1,0,0,-1,
     3486    1,-1,0,0;
     3487  polytope p = polytopeViaPoints(M);
     3488  vertexEdgeGraph(p);
     3489}
     3490
     3491
     3492proc visual()
     3493"USAGE:   visual(f);  f fan
     3494         visual(p);  p polytope
     3495ASSUME:  ambientDimension(f) resp ambientDimension(p) less or equal 3
     3496RETURN:  none
     3497EXAMPLE: example visual; shows an example
     3498"
     3499{
     3500
     3501}
     3502example
     3503{
     3504  "EXAMPLE:"; echo = 2;
     3505  intmat M[6][4] =
     3506    1,1,0,0,
     3507    1,0,1,0,
     3508    1,0,-1,0,
     3509    1,0,0,1,
     3510    1,0,0,-1,
     3511    1,-1,0,0;
     3512  polytope p = polytopeViaPoints(M);
     3513  // visual(p);
     3514  fan f = normalFan(p);
     3515  // visual(f);
     3516}
Note: See TracChangeset for help on using the changeset viewer.