Changeset 8275a9 in git


Ignore:
Timestamp:
Nov 22, 2013, 5:41:38 PM (9 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '48f1dd268d0ff74ef2f7dccbf02545425002ddcc')
Children:
9e8ae12733559521215c7641624da588f2d8cdf3
Parents:
3c3e3de41fd6ba44babbfa0c6384b376182586ee
git-author:
Yue Ren <ren@mathematik.uni-kl.de>2013-11-22 17:41:38+01:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2013-12-11 17:46:46+01:00
Message:
chg: trying up oldpolymake.lib

    - renamed procedures that conflicted with procedures in polymake.so
    - fixed remaining mistakes in library due to bigintmats where previously only intmats were expected
    - renamed it back to polymake.lib

    the rename to oldpolymake.lib only happened because initially it was planned to call the polymake kernel interface polymake.lib, since it is easier for the users to not distinguish between interpreter libraries and shared objects and due to a misconception that polymake.lib was a pure interface to polymake. Since both proved to be wrong, I decided to undo the name change.
Files:
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • Singular/LIB/COPYING

    r3c3e3d r8275a9  
    134134paramet.lib     Thomas Keilen                   keilen@mathematik.uni-kl.de
    135135perron.lib      Oleksandr Motsak                motsak at mathematik dot uni minus kl dot de
    136 phindex.lib 
     136phindex.lib
    137137pointid.lib     Stefan Steidel                  steidel@mathematik.uni-kl.de
    138138poly.lib        Olaf Bachmann                   obachman@mathematik.uni-kl.de
    139139                Gert-Martin Greuel              greuel@mathematik.uni-kl.de
    140140                Anne Fruehbis-Krueger           anne@mathematik.uni-kl.de
    141 oldpolymake.lib Thomas Markwig                  keilen@mathematik.uni-kl.de
     141polymake.lib    Thomas Markwig                  keilen@mathematik.uni-kl.de
    142142presolve.lib    Gert-Martin Greuel              greuel@mathematik.uni-kl.de
    143143primdec.lib     Gerhard Pfister                 pfister@mathematik.uni-kl.de
  • Singular/LIB/polymake.lib

    r3c3e3d r8275a9  
    22category="Tropical Geometry";
    33info="
    4 LIBRARY:   oldpolymake.lib    Computations with polytopes and fans,
    5                               interface to polymake and TOPCOM
     4LIBRARY:   polymake.lib    Computations with polytopes and fans,
     5                           interface to polymake and TOPCOM
    66AUTHOR:    Thomas Markwig,  email: keilen@mathematik.uni-kl.de
    77
     
    1515   length and labeling of their vertices resp. rays, differs from the conventions
    1616   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 
     17   extension polymake.so of Singular. We recommend to use the newer polymake.so
    1818   whenever possible.
    1919
    2020IMPORTANT NOTE:
    21    Even though this is a Singular library for computing polytopes and fans 
    22    such as the Newton polytope or the Groebner fan of a polynomial, most of 
    23    the hard computations are NOT done by Singular but by the program 
     21   Even though this is a Singular library for computing polytopes and fans
     22   such as the Newton polytope or the Groebner fan of a polynomial, most of
     23   the hard computations are NOT done by Singular but by the program
    2424@* - polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt
    25 @*   (see http://www.math.tu-berlin.de/polymake/), 
     25@*   (see http://www.math.tu-berlin.de/polymake/),
    2626@* respectively (only in the procedure triangulations) by the program
    2727@* - topcom by Joerg Rambau, Universitaet Bayreuth (see
    2828@*   http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/TOPCOM);
    29 @*   this library should rather be seen as an interface which allows to use a 
    30      (very limited) number of options which polymake respectively topcom offers 
    31      to compute with polytopes and fans and to make the results available in 
    32      Singular for further computations; 
     29@*   this library should rather be seen as an interface which allows to use a
     30     (very limited) number of options which polymake respectively topcom offers
     31     to compute with polytopes and fans and to make the results available in
     32     Singular for further computations;
    3333     moreover, the user familiar with Singular does not have to learn the syntax
    34      of polymake or topcom, if the options offered here are sufficient for his 
     34     of polymake or topcom, if the options offered here are sufficient for his
    3535     purposes.
    36 @*   Note, though, that the procedures concerned with planar polygons are 
     36@*   Note, though, that the procedures concerned with planar polygons are
    3737     independent of both, polymake and topcom.
    3838
    3939PROCEDURES USING POLYMAKE:
    4040  polymakePolytope()  computes the vertices of a polytope using polymake
    41   newtonPolytope()    computes the Newton polytope of a polynomial
     41  newtonPolytopeP()    computes the Newton polytope of a polynomial
    4242  newtonPolytopeLP()  computes the lattice points of the Newton polytope
    43   normalFan()         computes the normal fan of a polytope
     43  normalFanL()         computes the normal fan of a polytope
    4444  groebnerFan()       computes the Groebner fan of a polynomial
    4545
     
    5252
    5353PROCEDURES CONERNED WITH PLANAR POLYGONS:
    54   cycleLength()    computes the cycleLength of cycle 
     54  cycleLength()    computes the cycleLength of cycle
    5555  splitPolygon()   splits a marked polygon into vertices, facets, interior points
    5656  eta()            computes the eta-vector of a triangulation
    57   findOrientedBoundary()  computes the boundary of a convex hull 
     57  findOrientedBoundary()  computes the boundary of a convex hull
    5858  cyclePoints()    computes lattice points connected to some lattice point
    5959  latticeArea()    computes the lattice area of a polygon
     
    6363
    6464KEYWORDS:    polytope; fan; secondary fan; secondary polytope; polymake;
    65              Newton polytope; Groebner fan 
     65             Newton polytope; Groebner fan
    6666";
    6767
     
    101101proc polymakePolytope (intmat points)
    102102"USAGE:  polymakePolytope(points);   polytope intmat
    103 ASSUME:  each row of points gives the coordinates of a lattice point of a 
    104          polytope with their affine coordinates as given by the output of 
     103ASSUME:  each row of points gives the coordinates of a lattice point of a
     104         polytope with their affine coordinates as given by the output of
    105105         secondaryPolytope
    106 PURPOSE: the procedure calls polymake to compute the vertices of the polytope 
     106PURPOSE: the procedure calls polymake to compute the vertices of the polytope
    107107         as well as its dimension and information on its facets
    108108RETURN:  list, L with four entries
    109109@*            L[1] : an integer matrix whose rows are the coordinates of vertices
    110                      of the polytope 
     110                     of the polytope
    111111@*            L[2] : the dimension of the polytope
    112 @*            L[3] : a list whose ith entry explains to which vertices the 
    113                      ith vertex of the Newton polytope is connected 
    114                      -- i.e. L[3][i] is an integer vector and an entry k in 
    115                         there means that the vertex L[1][i] is connected to the 
     112@*            L[3] : a list whose ith entry explains to which vertices the
     113                     ith vertex of the Newton polytope is connected
     114                     -- i.e. L[3][i] is an integer vector and an entry k in
     115                        there means that the vertex L[1][i] is connected to the
    116116                        vertex L[1][k]
    117 @*            L[4] : an matrix of type bigintmat whose rows mulitplied by 
    118                      (1,var(1),...,var(nvar)) give a linear system of equations 
     117@*            L[4] : an matrix of type bigintmat whose rows mulitplied by
     118                     (1,var(1),...,var(nvar)) give a linear system of equations
    119119                     describing the affine hull of the polytope,
    120120                     i.e. the smallest affine space containing the polytope
    121 NOTE: -  for its computations the procedure calls the program polymake by 
    122          Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt; 
    123          it therefore is necessary that this program is installed in order 
     121NOTE: -  for its computations the procedure calls the program polymake by
     122         Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt;
     123         it therefore is necessary that this program is installed in order
    124124         to use this procedure;
    125125         see http://www.math.tu-berlin.de/polymake/
    126 @*    -  note that in the vertex edge graph we have changed the polymake 
    127          convention which starts indexing its vertices by zero while we start 
     126@*    -  note that in the vertex edge graph we have changed the polymake
     127         convention which starts indexing its vertices by zero while we start
    128128         with one !
    129129EXAMPLE: example polymakePolytope;   shows an example"
     
    147147   "EXAMPLE:";
    148148   echo=2;
    149    // the lattice points of the unit square in the plane 
     149   // the lattice points of the unit square in the plane
    150150   list points=intvec(0,0),intvec(0,1),intvec(1,0),intvec(1,1);
    151151   // the secondary polytope of this lattice point configuration is computed
     
    167167/////////////////////////////////////////////////////////////////////////////
    168168
    169 proc newtonPolytope (poly f)
    170 "USAGE: newtonPolytope(f);  f poly
     169proc newtonPolytopeP (poly f)
     170"USAGE: newtonPolytopeP(f);  f poly
    171171RETURN: list, L with four entries
    172172@*            L[1] : an integer matrix whose rows are the coordinates of vertices
    173173                     of the Newton polytope of f
    174174@*            L[2] : the dimension of the Newton polytope of f
    175 @*            L[3] : a list whose ith entry explains to which vertices the 
    176                      ith vertex of the Newton polytope is connected 
    177                      -- i.e. L[3][i] is an integer vector and an entry k in 
     175@*            L[3] : a list whose ith entry explains to which vertices the
     176                     ith vertex of the Newton polytope is connected
     177                     -- i.e. L[3][i] is an integer vector and an entry k in
    178178                        there means that the vertex L[1][i] is
    179179                        connected to the vertex L[1][k]
    180 @*            L[4] : an matrix of type bigintmat whose rows mulitplied by 
    181                      (1,var(1),...,var(nvar)) give a linear system of equations 
     180@*            L[4] : an matrix of type bigintmat whose rows mulitplied by
     181                     (1,var(1),...,var(nvar)) give a linear system of equations
    182182                     describing the affine hull of the Newton polytope, i.e. the
    183183                     smallest affine space containing the Newton polytope
    184 NOTE: -  if we replace the first column of L[4] by zeros, i.e. if we move 
    185          the affine hull to the origin, then we get the equations for the 
    186          orthogonal complement of the linearity space of the normal fan dual 
     184NOTE: -  if we replace the first column of L[4] by zeros, i.e. if we move
     185         the affine hull to the origin, then we get the equations for the
     186         orthogonal complement of the linearity space of the normal fan dual
    187187         to the Newton polytope, i.e. we get the EQUATIONS that
    188188         we need as input for polymake when computing the normal fan
     
    190190         TU Berlin and Michael Joswig, so it only works if polymake is installed;
    191191         see http://www.math.tu-berlin.de/polymake/
    192 EXAMPLE: example newtonPolytope;   shows an example"
     192EXAMPLE: example newtonPolytopeP;   shows an example"
    193193{
    194194  int i,j;
    195   // compute the list of exponent vectors of the polynomial, 
     195  // compute the list of exponent vectors of the polynomial,
    196196  // which are the lattice points
    197197  // whose convex hull is the Newton polytope of f
     
    214214   poly f=y3+x2+xy+2xz+yz+z2+1;
    215215   // the Newton polytope of f is
    216    list np=newtonPolytope(f);
     216   list np=newtonPolytopeP(f);
    217217   // the vertices of the Newton polytope are:
    218218   np[1];
     
    220220   np[2];
    221221   // np[3] contains information how the vertices are connected to each other,
    222    // e.g. the first vertex (number 0) is connected to the second, third and 
     222   // e.g. the first vertex (number 0) is connected to the second, third and
    223223   //      fourth vertex
    224224   np[3][1];
     
    226226   f=x2-y3;
    227227   // the Newton polytope of f is
    228    np=newtonPolytope(f);
     228   np=newtonPolytopeP(f);
    229229   // the vertices of the Newton polytope are:
    230230   np[1];
    231231   // its dimension is
    232    np[2];   
    233    // the Newton polytope is contained in the affine space given 
     232   np[2];
     233   // the Newton polytope is contained in the affine space given
    234234   //     by the equations
    235235   intmat(np[4])*M;
     
    240240proc newtonPolytopeLP (poly f)
    241241"USAGE:  newtonPolytopeLP(f);  f poly
    242 RETURN: list, the exponent vectors of the monomials occuring in f, 
     242RETURN: list, the exponent vectors of the monomials occuring in f,
    243243              i.e. the lattice points of the Newton polytope of f
    244 EXAMPLE: example normalFan;   shows an example"
     244EXAMPLE: example newtonPolytopeLP;   shows an example"
    245245{
    246246  list np;
     
    266266/////////////////////////////////////////////////////////////////////////////
    267267
    268 proc normalFan (def vertices, def affinehull,list graph,int er,list #)
    269 "USAGE:  normalFan (vert,aff,graph,rays,[,#]);   vert,aff intmat,  graph list, rays int, # string
    270 ASSUME:  - vert is an integer matrix whose rows are the coordinate of 
    271            the vertices of a convex lattice polytope; 
     268proc 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
     270ASSUME:  - vert is an integer matrix whose rows are the coordinate of
     271           the vertices of a convex lattice polytope;
    272272@*       - aff describes the affine hull of this polytope, i.e.
    273            the smallest affine space containing it, in the following sense: 
    274            denote by n the number of columns of vert, then multiply aff by 
    275            (1,x(1),...,x(n)) and set the resulting terms to zero in order to 
     273           the smallest affine space containing it, in the following sense:
     274           denote by n the number of columns of vert, then multiply aff by
     275           (1,x(1),...,x(n)) and set the resulting terms to zero in order to
    276276           get the equations for the affine hull;
    277 @*       - the ith entry of graph is an integer vector describing to which 
    278            vertices the ith vertex is connected, i.e. a k as entry means that 
     277@*       - the ith entry of graph is an integer vector describing to which
     278           vertices the ith vertex is connected, i.e. a k as entry means that
    279279           the vertex vert[i] is connected to vert[k];
    280 @*       - the integer rays is either one (if the extreme rays should be 
     280@*       - the integer rays is either one (if the extreme rays should be
    281281           computed) or zero (otherwise)
    282 RETURN:  list, the ith entry of L[1] contains information about the cone in the 
    283                normal fan dual to the ith vertex of the polytope 
    284 @*             L[1][i][1] = integer matrix representing the inequalities which 
     282RETURN:  list, the ith entry of L[1] contains information about the cone in the
     283               normal fan dual to the ith vertex of the polytope
     284@*             L[1][i][1] = integer matrix representing the inequalities which
    285285                            describe the cone dual to the ith vertex
    286 @*             L[1][i][2] = a list which contains the inequalities represented 
    287                             by L[i][1] as a list of strings, where we use the 
     286@*             L[1][i][2] = a list which contains the inequalities represented
     287                            by L[i][1] as a list of strings, where we use the
    288288                            variables x(1),...,x(n)
    289289@*             L[1][i][3] = only present if 'er' is set to 1; in that case it is
    290                             an interger matrix whose rows are the extreme rays 
     290                            an interger matrix whose rows are the extreme rays
    291291                            of the cone
    292 @*             L[2] = is an integer matrix whose rows span the linearity space 
    293                       of the fan, i.e. the linear space which is contained in 
     292@*             L[2] = is an integer matrix whose rows span the linearity space
     293                      of the fan, i.e. the linear space which is contained in
    294294                      each cone
    295295NOTE:    - the procedure calls for its computation polymake by Ewgenij Gawrilow,
    296            TU Berlin and Michael Joswig, so it only works if polymake is 
     296           TU Berlin and Michael Joswig, so it only works if polymake is
    297297           installed;
    298298           see http://www.math.tu-berlin.de/polymake/
    299 @*       - in the optional argument # it is possible to hand over other names 
     299@*       - in the optional argument # it is possible to hand over other names
    300300           for the variables to be used -- be careful, the format must be correct
    301            and that is not tested, e.g. if you want the variable names to be 
     301           and that is not tested, e.g. if you want the variable names to be
    302302           u00,u10,u01,u11 then you must hand over the string u11,u10,u01,u11
    303 EXAMPLE: example normalFan;   shows an example"
     303EXAMPLE: example normalFanL;   shows an example"
    304304{
    305305  if (typeof(affinehull) != "intmat" && typeof (affinehull) != "bigintmat")
    306306  {
    307     ERROR("normalFan: input affinehull has to be either intmat or bigintmat");
     307    ERROR("normalFanL: input affinehull has to be either intmat or bigintmat");
    308308    list L;
    309309    return (L);
     
    311311  list ineq; // stores the inequalities of the cones
    312312  int i,j,k;
    313   // we work over the following ring 
     313  // we work over the following ring
    314314  execute("ring ineqring=0,x(1.."+string(ncols(vertices))+"),lp;");
    315315  string greatersign=">";
     
    336336  for (i=1;i<=nrows(vertices);i++)
    337337  {
    338     // first we produce for each vertex in the polytope 
     338    // first we produce for each vertex in the polytope
    339339    // the inequalities describing the dual cone in the normal fan
    340     list pp;  // contain strings representing the inequalities 
     340    list pp;  // contain strings representing the inequalities
    341341              // describing the normal cone
    342342    if (typeof (vertices) == "intmat")
    343343    {
    344       intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities 
     344      intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities
    345345    }                                             // as rows
    346346    if (typeof (vertices) == "bigintmat")
    347347    {
    348       bigintmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities 
     348      bigintmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities
    349349    }                                                // as rows
    350     // consider all the vertices to which the ith vertex in the 
     350    // consider all the vertices to which the ith vertex in the
    351351    // polytope is connected by an edge
    352352    for (j=1;j<=size(graph[i]);j++)
    353353    {
    354354      // produce the vector ie_j pointing from the jth vertex to the ith vertex;
    355       // this will be the jth inequality for the cone in the normal fan dual to 
     355      // this will be the jth inequality for the cone in the normal fan dual to
    356356      // the ith vertex
    357357      ie[j,1..ncols(vertices)]=vertices[i,1..ncols(vertices)]-vertices[graph[i][j],1..ncols(vertices)];
     
    360360      p=(VAR*EXP)[1,1];
    361361      pl,pr=0,0;
    362       // separate the terms with positive coefficients in p from 
     362      // separate the terms with positive coefficients in p from
    363363      // those with negative coefficients
    364364      for (k=1;k<=size(p);k++)
     
    373373        }
    374374      }
    375       // build the string which represents the jth inequality 
     375      // build the string which represents the jth inequality
    376376      // for the cone dual to the ith vertex
    377       // as polynomial inequality of type string, and store this 
     377      // as polynomial inequality of type string, and store this
    378378      // in the list pp as jth entry
    379379      pp[j]=string(pl)+" "+greatersign+" "+string(pr);
     
    384384  }
    385385  // remove the first column of affine hull to compute the linearity space
    386   intmat linearity[1][ncols(vertices)];
     386  bigintmat linearity[1][ncols(vertices)];
    387387  if (nrows(affinehull)>0)
    388388  {
     
    396396    list extremerays; // keeps the result
    397397    cone kegel;
    398     intmat linearspan=intmatAddFirstColumn(linearity,"rays");
     398    bigintmat linearspan=intmatAddFirstColumn(linearity,"rays");
    399399    intmat M; // the matrix keeping the inequalities
    400400    for (i=1;i<=size(ineq);i++)
     
    409409  }
    410410  // get the linearity space
    411   return(list(ineq,linearity)); 
     411  return(list(ineq,linearity));
    412412}
    413413example
     
    419419   poly f=y3+x2+xy+2xz+yz+z2+1;
    420420   // the Newton polytope of f is
    421    list np=newtonPolytope(f);
     421   list np=newtonPolytopeP(f);
    422422   // the Groebner fan of f, i.e. the normal fan of the Newton polytope
    423    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");
    424424   // the number of cones in the Groebner fan of f is:
    425425   size(gf[1]);
     
    438438proc groebnerFan (poly f)
    439439"USAGE:  groebnerFan(f);  f poly
    440 RETURN:  list, the ith entry of L[1] contains information about the ith cone 
    441                in the Groebner fan dual to the ith vertex in the Newton 
     440RETURN:  list, the ith entry of L[1] contains information about the ith cone
     441               in the Groebner fan dual to the ith vertex in the Newton
    442442               polytope of the f
    443 @*             L[1][i][1] = integer matrix representing the inequalities 
    444                             which describe the cone         
    445 @*             L[1][i][2] = a list which contains the inequalities represented 
     443@*             L[1][i][1] = integer matrix representing the inequalities
     444                            which describe the cone
     445@*             L[1][i][2] = a list which contains the inequalities represented
    446446                            by L[1][i][1] as a list of strings
    447 @*             L[1][i][3] = an interger matrix whose rows are the extreme rays 
     447@*             L[1][i][3] = an interger matrix whose rows are the extreme rays
    448448                            of the cone
    449 @*             L[2] = is an integer matrix whose rows span the linearity space 
    450                       of the fan, i.e. the linear space which is contained 
    451                       in each cone               
    452 @*             L[3] = the Newton polytope of f in the format of the procedure 
    453                       newtonPolytope
    454 @*             L[4] = integer matrix where each row represents the exponent 
     449@*             L[2] = is an integer matrix whose rows span the linearity space
     450                      of the fan, i.e. the linear space which is contained
     451                      in each cone
     452@*             L[3] = the Newton polytope of f in the format of the procedure
     453                      newtonPolytopeP
     454@*             L[4] = integer matrix where each row represents the exponent
    455455                      vector of one monomial occuring in the input polynomial
    456456NOTE: - if you have already computed the Newton polytope of f then you might want
    457         to use the procedure normalFan instead in order to avoid doing costly
     457        to use the procedure normalFanL instead in order to avoid doing costly
    458458        computation twice
    459459@*    - the procedure calls for its computation polymake by Ewgenij Gawrilow,
     
    463463{
    464464  int i,j;
    465   // compute the list of exponent vectors of the polynomial, which are 
     465  // compute the list of exponent vectors of the polynomial, which are
    466466  // the lattice points whose convex hull is the Newton polytope of f
    467467  intmat exponents[size(f)][nvars(basering)];
     
    481481  }
    482482  variablen=variablen[1,size(variablen)-1];
    483   // call normalFan in order to compute the Groebner fan
    484   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);
    485485  // append newtonp to gf
    486486  gf[3]=newtonp;
     
    525525proc triangulations (list polygon,list #)
    526526"USAGE:  triangulations(polygon[,#]); list polygon, list #
    527 ASSUME:  polygon is a list of integer vectors of the same size representing 
    528          the affine coordinates of the lattice points 
     527ASSUME:  polygon is a list of integer vectors of the same size representing
     528         the affine coordinates of the lattice points
    529529PURPOSE: the procedure considers the marked polytope given as the convex hull of
    530530         the lattice points and with these lattice points as markings; it then
    531          computes all possible triangulations of this marked polytope 
     531         computes all possible triangulations of this marked polytope
    532532RETURN:  list, each entry corresponds to one triangulation and the ith entry is
    533533               itself a list of integer vectors of size three, where each integer
     
    536536NOTE:- the procedure calls for its computations the program points2triangs
    537537       from the program topcom by Joerg Rambau, Universitaet Bayreuth; it
    538        therefore is necessary that this program is installed in order to use 
     538       therefore is necessary that this program is installed in order to use
    539539       this  procedure; see
    540540@*     http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/TOPCOM
    541541@*   - if you only want to have the regular triangulations the procedure should
    542542       be called with the string 'regular' as optional argument
    543 @*   - the procedure creates the files /tmp/triangulationsinput and 
     543@*   - the procedure creates the files /tmp/triangulationsinput and
    544544       /tmp/triangulationsoutput;
    545        the former is used as input for points2triangs and the latter is its 
    546        output containing the triangulations of corresponding to points in the 
    547        format of points2triangs; if you wish to use this for further 
     545       the former is used as input for points2triangs and the latter is its
     546       output containing the triangulations of corresponding to points in the
     547       format of points2triangs; if you wish to use this for further
    548548       computations with topcom, you have to call the procedure with the
    549        string 'keepfiles' as optional argument 
    550 @*   - note that an integer i in an integer vector representing a triangle 
    551        refers to the ith lattice point, i.e. polygon[i]; this convention is 
    552        different from TOPCOM's convention, where i would refer to the i-1st 
     549       string 'keepfiles' as optional argument
     550@*   - note that an integer i in an integer vector representing a triangle
     551       refers to the ith lattice point, i.e. polygon[i]; this convention is
     552       different from TOPCOM's convention, where i would refer to the i-1st
    553553       lattice point
    554554EXAMPLE: example triangulations;   shows an example"
     
    574574    }
    575575  }
    576   // prepare the input for points2triangs by writing the input polygon in the 
     576  // prepare the input for points2triangs by writing the input polygon in the
    577577  // necessary format
    578578  string spi="[";
     
    598598  }
    599599  string p2t=read("/tmp/triangulationsoutput"); // takes result of points2triangs
    600   // delete the tmp-files, if no second argument is given 
     600  // delete the tmp-files, if no second argument is given
    601601  if (keepfiles==0)
    602602  {
    603603    system("sh","cd /tmp; rm -f triangulationsinput; rm -f triangulationsoutput");
    604604  }
    605   // preprocessing of p2t if points2triangs is version >= 0.15 
     605  // preprocessing of p2t if points2triangs is version >= 0.15
    606606  // brings p2t to the format of version 0.14
    607607  string np2t; // takes the triangulations in Singular format
     
    625625      }
    626626      else
    627       {       
     627      {
    628628        np2t=np2t+p2t[i];
    629629      }
     
    637637  {
    638638    if (np2t[size(np2t)]!=";")
    639     {     
     639    {
    640640      np2t=np2t+p2t[size(p2t)-1]+p2t[size(p2t)];
    641641    }
     
    659659          np2t=np2t+"))";
    660660          i++;
    661         }     
     661        }
    662662        else
    663663        {
     
    713713   "EXAMPLE:";
    714714   echo=2;
    715    // the lattice points of the unit square in the plane 
     715   // the lattice points of the unit square in the plane
    716716   list polygon=intvec(0,0),intvec(0,1),intvec(1,0),intvec(1,1);
    717717   // the triangulations of this lattice point configuration are computed
     
    724724proc secondaryPolytope (list polygon,list #)
    725725"USAGE:  secondaryPolytope(polygon[,#]); list polygon, list #
    726 ASSUME:  - polygon is a list of integer vectors of the same size representing 
     726ASSUME:  - polygon is a list of integer vectors of the same size representing
    727727           the affine coordinates of lattice points
    728 @*       - if the triangulations of the corresponding polygon have already been 
     728@*       - if the triangulations of the corresponding polygon have already been
    729729           computed with the procedure triangulations then these can be given as
    730730           a second (optional) argument in order to avoid doing this computation
     
    732732PURPOSE: the procedure considers the marked polytope given as the convex hull of
    733733         the lattice points and with these lattice points as markings; it then
    734          computes the lattice points of the secondary polytope given by this 
     734         computes the lattice points of the secondary polytope given by this
    735735         marked polytope which correspond to the triangulations computed by
    736736         the procedure triangulations
     
    740740                      polytope corresponding to polygon
    741741@*             L[2] = the list of corresponding triangulations
    742 NOTE: if the triangluations are not handed over as optional argument the 
     742NOTE: if the triangluations are not handed over as optional argument the
    743743      procedure calls for its computation of these triangulations the program
    744       points2triangs from the program topcom by Joerg Rambau, Universitaet 
    745       Bayreuth; it therefore is necessary that this program is installed in 
     744      points2triangs from the program topcom by Joerg Rambau, Universitaet
     745      Bayreuth; it therefore is necessary that this program is installed in
    746746      order to use this procedure; see
    747747@*    http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/TOPCOM
     
    759759  int i,j,k,l;
    760760  intmat N[2][2]; // is used to compute areas of triangles
    761   intvec vertex;  // stores a point in the secondary polytope as 
     761  intvec vertex;  // stores a point in the secondary polytope as
    762762                  // intermediate result
    763763  int eintrag;
    764764  int halt;
    765   intmat secpoly[size(triangs)][size(polygon)];   // stores all lattice points 
     765  intmat secpoly[size(triangs)][size(polygon)];   // stores all lattice points
    766766                                                  // of the secondary polytope
    767   // consider each triangulation and compute the corresponding point 
     767  // consider each triangulation and compute the corresponding point
    768768  // in the secondary polytope
    769769  for (i=1;i<=size(triangs);i++)
    770770  {
    771     // for each triangulation we have to compute the coordinates 
     771    // for each triangulation we have to compute the coordinates
    772772    // corresponding to each marked point
    773773    for (j=1;j<=size(polygon);j++)
    774774    {
    775775      eintrag=0;
    776       // for each marked point we have to consider all triangles in the 
     776      // for each marked point we have to consider all triangles in the
    777777      // triangulation which involve this particular point
    778778      for (k=1;k<=size(triangs[i]);k++)
     
    796796    secpoly[i,1..size(polygon)]=vertex;
    797797  }
    798   return(list(secpoly,triangs));         
     798  return(list(secpoly,triangs));
    799799}
    800800example
     
    818818proc secondaryFan (list polygon,list #)
    819819"USAGE:  secondaryFan(polygon[,#]); list polygon, list #
    820 ASSUME:  - polygon is a list of integer vectors of the same size representing 
     820ASSUME:  - polygon is a list of integer vectors of the same size representing
    821821           the affine coordinates of lattice points
    822 @*       - if the triangulations of the corresponding polygon have already been 
    823            computed with the procedure triangulations then these can be given 
    824            as a second (optional) argument in order to avoid doing this 
     822@*       - if the triangulations of the corresponding polygon have already been
     823           computed with the procedure triangulations then these can be given
     824           as a second (optional) argument in order to avoid doing this
    825825           computation again
    826826PURPOSE: the procedure considers the marked polytope given as the convex hull of
    827827         the lattice points and with these lattice points as markings; it then
    828          computes the lattice points of the secondary polytope given by this 
     828         computes the lattice points of the secondary polytope given by this
    829829         marked polytope which correspond to the triangulations computed by
    830830         the procedure triangulations
    831 RETURN:  list, the ith entry of L[1] contains information about the ith cone in 
    832                the secondary fan of the polygon, i.e. the cone dual to the 
     831RETURN:  list, the ith entry of L[1] contains information about the ith cone in
     832               the secondary fan of the polygon, i.e. the cone dual to the
    833833               ith vertex of the secondary polytope
    834 @*             L[1][i][1] = integer matrix representing the inequalities which 
     834@*             L[1][i][1] = integer matrix representing the inequalities which
    835835                            describe the cone dual to the ith vertex
    836 @*             L[1][i][2] = a list which contains the inequalities represented 
     836@*             L[1][i][2] = a list which contains the inequalities represented
    837837                            by L[1][i][1] as a list of strings, where we use the
    838838                            variables x(1),...,x(n)
    839839@*             L[1][i][3] = only present if 'er' is set to 1; in that case it is
    840                             an interger matrix whose rows are the extreme rays 
     840                            an interger matrix whose rows are the extreme rays
    841841                            of the cone
    842 @*             L[2] = is an integer matrix whose rows span the linearity space 
    843                       of the fan, i.e. the linear space which is contained in 
     842@*             L[2] = is an integer matrix whose rows span the linearity space
     843                      of the fan, i.e. the linear space which is contained in
    844844                      each cone
    845 @*             L[3] = the secondary polytope in the format of the procedure 
     845@*             L[3] = the secondary polytope in the format of the procedure
    846846                      polymakePolytope
    847 @*             L[4] = the list of triangulations corresponding to the vertices 
     847@*             L[4] = the list of triangulations corresponding to the vertices
    848848                      of the secondary polytope
    849849NOTE:- the procedure calls for its computation polymake by Ewgenij Gawrilow,
    850850       TU Berlin and Michael Joswig, so it only works if polymake is installed;
    851851       see http://www.math.tu-berlin.de/polymake/
    852 @*   - in the optional argument # it is possible to hand over other names for 
    853        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 
     852@*   - in the optional argument # it is possible to hand over other names for
     853       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
    855855       u00,u10,u01,u11 then you must hand over the string 'u11,u10,u01,u11'
    856 @*   - if the triangluations are not handed over as optional argument the 
    857        procedure calls for its computation of these triangulations the program 
    858        points2triangs from the program topcom by Joerg Rambau, Universitaet 
    859        Bayreuth; it therefore is necessary that this program is installed in 
     856@*   - if the triangluations are not handed over as optional argument the
     857       procedure calls for its computation of these triangulations the program
     858       points2triangs from the program topcom by Joerg Rambau, Universitaet
     859       Bayreuth; it therefore is necessary that this program is installed in
    860860       order to use this procedure; see
    861861@*     http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/TOPCOM
     
    869869  {
    870870    list triang=#[1];
    871   } 
     871  }
    872872  list sp=secondaryPolytope(polygon,triang);
    873873  list spp=polymakePolytope(sp[1]);
    874   list sf=normalFan(spp[1],spp[4],spp[3],1);
     874  list sf=normalFanL(spp[1],spp[4],spp[3],1);
    875875  return(list(sf[1],sf[2],spp,triang));
    876876}
     
    906906proc cycleLength (list boundary,intvec interior)
    907907"USAGE:  cycleLength(boundary,interior); list boundary, intvec interior
    908 ASSUME:  boundary is a list of integer vectors describing a cycle in some 
    909          convex lattice polygon around the lattice point interior ordered 
     908ASSUME:  boundary is a list of integer vectors describing a cycle in some
     909         convex lattice polygon around the lattice point interior ordered
    910910         clock wise
    911911RETURN:  string, the cycle length of the corresponding cycle in the dual
     
    914914{
    915915  int j;
    916   // create a ring whose variables are indexed by the points in 
     916  // create a ring whose variables are indexed by the points in
    917917  // boundary resp. by interior
    918918  string rst="ring cyclering=0,(u"+string(interior[1])+string(interior[2]);
     
    952952   // interior is a lattice point in the interior of this lattice polygon
    953953   intvec interior=1,1;
    954    // compute the general cycle length of a cycle of the corresponding cycle 
     954   // compute the general cycle length of a cycle of the corresponding cycle
    955955   // in the dual tropical curve, note that (0,1) and (2,1) do not contribute
    956956   cycleLength(boundary,interior);
     
    961961proc splitPolygon (list markings)
    962962"USAGE:  splitPolygon (markings);  markings list
    963 ASSUME:  markings is a list of integer vectors representing lattice points in 
    964          the plane which we consider as the marked points of the convex lattice 
     963ASSUME:  markings is a list of integer vectors representing lattice points in
     964         the plane which we consider as the marked points of the convex lattice
    965965         polytope spanned by them
    966 PURPOSE: split the marked points in the vertices, the points on the facets 
     966PURPOSE: split the marked points in the vertices, the points on the facets
    967967         which are not vertices, and the interior points
    968968RETURN:  list, L consisting of three lists
     
    970970@*                       L[1][i][1] = intvec, the coordinates of the ith vertex
    971971@*                       L[1][i][2] = int, the position of L[1][i][1] in markings
    972 @*             L[2][i] : represents the lattice points on the facet of the 
    973                          polygon with endpoints L[1][i] and L[1][i+1] 
     972@*             L[2][i] : represents the lattice points on the facet of the
     973                         polygon with endpoints L[1][i] and L[1][i+1]
    974974                         (i considered modulo size(L[1]))
    975 @*                       L[2][i][j][1] = intvec, the coordinates of the jth 
     975@*                       L[2][i][j][1] = intvec, the coordinates of the jth
    976976                                                 lattice point on that facet
    977 @*                       L[2][i][j][2] = int, the position of L[2][i][j][1] 
     977@*                       L[2][i][j][2] = int, the position of L[2][i][j][1]
    978978                                              in markings
    979 @*             L[3]    : represents the interior lattice points of the polygon 
     979@*             L[3]    : represents the interior lattice points of the polygon
    980980@*                       L[3][i][1] = intvec, coordinates of ith interior point
    981981@*                       L[3][i][2] = int, the position of L[3][i][1] in markings
     
    988988  vert[1]=pb[2];
    989989  int i,j,k;      // indices
    990   list boundary;  // stores the points on the facets of the 
     990  list boundary;  // stores the points on the facets of the
    991991                  // polygon which are not vertices
    992   // append to the boundary points as well as to the vertices 
     992  // append to the boundary points as well as to the vertices
    993993  // the first vertex a second time
    994994  pb[1]=pb[1]+list(pb[1][1]);
     
    10151015  // store the information on the boundary in vert[2]
    10161016  vert[2]=boundary;
    1017   // find the remaining points in the input which are not on 
     1017  // find the remaining points in the input which are not on
    10181018  // the boundary by checking
    10191019  // for each point in markings if it is contained in pb[1]
     
    10321032  // store the interior points in vert[3]
    10331033  vert[3]=interior;
    1034   // add to each point in vert the index which it gets from 
     1034  // add to each point in vert the index which it gets from
    10351035  // its position in the input markings;
    10361036  // do so for ver[1]
     
    10661066    }
    10671067    vert[3][i]=list(vert[3][i],j);
    1068   } 
     1068  }
    10691069  return(vert);
    10701070}
     
    10731073   "EXAMPLE:";
    10741074   echo=2;
    1075    // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 
     1075   // the lattice polygon spanned by the points (0,0), (3,0) and (0,3)
    10761076   // with all integer points as markings
    10771077   list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0),
     
    10931093proc eta (list triang,list polygon)
    10941094"USAGE:  eta(triang,polygon);  triang, polygon list
    1095 ASSUME:  polygon has the format of the output of splitPolygon, i.e. it is a 
    1096          list with three entries describing a convex lattice polygon in the 
     1095ASSUME:  polygon has the format of the output of splitPolygon, i.e. it is a
     1096         list with three entries describing a convex lattice polygon in the
    10971097         following way:
    1098 @*       polygon[1] : is a list of lists; for each i the entry polygon[1][i][1] 
    1099                       is a lattice point which is a vertex of the lattice 
     1098@*       polygon[1] : is a list of lists; for each i the entry polygon[1][i][1]
     1099                      is a lattice point which is a vertex of the lattice
    11001100                      polygon, and polygon[1][i][2] is an integer assigned to
    11011101                      this lattice point as identifying index
    1102 @*       polygon[2] : is a list of lists; for each vertex of the polygon, 
    1103                       i.e. for each entry in polygon[1], it contains a list 
    1104                       polygon[2][i], which contains the lattice points on the 
    1105                       facet with endpoints polygon[1][i] and polygon[1][i+1] 
     1102@*       polygon[2] : is a list of lists; for each vertex of the polygon,
     1103                      i.e. for each entry in polygon[1], it contains a list
     1104                      polygon[2][i], which contains the lattice points on the
     1105                      facet with endpoints polygon[1][i] and polygon[1][i+1]
    11061106                      - i considered mod size(polygon[1]);
    1107                       each such lattice point contributes an entry 
     1107                      each such lattice point contributes an entry
    11081108                      polygon[2][i][j][1] which is an integer
    1109                       vector giving the coordinate of the lattice point and an 
     1109                      vector giving the coordinate of the lattice point and an
    11101110                      entry polygon[2][i][j][2] which is the identifying index
    1111 @*       polygon[3] : is a list of lists, where each entry corresponds to a 
    1112                       lattice point in the interior of the polygon, with 
     1111@*       polygon[3] : is a list of lists, where each entry corresponds to a
     1112                      lattice point in the interior of the polygon, with
    11131113                      polygon[3][j][1] being the coordinates of the point
    11141114                      and polygon[3][j][2] being the identifying index;
    1115 @*       triang is a list of integer vectors all of size three describing a 
    1116          triangulation of the polygon described by polygon; if an entry of 
     1115@*       triang is a list of integer vectors all of size three describing a
     1116         triangulation of the polygon described by polygon; if an entry of
    11171117         triang is the vector (i,j,k) then the triangle is built by the vertices
    11181118         with indices i, j and k
    1119 RETURN:  intvec, the integer vector eta describing that vertex of the Newton 
    1120                  polytope discriminant of the polygone whose dual cone in the 
    1121                  Groebner fan contains the cone of the secondary fan of the 
     1119RETURN:  intvec, the integer vector eta describing that vertex of the Newton
     1120                 polytope discriminant of the polygone whose dual cone in the
     1121                 Groebner fan contains the cone of the secondary fan of the
    11221122                 polygon corresponding to the given triangulation
    1123 NOTE:  for a better description of eta see Gelfand, Kapranov, 
     1123NOTE:  for a better description of eta see Gelfand, Kapranov,
    11241124       Zelevinski: Discriminants, Resultants and multidimensional Determinants.
    11251125       Chapter 10.
     
    11271127{
    11281128  int i,j,k,l,m,n; // index variables
    1129   list ordpolygon;   // stores the lattice points in the order 
     1129  list ordpolygon;   // stores the lattice points in the order
    11301130                     // used in the triangulation
    11311131  list triangarea; // stores the areas of the triangulations
     
    11531153  for (i=1;i<=size(triang);i++)
    11541154  {
    1155     // Note that the ith lattice point in orderedpolygon has the 
     1155    // Note that the ith lattice point in orderedpolygon has the
    11561156    // number i-1 in the triangulation!
    11571157    N=ordpolygon[triang[i][1]]-ordpolygon[triang[i][2]],ordpolygon[triang[i][1]]-ordpolygon[triang[i][3]];
     
    11591159  }
    11601160  intvec ETA;        // stores the eta_ij
    1161   int etaij;         // stores the part of eta_ij during computations 
     1161  int etaij;         // stores the part of eta_ij during computations
    11621162                     // which comes from triangle areas
    1163   int seitenlaenge;  // stores the part of eta_ij during computations 
     1163  int seitenlaenge;  // stores the part of eta_ij during computations
    11641164                     // which comes from boundary facets
    11651165  list seiten;       // stores the lattice points on facets of the polygon
    11661166  intvec v;          // used to compute a facet length
    1167   // 3) store first in seiten[i] all lattice points on the facet 
     1167  // 3) store first in seiten[i] all lattice points on the facet
    11681168  //    connecting the ith vertex,
    1169   //    i.e. polygon[1][i], with the i+1st vertex, i.e. polygon[1][i+1], 
     1169  //    i.e. polygon[1][i], with the i+1st vertex, i.e. polygon[1][i+1],
    11701170  //    where we replace i+1
    11711171  //    1 if i=size(polygon[1]);
    1172   //    then append the last entry of seiten once more at the very 
     1172  //    then append the last entry of seiten once more at the very
    11731173  //    beginning of seiten, so
    11741174  //    that the index is shifted by one
     
    11961196      if ((polygon[1][j][2]==triang[k][1]) or (polygon[1][j][2]==triang[k][2]) or (polygon[1][j][2]==triang[k][3]))
    11971197      {
    1198         // ... if so, add the area of the triangle to etaij 
     1198        // ... if so, add the area of the triangle to etaij
    11991199        etaij=etaij+triangarea[k];
    1200         // then check if that triangle has a facet which is contained 
    1201         // in one of the 
     1200        // then check if that triangle has a facet which is contained
     1201        // in one of the
    12021202        // two facets of the polygon which are adjecent to the given vertex ...
    12031203        // these two facets are seiten[j] and seiten[j+1]
     
    12131213              if ((seiten[n][l][2]==triang[k][m]) and (seiten[n][l][2]!=polygon[1][j][2]))
    12141214              {
    1215                 // if so, then compute the vector pointing from this 
     1215                // if so, then compute the vector pointing from this
    12161216                // lattice point to the vertex
    12171217                v=polygon[1][j][1]-seiten[n][l][1];
    1218                 // and the lattice length of this vector has to be 
     1218                // and the lattice length of this vector has to be
    12191219                // subtracted from etaij
    12201220                etaij=etaij-abs(gcd(v[1],v[2]));
     
    12281228    ETA[polygon[1][j][2]]=etaij;
    12291229  }
    1230   // 5) compute the eta_ij for all lattice points on the facets 
     1230  // 5) compute the eta_ij for all lattice points on the facets
    12311231  //    of the polygon which are not vertices, these are the
    12321232  //    lattice points in polygon[2][1] to polygon[2][size(polygon[1])]
     
    12341234  {
    12351235    for (j=1;j<=size(polygon[2][i]);j++)
    1236     {     
     1236    {
    12371237      // initialise etaij
    12381238      etaij=0;
     
    12451245        if ((polygon[2][i][j][2]==triang[k][1]) or (polygon[2][i][j][2]==triang[k][2]) or (polygon[2][i][j][2]==triang[k][3]))
    12461246        {
    1247           // ... if so, add the area of the triangle to etaij 
     1247          // ... if so, add the area of the triangle to etaij
    12481248          etaij=etaij+triangarea[k];
    1249           // then check if that triangle has a facet which is contained in the 
     1249          // then check if that triangle has a facet which is contained in the
    12501250          // facet of the polygon which contains the lattice point in question,
    12511251          // this is the facet seiten[i+1];
     
    12551255            // ... and for each lattice point in the triangle ...
    12561256            for (m=1;m<=size(triang[k]);m++)
    1257             {           
     1257            {
    12581258              // ... if they coincide and are not the vertex itself ...
    12591259              if ((seiten[i+1][l][2]==triang[k][m]) and (seiten[i+1][l][2]!=polygon[2][i][j][2]))
    12601260              {
    1261                 // if so, then compute the vector pointing from 
     1261                // if so, then compute the vector pointing from
    12621262                // this lattice point to the vertex
    12631263                v=polygon[2][i][j][1]-seiten[i+1][l][1];
    1264                 // and the lattice length of this vector contributes 
     1264                // and the lattice length of this vector contributes
    12651265                // to seitenlaenge
    12661266                seitenlaenge=seitenlaenge+abs(gcd(v[1],v[2]));
     
    12701270        }
    12711271      }
    1272       // if the lattice point was a vertex of any triangle 
     1272      // if the lattice point was a vertex of any triangle
    12731273      // in the triangulation ...
    12741274      if (etaij!=0)
     
    12951295      if ((polygon[3][j][2]==triang[k][1]) or (polygon[3][j][2]==triang[k][2]) or (polygon[3][j][2]==triang[k][3]))
    12961296      {
    1297         // ... if so, add the area of the triangle to etaij 
     1297        // ... if so, add the area of the triangle to etaij
    12981298        etaij=etaij+triangarea[k];
    12991299      }
     
    13081308   "EXAMPLE:";
    13091309   echo=2;
    1310    // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 
     1310   // the lattice polygon spanned by the points (0,0), (3,0) and (0,3)
    13111311   // with all integer points as markings
    13121312   list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0),
     
    13151315   // split the polygon in its vertices, its facets and its interior points
    13161316   list sp=splitPolygon(polygon);
    1317    // define a triangulation by connecting the only interior point 
     1317   // define a triangulation by connecting the only interior point
    13181318   //        with the vertices
    13191319   list triang=intvec(1,2,5),intvec(1,5,10),intvec(1,5,10);
     
    13211321   eta(triang,sp);
    13221322}
    1323  
     1323
    13241324/////////////////////////////////////////////////////////////////////////////
    13251325
    13261326proc findOrientedBoundary (list polygon)
    13271327"USAGE: findOrientedBoundary(polygon); polygon list
    1328 ASSUME: polygon is a list of integer vectors defining integer lattice points 
     1328ASSUME: polygon is a list of integer vectors defining integer lattice points
    13291329        in the plane
    13301330RETURN: list l with the following interpretation
    1331 @*            l[1] = list of integer vectors such that the polygonal path 
    1332                      defined by these is the boundary of the convex hull of 
     1331@*            l[1] = list of integer vectors such that the polygonal path
     1332                     defined by these is the boundary of the convex hull of
    13331333                     the lattice points in polygon
    13341334@*            l[2] = list, the redundant points in l[1] have been removed
     
    13481348  }
    13491349  // check is the polygon is only a line segment given by more than two points;
    1350   // for this first compute sum of the absolute values of the determinants 
     1350  // for this first compute sum of the absolute values of the determinants
    13511351  // of the matrices whose
    1352   // rows are the vectors pointing from the first to the second point 
     1352  // rows are the vectors pointing from the first to the second point
    13531353  // and from the
    1354   // the first point to the ith point for i=3,...,size(polygon); 
     1354  // the first point to the ith point for i=3,...,size(polygon);
    13551355  // if this sum is zero
    13561356  // then the polygon is a line segment and we have to find its end points
     
    13651365    intmat laenge[size(polygon)][size(polygon)];
    13661366    intvec mp;
    1367     //   for this collect first all vectors pointing from one lattice 
     1367    //   for this collect first all vectors pointing from one lattice
    13681368    //   point to the next,
    13691369    //   compute their pairwise angles and their lengths
    13701370    for (i=1;i<=size(polygon)-1;i++)
    1371     {     
     1371    {
    13721372      for (j=i+1;j<=size(polygon);j++)
    13731373      {
     
    13931393    polygon=sortlistbyintvec(polygon,abstand);
    13941394    return(list(polygon,endpoints));
    1395   } 
     1395  }
    13961396  ///////////////////////////////////////////////////////////////
    13971397  list orderedvertices;  // stores the vertices in an ordered way
    1398   list minimisedorderedvertices;  // stores the vertices in an ordered way; 
     1398  list minimisedorderedvertices;  // stores the vertices in an ordered way;
    13991399                                  // redundant ones removed
    1400   list comparevertices; // stores vertices which should be compared to 
     1400  list comparevertices; // stores vertices which should be compared to
    14011401                        // the testvertex
    14021402  orderedvertices[1]=polygon[1]; // set the starting vertex
    14031403  minimisedorderedvertices[1]=polygon[1]; // set the starting vertex
    14041404  intvec testvertex=polygon[1];  //vertex to which the others have to be compared
    1405   intvec startvertex=polygon[1]; // keep the starting vertex to test, 
     1405  intvec startvertex=polygon[1]; // keep the starting vertex to test,
    14061406                                 // when the end is reached
    14071407  int endtest;                   // is set to one, when the end is reached
    1408   int startvertexfound;// is 1, once for some testvertex a candidate 
    1409                        // for the next vertex has been found 
     1408  int startvertexfound;// is 1, once for some testvertex a candidate
     1409                       // for the next vertex has been found
    14101410  polygon=delete(polygon,1);    // delete the testvertex
    14111411  intvec v,w;
    14121412  int l=1;  // counts the vertices
    1413   // the basic idea is that a vertex can be 
     1413  // the basic idea is that a vertex can be
    14141414  // the next one on the boundary if all other vertices
    1415   // lie to the right of the vector v pointing 
     1415  // lie to the right of the vector v pointing
    14161416  // from the testvertex to this one; this can be tested
    1417   // by checking if the determinant of the 2x2-matrix 
     1417  // by checking if the determinant of the 2x2-matrix
    14181418  // with first column v and second column the vector w,
    1419   // pointing from the testvertex to the new vertex, 
     1419  // pointing from the testvertex to the new vertex,
    14201420  // is non-positive; if this is the case for all
    1421   // new vertices, then the one in consideration is 
     1421  // new vertices, then the one in consideration is
    14221422  // a possible choice for the next vertex on the boundary
    1423   // and it is stored in naechste; we can then order 
     1423  // and it is stored in naechste; we can then order
    14241424  // the candidates according to their distance from
    14251425  // the testvertex; then they occur on the boundary in that order!
     
    14331433      v=polygon[i]-testvertex; // points from the testvertex to the ith vertex
    14341434      comparevertices=delete(polygon,i); // we needn't compare v to itself
    1435       // we should compare v to the startvertex-testvertex; 
     1435      // we should compare v to the startvertex-testvertex;
    14361436      // in the first calling of the loop
    1437       // this is irrelevant since the difference will be zero; 
     1437      // this is irrelevant since the difference will be zero;
    14381438      // however, later on it will
    1439       // be vital, since we delete the vertices 
     1439      // be vital, since we delete the vertices
    14401440      // which we have already tested from the list
    1441       // of all vertices, and when all vertices 
     1441      // of all vertices, and when all vertices
    14421442      // on the boundary have been found we would
    1443       // therefore find a vertex in the interior 
     1443      // therefore find a vertex in the interior
    14441444      // as candidate; but always testing against
    14451445      // the starting vertex, this cannot happen
    1446       comparevertices[size(comparevertices)+1]=startvertex; 
     1446      comparevertices[size(comparevertices)+1]=startvertex;
    14471447      for (j=1;(j<=size(comparevertices)) and (d<=0);j++)
    14481448      {
     
    14521452        d=det(D);
    14531453      }
    1454       if (d<=0) // if all determinants are non-positive, 
     1454      if (d<=0) // if all determinants are non-positive,
    14551455      { // then the ith vertex is a candidate
    14561456        naechste[k]=list(polygon[i],i,scalarproduct(v,v));// we store the vertex,
     
    14601460    }
    14611461    if (size(naechste)>0) // then a candidate for the next vertex has been found
    1462     {     
     1462    {
    14631463      startvertexfound=1; // at least once a candidate has been found
    1464       naechste=sortlist(naechste,3);  // we order the candidates according 
     1464      naechste=sortlist(naechste,3);  // we order the candidates according
    14651465                                      // to their distance from testvertex;
    1466       for (j=1;j<=size(naechste);j++) // then we store them in this 
     1466      for (j=1;j<=size(naechste);j++) // then we store them in this
    14671467      { // order in orderedvertices
    14681468        l++;
    14691469        orderedvertices[l]=naechste[j][1];
    14701470      }
    1471       testvertex=naechste[size(naechste)][1];  // we store the last one as 
     1471      testvertex=naechste[size(naechste)][1];  // we store the last one as
    14721472                                               // next testvertex;
    14731473      // store the next corner of NSD
    1474       minimisedorderedvertices[size(minimisedorderedvertices)+1]=testvertex; 
    1475       naechste=sortlist(naechste,2); // then we reorder the vertices 
     1474      minimisedorderedvertices[size(minimisedorderedvertices)+1]=testvertex;
     1475      naechste=sortlist(naechste,2); // then we reorder the vertices
    14761476                                     // according to their position
    14771477      for (j=size(naechste);j>=1;j--) // and we delete them from the vertices
     
    14801480      }
    14811481    }
    1482     else // that means either that the vertex was inside the polygon, 
    1483     {    // or that we have reached the last vertex on the boundary 
     1482    else // that means either that the vertex was inside the polygon,
     1483    {    // or that we have reached the last vertex on the boundary
    14841484         // of the polytope
    1485       if (startvertexfound==0) // the vertex was in the interior; 
     1485      if (startvertexfound==0) // the vertex was in the interior;
    14861486      { // we delete it and start all over again
    1487         orderedvertices[1]=polygon[1]; 
    1488         minimisedorderedvertices[1]=polygon[1]; 
     1487        orderedvertices[1]=polygon[1];
     1488        minimisedorderedvertices[1]=polygon[1];
    14891489        testvertex=polygon[1];
    14901490        startvertex=polygon[1];
    14911491        polygon=delete(polygon,1);
    14921492      }
    1493       else // we have reached the last vertex on the boundary of 
     1493      else // we have reached the last vertex on the boundary of
    14941494      { // the polytope and can stop
    14951495        endtest=1;
     
    14981498    kill naechste;
    14991499  }
    1500   // test if the first vertex in minimisedorderedvertices 
     1500  // test if the first vertex in minimisedorderedvertices
    15011501  // is on the same line with the second and
    1502   // the last, i.e. if we started our search in the 
     1502  // the last, i.e. if we started our search in the
    15031503  // middle of a face; if so, delete it
    15041504  v=minimisedorderedvertices[2]-minimisedorderedvertices[1];
     
    15091509    minimisedorderedvertices=delete(minimisedorderedvertices,1);
    15101510  }
    1511   // test if the first vertex in minimisedorderedvertices 
     1511  // test if the first vertex in minimisedorderedvertices
    15121512  // is on the same line with the two
    1513   // last ones, i.e. if we started our search at the end of a face; 
     1513  // last ones, i.e. if we started our search at the end of a face;
    15141514  // if so, delete it
    15151515  v=minimisedorderedvertices[size(minimisedorderedvertices)-1]-minimisedorderedvertices[1];
     
    15431543proc cyclePoints (list triang,list points,int pt)
    15441544"USAGE:      cyclePoints(triang,points,pt)  triang,points list, pt int
    1545 ASSUME:      - points is a list of integer vectors describing the lattice 
     1545ASSUME:      - points is a list of integer vectors describing the lattice
    15461546               points of a marked polygon;
    1547 @*           - triang is a list of integer vectors describing a triangulation 
    1548                of the marked polygon in the sense that an integer vector of 
    1549                the form (i,j,k) describes the triangle formed by polygon[i], 
     1547@*           - triang is a list of integer vectors describing a triangulation
     1548               of the marked polygon in the sense that an integer vector of
     1549               the form (i,j,k) describes the triangle formed by polygon[i],
    15501550               polygon[j] and polygon[k];
    1551 @*           - pt is an integer between 1 and size(points), singling out a 
     1551@*           - pt is an integer between 1 and size(points), singling out a
    15521552               lattice point among the marked points
    1553 PURPOSE:     consider the convex lattice polygon, say P, spanned by all lattice 
    1554              points in points which in the triangulation triang are connected 
    1555              to the point points[pt]; the procedure computes all marked points 
     1553PURPOSE:     consider the convex lattice polygon, say P, spanned by all lattice
     1554             points in points which in the triangulation triang are connected
     1555             to the point points[pt]; the procedure computes all marked points
    15561556             in points which lie on the boundary of that polygon, ordered
    15571557             clockwise
    1558 RETURN:      list, of integer vectors which are the coordinates of the lattice 
    1559                    points on the boundary of the above mentioned polygon P, if 
    1560                    this polygon is not the empty set (that would be the case if 
    1561                    points[pt] is not a vertex of any triangle in the 
     1558RETURN:      list, of integer vectors which are the coordinates of the lattice
     1559                   points on the boundary of the above mentioned polygon P, if
     1560                   this polygon is not the empty set (that would be the case if
     1561                   points[pt] is not a vertex of any triangle in the
    15621562                   triangulation); otherwise return the empty list
    15631563EXAMPLE:     example cyclePoints;   shows an example"
    15641564{
    15651565  int i,j; // indices
    1566   list v;  // saves the indices of lattice points connected to the 
     1566  list v;  // saves the indices of lattice points connected to the
    15671567           // interior point in the triangulation
    15681568  // save all points in triangulations containing pt in v
     
    16001600    pts[i]=points[v[i]];
    16011601  }
    1602   // consider the convex polytope spanned by the points in pts, 
     1602  // consider the convex polytope spanned by the points in pts,
    16031603  // find the points on the
    16041604  // boundary and order them clockwise
     
    16091609   "EXAMPLE:";
    16101610   echo=2;
    1611    // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 
     1611   // the lattice polygon spanned by the points (0,0), (3,0) and (0,3)
    16121612   // with all integer points as markings
    16131613   list points=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0),
    16141614               intvec(0,0),intvec(2,1),intvec(0,1),intvec(1,2),
    16151615               intvec(0,2),intvec(0,3);
    1616    // define a triangulation 
     1616   // define a triangulation
    16171617   list triang=intvec(1,2,5),intvec(1,5,7),intvec(1,7,9),intvec(8,9,10),
    16181618               intvec(1,8,9),intvec(1,2,8);
     
    16261626"USAGE:  latticeArea(polygon);   polygon list
    16271627ASSUME:  polygon is a list of integer vectors in the plane
    1628 RETURN:  int, the lattice area of the convex hull of the lattice points in 
     1628RETURN:  int, the lattice area of the convex hull of the lattice points in
    16291629              polygon, i.e. twice the Euclidean area
    16301630EXAMPLE: example polygonlatticeArea;   shows an example"
     
    16551655proc picksFormula (list polygon)
    16561656"USAGE:  picksFormula(polygon);   polygon list
    1657 ASSUME:  polygon is a list of integer vectors in the plane and consider their 
    1658          convex hull C 
    1659 RETURN:  list, L of three integersthe 
     1657ASSUME:  polygon is a list of integer vectors in the plane and consider their
     1658         convex hull C
     1659RETURN:  list, L of three integersthe
    16601660@*             L[1] : the lattice area of C, i.e. twice the Euclidean area
    16611661@*             L[2] : the number of lattice points on the boundary of C
     
    16821682    bdpts=bdpts+abs(gcd(edge[1],edge[2]));
    16831683  }
    1684   // Pick's formula says that the lattice area A, the number g of interior 
     1684  // Pick's formula says that the lattice area A, the number g of interior
    16851685  // points and
    16861686  // the number b of boundary points are connected by the formula: A=b+2g-2
     
    17091709proc ellipticNF (list polygon)
    17101710"USAGE:  ellipticNF(polygon);   polygon list
    1711 ASSUME:  polygon is a list of integer vectors in the plane such that their 
    1712          convex hull C has precisely one interior lattice point; i.e. C is the 
     1711ASSUME:  polygon is a list of integer vectors in the plane such that their
     1712         convex hull C has precisely one interior lattice point; i.e. C is the
    17131713         Newton polygon of an elliptic curve
    1714 PURPOSE: compute the normal form of the polygon with respect to the unimodular 
     1714PURPOSE: compute the normal form of the polygon with respect to the unimodular
    17151715         affine transformations T=A*x+v; there are sixteen different normal forms
    1716          (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons 
    1717                    and the number 12.  Amer. Math. Monthly  107  (2000),  no. 3, 
     1716         (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons
     1717                   and the number 12.  Amer. Math. Monthly  107  (2000),  no. 3,
    17181718                   238--250.)
    17191719RETURN:  list, L such that
    1720 @*             L[1] : list whose entries are the vertices of the normal form of 
     1720@*             L[1] : list whose entries are the vertices of the normal form of
    17211721                      the polygon
    17221722@*             L[2] : the matrix A of the unimodular transformation
    17231723@*             L[3] : the translation vector v of the unimodular transformation
    1724 @*             L[4] : list such that the ith entry is the image of polygon[i] 
     1724@*             L[4] : list such that the ith entry is the image of polygon[i]
    17251725                      under the unimodular transformation T
    17261726EXAMPLE: example ellipticNF;   shows an example"
     
    17541754  intvec trans;    // stores the vector by which we have to translate the polygon
    17551755  intmat A[2][2];  // stores the matrix by which we have to transform the polygon
    1756   matrix M[3][3];  // stores the projective coordinates of the points 
     1756  matrix M[3][3];  // stores the projective coordinates of the points
    17571757                   // which are to be transformed
    1758   matrix N[3][3];  // stores the projective coordinates of the points to 
     1758  matrix N[3][3];  // stores the projective coordinates of the points to
    17591759                   // which M is to be transformed
    1760   intmat T[3][3];  // stores the unimodular affine transformation in 
     1760  intmat T[3][3];  // stores the unimodular affine transformation in
    17611761                   // projective form
    17621762  // add the second point of pg once again at the end
    17631763  pg=insert(pg,pg[2],size(pg));
    1764   // if there is only one edge which has the maximal number of lattice points, 
     1764  // if there is only one edge which has the maximal number of lattice points,
    17651765  // then M should be:
    17661766  M=pg[max],1,pg[max+1],1,pg[max+2],1;
     
    18521852    M=pg[max],1,pg[max+1],1,pg[max+2],1;
    18531853    // the orientation of the polygon matters
    1854     A=pg[max-1]-pg[max],pg[max+1]-pg[max];   
     1854    A=pg[max-1]-pg[max],pg[max+1]-pg[max];
    18551855    if (det(A)==4)
    18561856    {
     
    19011901    {
    19021902      max++;
    1903     }   
     1903    }
    19041904    M=pg[max],1,pg[max+1],1,pg[max+2],1;
    19051905    N=0,1,1,1,2,1,2,1,1;
     
    19641964   // the vertices of the normal form are
    19651965   nf[1];
    1966    // it has been transformed by the unimodular affine transformation A*x+v 
     1966   // it has been transformed by the unimodular affine transformation A*x+v
    19671967   // with matrix A
    19681968   nf[2];
     
    19811981"USAGE:  ellipticNFDB(n[,#]);   n int, # list
    19821982ASSUME:  n is an integer between 1 and 16
    1983 PURPOSE: this is a database storing the 16 normal forms of planar polygons with 
     1983PURPOSE: this is a database storing the 16 normal forms of planar polygons with
    19841984         precisely one interior point up to unimodular affine transformations
    1985 @*       (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons 
     1985@*       (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons
    19861986                   and the number 12.  Amer. Math. Monthly  107  (2000),  no. 3,
    19871987                   238--250.)
    19881988RETURN:  list, L such that
    1989 @*             L[1] : list whose entries are the vertices of the nth normal form 
    1990 @*             L[2] : list whose entries are all the lattice points of the 
    1991                       nth normal form 
    1992 @*             L[3] : only present if the optional parameter # is present, and 
    1993                       then it is a polynomial in the variables (x,y) whose 
     1989@*             L[1] : list whose entries are the vertices of the nth normal form
     1990@*             L[2] : list whose entries are all the lattice points of the
     1991                      nth normal form
     1992@*             L[3] : only present if the optional parameter # is present, and
     1993                      then it is a polynomial in the variables (x,y) whose
    19941994                      Newton polygon is the nth normal form
    1995 NOTE:    the optional parameter is only allowed if the basering has the 
     1995NOTE:    the optional parameter is only allowed if the basering has the
    19961996         variables x and y
    19971997EXAMPLE: example ellipticNFDB;   shows an example"
     
    20592059static proc scalarproduct (intvec w,intvec v)
    20602060"USAGE:      scalarproduct(w,v); w,v intvec
    2061 ASSUME:      w and v are integer vectors of the same length 
     2061ASSUME:      w and v are integer vectors of the same length
    20622062RETURN:      int, the scalarproduct of v and w
    20632063NOTE:        the procedure is called by findOrientedBoundary"
     
    20742074"USAGE:      intmatcoldelete(w,i); w intmat, i int
    20752075RETURN:      intmat, the integer matrix w with the ith comlumn deleted
    2076 NOTE:        the procedure is called by intmatsort and normalFan"
     2076NOTE:        the procedure is called by intmatsort and normalFanL"
    20772077{
    20782078  if (typeof(w)=="intmat")
     
    21372137  {
    21382138    int m=nrows(M);
    2139    
     2139
    21402140  }
    21412141  else
     
    21952195  {
    21962196    return("");
    2197    
     2197
    21982198  }
    21992199  if (i==1)
     
    23052305        k++;
    23062306      }
    2307       else 
     2307      else
    23082308      {
    23092309        stop=1;
     
    23482348        k++;
    23492349      }
    2350       else 
     2350      else
    23512351      {
    23522352        stop=1;
     
    23972397static proc polygonToCoordinates (list points)
    23982398"USAGE:      polygonToCoordinates(points);   points list
    2399 ASSUME:      points is a list of integer vectors each of size two describing the 
    2400              marked points of a convex lattice polygon like the output of 
     2399ASSUME:      points is a list of integer vectors each of size two describing the
     2400             marked points of a convex lattice polygon like the output of
    24012401             polygonDB
    2402 RETURN:      list, the first entry is a string representing the coordinates 
     2402RETURN:      list, the first entry is a string representing the coordinates
    24032403                   corresponding to the latticpoints seperated by commata
    2404                    the second entry is a list where the ith entry is a string 
    2405                    representing the coordinate of corresponding to the ith 
    2406                    lattice point the third entry is the latex format of the 
     2404                   the second entry is a list where the ith entry is a string
     2405                   representing the coordinate of corresponding to the ith
     2406                   lattice point the third entry is the latex format of the
    24072407                   first entry
    24082408NOTE:        the procedure is called by fan"
     
    24262426ASSUME:  - M is an integer matrix where a first column of 0's or 1's should be added
    24272427@*       - 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 
     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
    24302430RETURN:  intmat, a first column has been added to the matrix"
    24312431{
  • Singular/LIB/tropical.lib

    r3c3e3d r8275a9  
    204204LIB "elim.lib";
    205205LIB "linalg.lib";
    206 LIB "oldpolymake.lib";
     206LIB "polymake.lib";
    207207LIB "primdec.lib";
    208208LIB "absfact.lib";
     
    69106910"USAGE:      intmatcoldelete(w,i); w intmat, i int
    69116911RETURN:      intmat, the integer matrix w with the ith comlumn deleted
    6912 NOTE:        the procedure is called by intmatsort and normalFan"
     6912NOTE:        the procedure is called by intmatsort and normalFanL"
    69136913{
    69146914  if ((i<1) or (i>ncols(w)) or (ncols(w)==1))
  • Singular/singular-libs

    r3c3e3d r8275a9  
    2323        paraplanecurves.lib phindex.lib \
    2424        pointid.lib poly.lib \
    25         oldpolymake.lib presolve.lib primdec.lib primdecint.lib \
     25        polymake.lib presolve.lib primdec.lib primdecint.lib \
    2626        primitiv.lib qhmoduli.lib random.lib realclassify.lib \
    2727        realrad.lib reesclos.lib resbinomial.lib \
     
    5353        ncfactor.lib nctools.lib perron.lib qmatrix.lib \
    5454        ncall.lib
    55        
    5655
     56
  • Tst/Short/polymake.tst

    r3c3e3d r8275a9  
    33LIB "tst.lib";
    44tst_init();
    5 LIB "oldpolymake.lib";
     5LIB "polymake.lib";
    66///////////////////////////////////////////////////////////////////////////
    77// A) Test for Procedures using Polymake
    88///////////////////////////////////////////////////////////////////////////
    99example polymakePolytope;
    10 example newtonPolytope;
     10example newtonPolytopeP;
    1111example newtonPolytopeLP;
    12 example normalFan;
     12example normalFanL;
    1313example groebnerFan;
    1414///////////////////////////////////////////////////////////////////////////
  • doc/COPYING.texi

    r3c3e3d r8275a9  
    131131@copyright{} Winfried Bruns and Bogdan Ichim
    132132@* @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})
    134134@copyright{} Ewgenij Gawrilow and Michael Joswig
    135135@* @uref{http://www.polymake.de/}
     
    142142@copyright{} Oliver Labs (2001-2008), Stephan Holzer (2004-2005)
    143143@* @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})
    145145@copyright{} J@"org Rambau
    146146@* @uref{http://www.rambau.wm.uni-bayreuth.de/TOPCOM/}
  • doc/Makefile.bsp

    r3c3e3d r8275a9  
    6363CHKSUM_DB       = ${DOC_SUBDIR}/chksum
    6464# which tags to avoid:
    65 DOC2TEX_EXAMPLE_EXCLUSIONS = -exclude oldpolymake
     65DOC2TEX_EXAMPLE_EXCLUSIONS = -exclude polymake
    6666# which tags to avoid:
    67 TAG             = oldpolymake
     67TAG             = polymake
    6868DOC2TEX         = ${PERL} ./doc2tex.pl -docdir ${DOC_SUBDIR} \
    6969                  -Singular ${SINGULAR} -verbose ${VERBOSE} -make ${MAKE} \
Note: See TracChangeset for help on using the changeset viewer.