application: common

This artificial application gathers functionality shared by many "real" applications. While most users can probably do without looking into this you may find some useful functions here.


User Functions

  •  
    cols ()

    UNDOCUMENTED

  •  
    cols ()

    UNDOCUMENTED

  •  
    denominator ()

    UNDOCUMENTED

  •  
    gcd ()

    UNDOCUMENTED

  •  
    numerator ()

    UNDOCUMENTED

  •  
    rows ()

    UNDOCUMENTED

  •  
    rows ()

    UNDOCUMENTED

  •  
    sketch ()

    FIXME: view point option unused

  •  
    •  
      ceil ()

      UNDOCUMENTED
    •  
      denominator ()

      UNDOCUMENTED
    •  
      div ()

      Compute the quotient and remainder in one operation.

    •  
      div_exact ()

      Compute the ratio of two given integral numbers under the assumption that the dividend is a multiple of the divisor.

    •  
      fac ()

      Compute the factorial of the given number.

    •  
      floor ()

      UNDOCUMENTED
    •  
      gcd ()

      Compute the greatest common divisor of two given integral numbers.

    •  
      gcd ()

      Compute the greatest common divisor of the elements of the given vector.

    •  
      gcd_ext () → a

      Compute the greatest common divisor of two given integral numbers (a, b).

      Returns
      a
      list (g, p, q, m, n): g=gcd(a,b) g=p*a+q*b a=m*g, b=n*g
    •  
      isfinite ()

      Check whether the given number has a finite value.

    •  
      isinf ()

      Check whether the given number has an infinite value. Return -1/+1 for infinity and 0 for all finite values.

    •  
      is_one ()

      compare with the one (1) value of the corresponding data type

    •  
      is_zero ()

      compare with the zero (0) value of the corresponding data type

    •  
      lcm ()

      Compute the least common multiple of two given integral numbers.

    •  
      lcm ()

      Compute the least common multiple of the elements of the given vector.

    •  
      numerator ()

      UNDOCUMENTED
  •  
  •  
    •  
      cast <Target> (object) → Object

      Change the type of the polymake object: only downcast (to a derived type) and upcast (to an ancestor type) are allowed.

      Type Parameters
      Target
      the desired new type
      Parameters
      Objectobject
      to be modified
      Returns
      Object
      the same object, but with modified type
    •  
      convert_to ()

      convert to different scalar type if needed

    •  
      convert_to ()

      Convert to different element type if needed.

    •  
      convert_to ()

      Convert to different element type if needed.

    •  
      dense ()

      UNDOCUMENTED

    •  
      dense ()

      UNDOCUMENTED

    •  
      dense (v)

      Convert to an equivalent dense vector of the same element type

      Parameters
      SparseVectorv
    •  
      dense (m)

      Convert to an equivalent dense matrix of the same element type

      Parameters
      SparseMatrixm
    •  
      dense (m)

      Convert to a dense 0/1 matrix

      Parameters
      IncidenceMatrixm
    •  
      dense (s, dim)

      Convert to a dense 0/1 vector of a given dimension

      Parameters
      Sets
      Intdim
    •  
      index_matrix (m) → IncidenceMatrix

      Get the positions of non-zero entries of a sparse matrix.

      Parameters
      SparseMatrixm
      Returns
      IncidenceMatrix
    •  
      indices (v) → Set<Int>

      Get the positions of non-zero entries of a sparse vector.

      Parameters
      SparseVectorv
      Returns
      Set<Int>
    •  
      repeat_row ()

      UNDOCUMENTED
    •  
      toMatrix ()

      UNDOCUMENTED
    •  
      toVector ()

      UNDOCUMENTED
    •  
      vector2col ()

      UNDOCUMENTED
    •  
      vector2row ()

      UNDOCUMENTED
  •  
    •  
      latex (data, elem_labels) → String

      LaTeX output of a matrix.

      Parameters
      Matrixdata
      to be printed
      Array<String>elem_labels
      optional labels for elements; if data is an IncidenceMatrix, Array<Set>, or similar, each element will be replaced by its label.
      Returns
      String
      to be used with \usepackage{amsmath}
    •  
      print_constraints (M, are_eqs) → bool

      Write the rows of a matrix M as inequalities (are_eqs=0) or equations (are_eqs=1) in a readable way. It is possible to specify labels for the coordinates via an optional array coord_labels.

      Parameters
      Matrix<Scalar>M
      the matrix whose rows are to be written
      Intare_eqs
      optional; needs to be set to 1 if the rows represent equations instead of inequalities
      Options
      Array<String>coord_labels
      changes the labels of the coordinates from 'x1,...,xn' to the specified names
      Returns
      bool
    •  
      rows_labeled (data, row_labels, elem_labels) → Array<String>

      Prepares a matrix for printing, prepends each row with a label and a colon.

      Parameters
      Matrixdata
      to be printed
      Array<String>row_labels
      labels for the rows
      Array<String>elem_labels
      optional labels for elements; if data is an IncidenceMatrix, Array<Set>, or similar, each element will be replaced by its label.
      Returns
      Array<String>
      each string ending with end-of-line
    •  
      rows_labeled (graph, elem_labels)

      Like above, but specialized for Graphs (defined for convenience: a PTL Graph is not a container)

      Parameters
      Graphgraph
      to be printed
      Array<String>elem_labels
      labels for the elements
    •  
      rows_numbered (data)

      Equivalent to rows_labeled with omitted row_labels argument. Formerly called "numbered".

      Parameters
      Matrixdata
      to be printed
  •  
  •  
    •  
      smith_normal_form (M, inv) → SmithNormalForm

      Compute the Smith normal form of a given matrix M. The function returns a struct SmithNormalForm with five entries: SNF: the Smith normal form S of M Torsion: an array containing the absolute values of the entries greater than 1 of the diagonal together with their multiplicity Rank: the rank of the matrix LeftCompanion/RightCompanion: unimodular matrices L and R such that M = LSR if the optional bool value inv is false, and S = LMR if the optional bool value inv is true

      Parameters
      MatrixM
      , must be of integer type
      Boolinv
      , optional, if true, compute the inverse of the companion matrices
      Returns
      SmithNormalForm
      containing the Smith normal form, the companion matrices, the torsion vector and the rank
  •  
  •  
    •  
      anti_diag ()

      UNDOCUMENTED
    •  
    •  
      basis ()

      UNDOCUMENTED
    •  
      basis_affine ()

      UNDOCUMENTED
    •  
      basis_cols ()

      UNDOCUMENTED
    •  
      basis_rows ()

      UNDOCUMENTED
    •  
      det ()

      UNDOCUMENTED
    •  
      diag ()

      UNDOCUMENTED
    •  
      diag ()

    •  
      equal_bases ()

      Check whether both matrices are bases of the same linear subspace.

    •  
      inv ()

      UNDOCUMENTED
    •  
      lineality_space ()

      UNDOCUMENTED
    •  
      lin_solve ()

      UNDOCUMENTED
    •  
      normalized ()

      UNDOCUMENTED
    •  
      null_space ()

      UNDOCUMENTED
    •  
    •  
      ones_vector <Element> (d)

      Creates a vector with all elements equal to 1.

      Type Parameters
      Element
      type of the vector elements, defaults to Rational.
      Parameters
      Intd
      vector dimension. If omitted, a vector of dimension 0 is created, which can adjust itself when involved in a block matrix operation.
    •  
      rank ()

      UNDOCUMENTED
    •  
      reduce ()

      UNDOCUMENTED
    •  
      totally_unimodular ()

      UNDOCUMENTED
    •  
      transpose ()

      UNDOCUMENTED
    •  
    •  
      unit_matrix ()

      UNDOCUMENTED
    •  
      unit_vector ()

      UNDOCUMENTED
    •  
      zero_vector <Element> (d)

      Creates a vector with all elements equal to zero.

      Type Parameters
      Element
      type of the vector elements, defaults to Rational.
      Parameters
      Intd
      vector dimension. If omitted, a vector of dimension 0 is created, which can adjust itself when involved in a block matrix operation.
  •  
    •  
      perturb_matrix (M, eps, not_hom) → Matrix

      Perturb a given matrix M by adding a random matrix. The random matrix consists of vectors that are uniformly distributed on the unit sphere. Optionally, the random matrix can be scaled by a factor eps.

      Parameters
      MatrixM
      Floateps
      the factor by which the random matrix is multiplied default value: 1
      Boolnot_hom
      if set to 1, the first column will also be perturbed; otherwise the first columns of the input matrix M and the perturbed one coincide (useful for working with homogenized coordinates); default value: 0 (homogen. coords)
      Options
      Intseed
      controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.
      Returns
      Matrix
  •  
  •  
    •  
      average (array)

      Returns the average value of the array elements.

      Parameters
      Arrayarray
    •  
      bounding_box (m) → Matrix

      Compute a column-wise bounding box for the give matrix

      Parameters
      Matrixm
      Returns
      Matrix
      : row(0) contains lower bounds, row(1) contains upper bounds
    •  
      fibonacci (m)

      Returns the first m Fibonacci numbers.

      Parameters
      Intm
    •  
      histogram (data) → Map<Element, Int>

      Produce a histogram of a container: each different element value is mapped on the number of its occurences.

      Parameters
      Container<Element>data
      Returns
      Map<Element, Int>
    •  
      maximum (array)

      Returns the maximal element of an array.

      Parameters
      Arrayarray
    •  
      minimum (array)

      Returns the minimal element of an array.

      Parameters
      Arrayarray
  •  
    •  
      compose (vis_obj ...) → Visual::Container

      Create a composite drawing of several objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to be drawn together
      Options
      StringTitle
      name of the whole drawing; per default the name of the first Object is taken.
      anydecorations
      to be applied to all components as default values.
      Returns
      Visual::Container
      if called in void context, immediately starts the preferred rendering program.
    •  
      compose (vis_container, vis_obj ...) → Visual::Container

      Add new objects to a composite drawing.

      Parameters
      Visual::Containervis_container
      drawing produced by some visualization function
      Visual::Objectvis_obj ...
      objects to be added
      Options
      StringTitle
      new name for the drawing
      anydecorations
      to be applied to all components as default values.
      Returns
      Visual::Container
      if called in void context, immediately starts the preferred rendering program.
    •  
      geomview (vis_obj ...)

      Run geomview to display given visual objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to display
      Options
      StringFile
      "filename" or "AUTO" Store the objects in a gcl (geomview control language) file instead of starting the interactive GUI. The geometric data in OFF format is embedded in the Lisp-style commands, but can be easily extracted using any text editor, if needed.
      The .gcl suffix is automatically added to the file name.
      Specify AUTO if you want the filename be automatically derived from the drawing title.
      You can also use any expression allowed for the open function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe.
    •  
      javaview (vis_obj ...)

      Run JavaView with the given visual objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to display
      Options
      StringFile
      "filename" or "AUTO" Store the object description in a JVX file without starting the interactive GUI. The .jvx suffix is automatically added to the file name.
      Specify AUTO if you want the filename be automatically derived from the drawing title.
      You can also use any expression allowed for the open function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe.
    •  
      jreality (vis_obj ...)

      Run jReality to display given visual objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to display
      Options
      StringFile
      "filename" or "AUTO" Store the object description in a bean shell source file without starting the interactive GUI. The .bsh suffix is automatically added to the file name.
      Specify AUTO if you want the filename be automatically derived from the drawing title.
      You can also use any expression allowed for the open function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe.
    •  
      postscript (vis_obj ...)

      Create a Postscript (tm) drawing with the given visual objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to draw
      Options
      StringFile
      "filename" or "AUTO" Store the drawing in a file without starting the viewer. The .ps suffix is automatically added to the file name.
      Specify AUTO if you want the filename be automatically derived from the drawing title.
      You can also use any expression allowed for the open function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe.
    •  
      povray (vis_obj ...)

      Run POVRAY to display given visual objects.

      Parameters
      Visual::Objectvis_obj ...
      objects to display
      Options
      StringFile
      "filename" or "AUTO" Store the object description in a POVRAY source file without actual rendering. The .pov suffix is automatically added to the file name.
      Specify AUTO if you want the filename be automatically derived from the drawing title.
      You can also use any expression allowed for the open function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe.
    •  
      static (vis_obj) → Visual::Object

      Suppress creation of dynamic (interactive) scenes.

      Parameters
      Visual::Objectvis_obj
      drawing, e.g. created by VISUAL_GRAPH or SCHLEGEL.
      Returns
      Visual::Object
      if called in void context, immediately starts the preferred rendering program.

