[[application: common]]

# 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

- ###
  Arithmetic

- ceil ()
  UNDOCUMENTED
- denominator ()
  UNDOCUMENTED
- div_exact ()
  UNDOCUMENTED
- fac ()
  UNDOCUMENTED
- floor ()
  UNDOCUMENTED
- gcd ()
  UNDOCUMENTED
- gcd ()
- isfinite ()
  UNDOCUMENTED
- isinf ()
  UNDOCUMENTED
- lcm ()
  UNDOCUMENTED
- numerator ()
  UNDOCUMENTED

- ###
  Combinatorics

- binomial ()
  UNDOCUMENTED
- find_permutation ()
  UNDOCUMENTED
- permutation_cycles ()
  UNDOCUMENTED
- permutation_matrix ()
  UNDOCUMENTED

- ###
  Data conversion

- 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

  Object | object | 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.

- dense ()

  UNDOCUMENTED

- dense ()

  UNDOCUMENTED

- dense (v)

  Convert to an equivalent dense vector of the same element type

  ##### Parameters

  SparseVector | v |

- dense (m)

  Convert to an equivalent dense matrix of the same element type

  ##### Parameters

  SparseMatrix | m |

- dense (m)

  Convert to a dense 0/1 matrix

  ##### Parameters

  IncidenceMatrix | m |

- dense (s, dim)

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

  ##### Parameters

  Set | s |
  Int | dim |

- toMatrix ()
  UNDOCUMENTED
- toVector ()
  UNDOCUMENTED
- vector2col ()
  UNDOCUMENTED
- vector2row ()
  UNDOCUMENTED

- ###
  Formatting

- rows_labeled (data, row_labels, elem_labels) → Array<String>

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

  ##### Parameters

  Matrix | data | 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

  Graph | graph | 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

  Matrix | data | to be printed

- ###
  Graph operations

- adjacency_matrix ()
  UNDOCUMENTED
- edges ()
  UNDOCUMENTED
- induced_subgraph ()
  UNDOCUMENTED
- nodes ()
  UNDOCUMENTED
- node_edge_incidences (graph)
  UNDOCUMENTED

  ##### Parameters

  directed | graph | node-edge incidence matrix of an undirected graph

- ###
  Linear Algebra

- anti_diag ()
  UNDOCUMENTED
- anti_diag ()
- 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
- null_space ()
- 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

  Int | d | 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
- transpose ()
- 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

  Int | d | vector dimension. If omitted, a vector of dimension 0 is created, which can adjust itself when involved in a block matrix operation.

- ###
  Set operations

- incl ()
  UNDOCUMENTED
- range ()
  UNDOCUMENTED
- scalar2set ()
  UNDOCUMENTED
- select_subset ()
  UNDOCUMENTED
- sequence ()
  UNDOCUMENTED

- ###
  Utilities

- average (array)

  Returns the average value of the array elements.

  ##### Parameters

  Array | array |

- bounding_box (m) → Matrix

  Compute a column-wise bounding box for the give matrix

  ##### Parameters

  Matrix | m |

  ##### Returns

  Matrix | : row(0) contains lower bounds, row(1) contains upper bounds

- fibonacci (m)

  Returns the first m Fibonacci numbers.

  ##### Parameters

  Int | m |

- 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

  Array | array |

- minimum (array)

  Returns the minimal element of an array.

  ##### Parameters

  Array | array |

- ###
  Visualization

- compose (vis_obj ...) → Visual::Container

  Create a composite drawing of several objects.

  ##### Parameters

  Visual::Object | vis_obj ... | objects to be drawn together

  ##### Options

  String | Title | name of the whole drawing; per default the name of the first Object is taken.
  any | decorations | 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::Container | vis_container | drawing produced by some visualization function
  Visual::Object | vis_obj ... | objects to be added

  ##### Options

  String | Title | new name for the drawing
  any | decorations | to be applied to all components as default values.

  ##### Returns

  Visual::Container | if called in void context, immediately starts the preferred rendering program.

