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
-
-
-
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 typeParameters
Object object to be modifiedReturns
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)
-
dense (m)
-
dense (m)
-
index_matrix (m) → IncidenceMatrix
Get the positions of non-zero entries of a sparse matrix.
-
indices (v) → Set<Int>
-
repeat_row ()UNDOCUMENTED
-
toMatrix ()UNDOCUMENTED
-
toVector ()UNDOCUMENTED
-
vector2col ()UNDOCUMENTED
-
vector2row ()UNDOCUMENTED
-
-
-
latex (data, elem_labels) → String
LaTeX output of a matrix.
Parameters
Matrix data to be printedArray<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 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-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 printedArray<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
-
-
-
adjacency_matrix ()UNDOCUMENTED
-
edges ()UNDOCUMENTED
-
induced_subgraph ()UNDOCUMENTED
-
nodes ()UNDOCUMENTED
-
node_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
-
-
-
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
Matrix M , must be of integer typeBool inv , optional, if true, compute the inverse of the companion matricesReturns
SmithNormalForm containing the Smith normal form, the companion matrices, the torsion vector and the rank
-
-
-
eliminate_denominators (v) → Vector<Integer>
scale a vector with the least common multiple of the denominators of its coordinates
-
eliminate_denominators (v) → Matrix<Integer>
scale a vector with the least common multiple of the denominators of its coordinates
-
is_integral (v) → bool
-
is_integral (m) → bool
-
primitive (v) → Vector<Integer>
-
primitive (M) → Matrix<Integer>
-
primitive_affine (v) → Vector<Integer>
scales the affine part of a vector to a primitive integral vector
-
primitive_affine (M) → Matrix<Integer>
scales the affine part of each row of the matrix to a primitive integral vector
-
-
-
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)
-
rank ()UNDOCUMENTED
-
reduce ()UNDOCUMENTED
-
totally_unimodular ()UNDOCUMENTED
-
transpose ()UNDOCUMENTED
-
transpose ()
-
unit_matrix ()UNDOCUMENTED
-
unit_vector ()UNDOCUMENTED
-
zero_vector <Element> (d)
-
-
-
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
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
-
-
-
incl ()UNDOCUMENTED
-
range ()UNDOCUMENTED
-
scalar2set ()UNDOCUMENTED
-
select_subset ()UNDOCUMENTED
-
sequence ()UNDOCUMENTED
-
-
-
bounding_box (m) → Matrix
-
histogram (data) → Map<Element, Int>
Produce a histogram of a container: each different element value is mapped on the number of its occurences.
-
-
compose (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::Container
Add 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::Object
Suppress 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
-
Bool
UNDOCUMENTED
-
Directed
UNDOCUMENTED
-
EdgeHashMap
UNDOCUMENTED
-
EdgeIterator
UNDOCUMENTED
-
EdgeList
UNDOCUMENTED
-
EdgeMap
UNDOCUMENTED
-
Float
UNDOCUMENTED
-
Graph
UNDOCUMENTED
User Methods of Graph
-
add_node ()
UNDOCUMENTED
-
adjacent_nodes (node)
-
contract_edge ()
UNDOCUMENTED
-
degree ()
UNDOCUMENTED
-
delete_edge ()
UNDOCUMENTED
-
delete_node ()
UNDOCUMENTED
-
dim ()
UNDOCUMENTED
-
edge ()
UNDOCUMENTED
-
edges ()
UNDOCUMENTED
-
edge_exists ()
UNDOCUMENTED
-
has_gaps ()
UNDOCUMENTED
-
invalid_node ()
UNDOCUMENTED
-
in_adjacent_nodes (node)
-
in_degree ()
UNDOCUMENTED
-
in_edges ()
UNDOCUMENTED
-
nodes ()
UNDOCUMENTED
-
node_exists ()
UNDOCUMENTED
-
node_out_of_range ()
UNDOCUMENTED
-
out_adjacent_nodes (node)
-
out_degree ()
UNDOCUMENTED
-
out_edges ()
UNDOCUMENTED
-
squeeze ()
UNDOCUMENTED
-
squeeze_isolated ()
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
-
PowerSet
UNDOCUMENTED
-
Rational
UNDOCUMENTED
-
RationalFunction
UNDOCUMENTED
-
SCALAR
UNDOCUMENTED
-
Serialized
UNDOCUMENTED
-
SparseIterator
UNDOCUMENTED
-
SparseMatrix
UNDOCUMENTED
User Methods of SparseMatrix
-
squeeze ()
UNDOCUMENTED
-
squeeze_cols ()
UNDOCUMENTED
-
squeeze_rows ()
UNDOCUMENTED
-
-
String
UNDOCUMENTED
-
Symmetric
UNDOCUMENTED
-
Term
UNDOCUMENTED
-
Text
UNDOCUMENTED
-
Tuple
UNDOCUMENTED
-
Undirected
UNDOCUMENTED
-
UniMonomial
UNDOCUMENTED
-
UniTerm
UNDOCUMENTED
-
-
SmithNormalForm
fields: SNF, LeftCompanion, RightCompanion, Torsion, Rank
-
-
-
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
-
-
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 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 if set to "hidden", no point labels are displayedenum PointLabels ("hidden"), String alias for PointLabelsenum VertexLabels ("hidden"),Flexible<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 PointStylearray ViewPoint ViewPoint for Sketch visualizationarray ViewDirection ViewDirection for Sketch visualizationarray ViewUp ViewUp for Sketch visualization -
Visual::Polygon::decorationsimports from: Visual::PointSet::decorations
Attributes 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 rendered -
Visual::Polygons::decorationsimports from: Visual::PointSet::decorations
Attributes 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 rendered -
Visual::Wire::decorationsimports from: Visual::PointSet::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.
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
-