Property Types

Common Option Lists

  •  
    •  
      Visual::PointSet::decorations

      Common attributes modifying the appearance of PointSets and all visual objects derived thereof. Please be aware that no one visualization program interfaced to polymake supports all of them. Unsupported options are normally ignored.

      Options
      String Title
      the name of the drawing
      String Name
      the name of this visual object in the drawing
      Bool Hidden
      if set to true, the visual object is not rendered (useful for interactive visualization programs allowing for switching details on and off) String if set to "hidden", no point labels are displayed
      enum PointLabels
      ("hidden"), String alias for PointLabels
      enum VertexLabels
      ("hidden"),
      Flexible<RGB> PointColor
      color of the spheres or rectangles representing the points
      Flexible<RGB> VertexColor
      alias for PointColor
      Flexible<Float> PointThickness
      scaling factor for the size of the spheres or rectangles representing the points
      Flexible<Float> VertexThickness
      alias for PointThickness
      Flexible<RGB> PointBorderColor
      color of the border line of rectangles representing the points
      Flexible<Float> VertexBorderColor
      alias for PointBorderColor
      Flexible<Float> PointBorderThickness
      scaling factor for the thickness of the border line of rectangles representing the points
      Flexible<Float> VertexBorderThickness
      alias for PointBorderThickness
      Flexible<String> PointStyle
      if set to "hidden", neither point nor its label is rendered
      Flexible<String> VertexStyle
      alias for PointStyle
      array ViewPoint
      ViewPoint for Sketch visualization
      array ViewDirection
      ViewDirection for Sketch visualization
      array ViewUp
      ViewUp for Sketch visualization
    •  
      Visual::Polygon::decorations

      Attributes modifying the appearance of filled polygons.

      imports from: Visual::PointSet::decorations

      Options
      RGBFacetColor
      filling color of the polygon
      FloatFacetTransparency
      transparency factor of the polygon between 0 (opaque) and 1 (completely translucent)
      StringFacetStyle
      if set to "hidden", the inner area of the polygon is not rendered
      RGBEdgeColor
      color of the boundary lines
      FloatEdgeThickness
      scaling factor for the thickness of the boundary lines
      StringEdgeStyle
      if set to "hidden", the boundary lines are not rendered
    •  
      Visual::Polygons::decorations

      Attributes modifying the appearance of a set of polygons (like a polygonal surface).

      imports from: Visual::PointSet::decorations

      Options
      Flexible<RGB>FacetColor
      filling color of the polygons
      Flexible<Float>FacetTransparency
      transparency factor of the polygons between 0 (opaque) and 1 (completely translucent)
      Flexible<String>FacetStyle
      if set to "hidden", the inner area of the polygons are not rendered at all
      StringFacetLabels
      if set to "hidden", the facet labels are not displayed (in the most cases this is the default behavior)
      RGBEdgeColor
      color of the boundary lines
      FloatEdgeThickness
      scaling factor for the thickness of the boundary lines
      StringEdgeStyle
      if set to "hidden", the boundary lines are not rendered
    •  
      Visual::Wire::decorations

      Attributes modifying the appearance of "wire frameworks". Unlike the rest, the flexible edge attributes are retrieved using the edge iterator as an index/key/argument.

      imports from: Visual::PointSet::decorations

      Options
      Flexible<RGB>EdgeColor
      color of the lines representing the edges
      Flexible<Float>EdgeThickness
      scaling factor for the thickness of the lines representing the edges
      EdgeMap<String>EdgeLabels
      textual labels to be placed along the edges
      Flexible<String>EdgeStyle
      if set to "hidden", neither the edge nor its label is rendered