- jreality (vis_obj ...)

  Run jReality to display given visual objects.

  ##### Parameters

  Visual::Object | vis_obj ... | objects to display

  ##### Options

  String

  File

  "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.

- static (vis_obj) → Visual::Object

  Suppress creation of dynamic (interactive) scenes.

  ##### Parameters

  Visual::Object | vis_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

- all_rows_or_cols

  UNDOCUMENTED

- Array

  UNDOCUMENTED

- ARRAY

  UNDOCUMENTED

  derived from: Array<SCALAR>
- Bool

  UNDOCUMENTED

- Directed

  UNDOCUMENTED

- EdgeHashMap

  UNDOCUMENTED

- EdgeIterator

  UNDOCUMENTED

- EdgeList

  UNDOCUMENTED

- EdgeMap

  UNDOCUMENTED

- FacetList

  UNDOCUMENTED

- Float

  UNDOCUMENTED

- Graph

  UNDOCUMENTED

  #### User Methods of Graph

  - add_node ()

    UNDOCUMENTED

  - adjacent_nodes (node)

    Gives the indices of the nodes adjacent to node.

    ##### Parameters

    Int | node |

  - contract_edge ()

    UNDOCUMENTED

  - degree ()

    UNDOCUMENTED

  - delete_edge ()

    UNDOCUMENTED

  - delete_node ()

    UNDOCUMENTED

  - dim ()

    UNDOCUMENTED

  - edge ()

    UNDOCUMENTED

  - edges ()

    UNDOCUMENTED

  - edge_exists ()

    UNDOCUMENTED

  - has_gaps ()

    UNDOCUMENTED

  - in_adjacent_nodes (node)

    Gives the indices of the nodes that have an edge to node.

    ##### Parameters

    Int | node |

  - in_degree ()

    UNDOCUMENTED

  - in_edges ()

    UNDOCUMENTED

  - nodes ()

    UNDOCUMENTED

  - node_exists ()

    UNDOCUMENTED

  - out_adjacent_nodes (node)

    Gives the indices of the nodes with an edge arriving from node.

    ##### Parameters

    Int | node |

  - out_degree ()

    UNDOCUMENTED

  - out_edges ()

    UNDOCUMENTED

  - squeeze ()

    UNDOCUMENTED

- HashMap

  UNDOCUMENTED

- HashSet

  UNDOCUMENTED

- IncidenceMatrix

  UNDOCUMENTED

  #### User Methods of IncidenceMatrix

  - col ()

    UNDOCUMENTED

  - cols ()

    UNDOCUMENTED

  - minor ()

    UNDOCUMENTED

  - row ()

    UNDOCUMENTED

  - rows ()

    UNDOCUMENTED

  - squeeze ()

    UNDOCUMENTED

  - squeeze_cols ()

    UNDOCUMENTED

  - squeeze_rows ()

    UNDOCUMENTED

- Int

  UNDOCUMENTED

- Integer

  UNDOCUMENTED

- Iterator

  UNDOCUMENTED

- List

  UNDOCUMENTED

- LocalFloatEpsilon

  UNDOCUMENTED

- Map

  UNDOCUMENTED

- Matrix

  UNDOCUMENTED

  #### User Methods of Matrix

  - anti_diagonal ()

    UNDOCUMENTED

  - col ()

    UNDOCUMENTED

  - cols ()

    UNDOCUMENTED

  - diagonal ()

    UNDOCUMENTED

  - div_exact ()

    UNDOCUMENTED

  - minor ()

    UNDOCUMENTED

  - row ()

    UNDOCUMENTED

  - rows ()

    UNDOCUMENTED

- Monomial

  UNDOCUMENTED

- NodeHashMap

  UNDOCUMENTED

- NodeIterator

  UNDOCUMENTED

- NodeMap

  UNDOCUMENTED

- NodeSet

  UNDOCUMENTED

- NonSymmetric

  UNDOCUMENTED

