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
-
Combinatoricsbinomial ()UNDOCUMENTEDfind_permutation ()UNDOCUMENTEDpermutation_cycles ()UNDOCUMENTEDpermutation_matrix ()UNDOCUMENTED
-
Data conversioncast <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 typeParameters
Object object to be modifiedReturns
Object the same object, but with modified typeconvert_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 index_matrix (m) → IncidenceMatrixGet the positions of non-zero entries of a sparse matrix.
indices (v) → Set<Int>Get the positions of non-zero entries of a sparse vector.
repeat_row ()UNDOCUMENTEDtoMatrix ()UNDOCUMENTEDtoVector ()UNDOCUMENTEDvector2col ()UNDOCUMENTEDvector2row ()UNDOCUMENTED -
Formattingprint_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 writtenInt are_eqs optional; needs to be set to 1 if the rows represent equations instead of inequalitiesOptions
Array<String> coord_labels changes the labels of the coordinates from 'x1,...,xn' to the specified namesReturns
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
Matrix data to be printedArray<String> row_labels labels for the rowsArray<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-linerows_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 printedArray<String> elem_labels labels for the elementsrows_numbered (data)Equivalent to rows_labeled with omitted row_labels argument. Formerly called "numbered".
Parameters
Matrix data to be printed -
Graph operationsadjacency_matrix ()UNDOCUMENTEDedges ()UNDOCUMENTEDinduced_subgraph ()UNDOCUMENTEDnodes ()UNDOCUMENTEDnode_edge_incidences <Coord> (graph) → SparseMatrixUNDOCUMENTED
Type Parameters
Coord coordinate type for the resulting matrixParameters
Graph graph Returns
SparseMatrix node-edge incidence matrix of a graph -
Linear Algebraanti_diag ()UNDOCUMENTEDanti_diag ()basis ()UNDOCUMENTEDbasis_affine ()UNDOCUMENTEDbasis_cols ()UNDOCUMENTEDbasis_rows ()UNDOCUMENTEDdet ()UNDOCUMENTEDdiag ()UNDOCUMENTEDdiag ()equal_bases ()
Check whether both matrices are bases of the same linear subspace.
inv ()UNDOCUMENTEDlineality_space ()UNDOCUMENTEDlin_solve ()UNDOCUMENTEDnormalized ()UNDOCUMENTEDnull_space ()UNDOCUMENTEDnull_space ()ones_vector <Element> (d)Creates a vector with all elements equal to 1.
rank ()UNDOCUMENTEDreduce ()UNDOCUMENTEDtotally_unimodular ()UNDOCUMENTEDtranspose ()UNDOCUMENTEDtranspose ()unit_matrix ()UNDOCUMENTEDunit_vector ()UNDOCUMENTEDzero_vector <Element> (d)Creates a vector with all elements equal to zero.
-
Otherperturb_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
Matrix M Float eps the factor by which the random matrix is multiplied default value: 1Bool not_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
Int seed controls the outcome of the random number generator; fixing a seed number guarantees the same outcome.Returns
Matrix -
Set operationsincl ()UNDOCUMENTEDrange ()UNDOCUMENTEDscalar2set ()UNDOCUMENTEDselect_subset ()UNDOCUMENTEDsequence ()UNDOCUMENTED
-
Utilitiesbounding_box (m) → Matrix
Compute a column-wise bounding box for the give matrix
histogram (data) → Map<Element, Int>Produce a histogram of a container: each different element value is mapped on the number of its occurences.
-
Visualizationcompose (vis_obj ...) → Visual::Container
Create a composite drawing of several objects.
Parameters
Visual::Object vis_obj ... objects to be drawn togetherOptions
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::ContainerAdd new objects to a composite drawing.
Parameters
Visual::Container vis_container drawing produced by some visualization functionVisual::Object vis_obj ... objects to be addedOptions
String Title new name for the drawingany decorations 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::Object vis_obj ... objects to displayOptions
String File "filename" or "AUTO" Store the objects in agcl
(geomview control language) file instead of starting the interactive GUI. The geometric data inOFF
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 theopen
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::Object vis_obj ... objects to displayOptions
String File "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 theopen
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::Object vis_obj ... objects to displayOptions
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 theopen
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::Object vis_obj ... objects to drawOptions
String File "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 theopen
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::Object vis_obj ... objects to displayOptions
String File "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 theopen
function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe.static (vis_obj) → Visual::ObjectSuppress creation of dynamic (interactive) scenes.
Parameters
Visual::Object vis_obj drawing, e.g. created byVISUAL_GRAPH
orSCHLEGEL
.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
-
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
-
Monomial
UNDOCUMENTED
-
NodeHashMap
UNDOCUMENTED
-
NodeIterator
UNDOCUMENTED
-
NodeMap
UNDOCUMENTED
-
NodeSet
UNDOCUMENTED
-
NonSymmetric
UNDOCUMENTED
-
Pair
UNDOCUMENTED
-
Polynomial
UNDOCUMENTED
User Methods of Polynomial
-
PowerSet
UNDOCUMENTED
-
Rational
UNDOCUMENTED
-
SCALAR
UNDOCUMENTED
-
Serialized
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
-
UniTerm
UNDOCUMENTED
-
VisualizationFlexible
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.
HSVA color described as a Hue-Saturation-Value triple. Is convertible to and from an RGB representation.
RGBA 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
-
VisualizationVisual::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 drawingString Name the name of this visual object in the drawingBool 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 displayedString VertexLabels alias for PointLabelsFlexible<RGB> PointColor color of the spheres or rectangles representing the pointsFlexible<RGB> VertexColor alias for PointColorFlexible<Float> PointThickness scaling factor for the size of the spheres or rectangles representing the pointsFlexible<Float> VertexThickness alias for PointThicknessFlexible<RGB> PointBorderColor color of the border line of rectangles representing the pointsFlexible<Float> VertexBorderColor alias for PointBorderColorFlexible<Float> PointBorderThickness scaling factor for the thickness of the border line of rectangles representing the pointsFlexible<Float> VertexBorderThickness alias for PointBorderThicknessFlexible<String> PointStyle if set to "hidden", neither point nor its label is renderedFlexible<String> VertexStyle alias for PointStyleVisual::Polygon::decorationsimports from: Visual::PointSet::decorationsAttributes modifying the appearance of filled polygons.
Options
RGB FacetColor filling color of the polygonFloat 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 renderedRGB EdgeColor color of the boundary linesFloat EdgeThickness scaling factor for the thickness of the boundary linesString EdgeStyle if set to "hidden", the boundary lines are not renderedVisual::Polygons::decorationsimports from: Visual::PointSet::decorationsAttributes modifying the appearance of a set of polygons (like a polygonal surface).
Options
Flexible<RGB> FacetColor filling color of the polygonsFlexible<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 allString 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 linesFloat EdgeThickness scaling factor for the thickness of the boundary linesString EdgeStyle if set to "hidden", the boundary lines are not renderedVisual::Wire::decorationsimports from: Visual::PointSet::decorationsAttributes modifying the appearance of "wire frameworks". Unlike the rest, the flexible edge attributes are retrieved using the edge iterator as an index/key/argument.
Options
Flexible<RGB> EdgeColor color of the lines representing the edgesFlexible<Float> EdgeThickness scaling factor for the thickness of the lines representing the edgesEdgeMap<String> EdgeLabels textual labels to be placed along the edgesFlexible<String> EdgeStyle if set to "hidden", neither the edge nor its label is rendered