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

  •  
    binomial ()
    UNDOCUMENTED
  •  
    find_permutation ()
    UNDOCUMENTED
  •  
    permutation_cycles ()
    UNDOCUMENTED
  •  
    permutation_matrix ()
    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.

  •  
    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
  •  
  •  
    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
  •  
  •  
    adjacency_matrix ()
    UNDOCUMENTED
  •  
    edges ()
    UNDOCUMENTED
  •  
    induced_subgraph ()
    UNDOCUMENTED
  •  
    nodes ()
    UNDOCUMENTED
  •  
    node_edge_incidences <Coord> (graph) → SparseMatrix
    UNDOCUMENTED
    Type Parameters
    Coord
    coordinate type for the resulting matrix
    Parameters
    Graphgraph
    Returns
    SparseMatrix
    node-edge incidence matrix of a graph
  •  
  •  
    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
  •  
  •  
    incl ()
    UNDOCUMENTED
  •  
    range ()
    UNDOCUMENTED
  •  
    scalar2set ()
    UNDOCUMENTED
  •  
    select_subset ()
    UNDOCUMENTED
  •  
    sequence ()
    UNDOCUMENTED
  •  
  •  
    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