- Pair

  UNDOCUMENTED

- Polynomial

  UNDOCUMENTED

  #### User Methods of Polynomial

  - lc ()

    UNDOCUMENTED

  - lm_exp ()

    UNDOCUMENTED

- PowerSet

  UNDOCUMENTED

- Rational

  UNDOCUMENTED

- Ring

  UNDOCUMENTED

  #### User Methods of Ring

  - names ()

    UNDOCUMENTED

  - variable ()

    UNDOCUMENTED

  - variables ()

    UNDOCUMENTED

- SCALAR

  UNDOCUMENTED

- Serialized

  UNDOCUMENTED

- Set

  UNDOCUMENTED

  #### User Methods of Set

  - size ()

    UNDOCUMENTED

- SparseIterator

  UNDOCUMENTED

- SparseMatrix

  UNDOCUMENTED

  #### User Methods of SparseMatrix

  - squeeze ()

    UNDOCUMENTED

  - squeeze_cols ()

    UNDOCUMENTED

  - squeeze_rows ()

    UNDOCUMENTED

- SparseVector

  UNDOCUMENTED

  #### User Methods of SparseVector

  - size ()

    UNDOCUMENTED

- String

  UNDOCUMENTED

- Symmetric

  UNDOCUMENTED

- Term

  UNDOCUMENTED

- Text

  UNDOCUMENTED

- Tuple

  UNDOCUMENTED

- Undirected

  UNDOCUMENTED

- UniMonomial

  UNDOCUMENTED

- UniPolynomial

  UNDOCUMENTED

  #### User Methods of UniPolynomial

  - lc ()

    UNDOCUMENTED

  - lm_exp ()

    UNDOCUMENTED

- UniTerm

  UNDOCUMENTED

- Vector

  UNDOCUMENTED

  #### User Methods of Vector

  - dim ()

    UNDOCUMENTED

  - div_exact ()

    UNDOCUMENTED

  - slice ()

    UNDOCUMENTED

  - slice ()

    UNDOCUMENTED

- ###
  Visualization

- Flexible

  This is a pseudo-type for documentation purposes only. Many options of visualization functions modifying the appearance of some set of graphical elements like points, edges, facets, etc. accept a wide range of possible values, allowing for different grades of flexibility (and complexity):

  SCALAR the same attribute value is applied to all elements ARRAY each element gets its individual attribute value HASH elements found in the hash get their individual attribute values, for the rest the appropriate default applies SUB a piece of code computing the attribute value for the given element

  Unless specified explicitly in the detailed option description, the indices, keys, or subroutine arguments used for retrieval of the attribute values are just the zero-based ordinal numbers of the elements.

- HSV

  A color described as a Hue-Saturation-Value triple. Is convertible to and from an RGB representation.

- RGB

  A color described as a Red-Green-Blue triple. Can be constructed from a list of three integral values from the range 0..255, or a list of three floating-point values from the range 0..1, or one of symbolic names listed in the system-wide file `rgb.txt`.

## Common Option Lists

- ###
  Visualization

- 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 | PointLabels | if set to "hidden", no point labels are displayed
  String | VertexLabels | alias for PointLabels
  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

- Visual::Polygon::decorations

  Attributes modifying the appearance of filled polygons.

  imports from: Visual::PointSet::decorations

  ##### Options

  RGB | FacetColor | filling color of the polygon
  Float | FacetTransparency | transparency factor of the polygon between 0 (opaque) and 1 (completely translucent)
  String | FacetStyle | if set to "hidden", the inner area of the polygon is not rendered
  RGB | EdgeColor | color of the boundary lines
  Float | EdgeThickness | scaling factor for the thickness of the boundary lines
  String | EdgeStyle | 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
  String | FacetLabels | if set to "hidden", the facet labels are not displayed (in the most cases this is the default behavior)
  RGB | EdgeColor | color of the boundary lines
  Float | EdgeThickness | scaling factor for the thickness of the boundary lines
  String | EdgeStyle | 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