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.
Objects
-
This is the common base class of all `big' objects in polymake. It is included in the online help because it provides several useful methods for scripting and interactive use.
User Methods of Core::Object
-
apply_rule (pattern)
Executes the specified production rule. If the object does not possess enough initial properties to provide all required rule sources, or any of its preconditions are not satisfied, an exception is raised.
Parameters
String pattern : either a label (see prefer) or a rule header. The rule header must exactly match the definition in the rulefile, up to white spaces around property names. If the given pattern matches headers of several rules, or the given label is associated with several rules, the rule chain with smallest total weight (including the rules supplying the source properties) is chosen. -
disable_rules (pattern)
Temporarily disable production rules matching given pattern for an object. Rules are re-enabled after the complete execution of the current script or input expression in interactive mode.
Works much like the user function disable_rules but only affecting the given object.
Parameters
String pattern : either a label (see prefer) or a rule header. The rule header must exactly match the definition in the rulefile, up to white spaces around property names. If the given pattern matches headers of several rules, or the given label is associated with several rules, they all will be disabled regardless their precoditions, weights, or other attributes. -
dont_save ()
Clears the `changed' flag in the object, so that it won't be saved in the XML file it stems from. This method is primarily designed for unit tests, but could be also useful in interactive mode if you want to revert all recent changes and reload the object from the data file.
-
get_schedule (request) → Core::RuleChain
Compose an optimal chain of production rules providing all requested properties. The returned RuleChain object can be applied to the original object as well as to any other object with the same initial set of properties. If no feasible rule chain exists, `undef' is returned.
To watch the rule scheduler at work, e.g. to see announcements about tried preconditions, you may temporarily increase the verbosity levels
$Verbose::rules
and$Verbose::scheduler
.Parameters
String request : name of a property with optional alternatives or a property path in dotted notation. Several requests may be listed.Returns
Core::RuleChain -
list_properties ()
List all known properties.
-
remove (subobj)
Remove the multiple subobject instance(s) from the object.
Parameters
Object subobj : multiple subobject instance. Several subobjects may be removed at once.
-
-
A rule chain to compute properties of an object.
User Methods of Core::RuleChain
User Functions
-
property_viewer ()
UNDOCUMENTED
-
These are functions that perform arithmetic computations.
-
denominator (a) → Integer
-
denominator (f, f) → Polynomial
Returns the denominator of a RationalFunction f.
-
gcd (v) → Element
Compute the greatest common divisor of the elements of the given vector.
-
gcd (p, q) → UniPolynomial
Returns the greatest common divisor of two univariate polynomials.
-
lcm (v) → Element
Compute the least common multiple of the elements of the given vector.
-
numerator (f) → Polynomial
-
sum_of_square_roots_naive (a) → Map<Rational, Rational>
Make a naive attempy to sum the square roots of the entries of the input array.
Parameters
Array<Rational> a list of rational numbers (other coefficents are not implemented).Returns
Map<Rational, Rational> coefficient_of_sqrt a map collecting the coefficients of various roots encountered in the sum. For example, {(3 1/2),(5 7)} represents sqrt{3}/2 + 7 sqrt{5}. If the output is not satisfactory, please use a symbolic algebra package.
-
This category contains combinatorial functions.
-
all_permutations ()
Returns a list of all permutations as a perl-array
-
find_permutation (a, b) → Array<Int>
-
permutation_cycles (p) → Array<List<Int>>
-
permutation_matrix <Scalar> (p) → Matrix<Scalar>
Returns the permuation matrix of the permutation given by p.
-
permutation_sign (p) → Int
-
-
This contains functions for data conversions and type casts.
-
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 -
cols ()
UNDOCUMENTED
-
cols (A) → ARRAY<Vector>
-
concat_rows (A) → Vector
-
convert_to <Target> (s) → Target
Explicit conversion to different scalar type.
Type Parameters
Target Parameters
Scalar s Returns
Target -
convert_to <Target> (v) → Vector<Target>
Explicit conversion to a different element type.
-
convert_to <Target> (m) → Matrix<Target>
Explicit conversion to a different element type.
-
dense <Element> (v) → Vector<Element>
Convert to an equivalent dense vector of the same element type.
-
dense <Element> (m) → Matrix<Element>
Convert to an equivalent dense matrix of the same element type.
-
dense (m) → Matrix<Int>
-
dense (s, dim) → Vector<Int>
-
index_matrix (m) → IncidenceMatrix
Get the positions of non-zero entries of a sparse matrix.
-
indices (v) → Set<Int>
-
repeat_row (v, i)
-
rows ()
UNDOCUMENTED
-
rows (A) → ARRAY<Vector>
-
toMatrix <Scalar> (A)
-
toPolynomial (s, vars)
-
vector2col (v) → Matrix
-
vector2row (v) → Matrix
-
-
Functions for pretty printing, labels or latex output of polymake types.
-
labeled (data, elem_labels) → String
Prepares a vector for printing, prepends each element with a label and a colon.
Parameters
Vector data to be printedArray<String> elem_labels optional labels for elements; if data is a Set, or similar, each element will be replaced by its label.Returns
String -
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)
Write the rows of a matrix M as inequalities (equations=0) or equations (equations=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 writtenOptions
Array<String> coord_labels changes the labels of the coordinatesArray<String> row_labels changes the labels of the rowsBool homogeneous false if the first coordinate should be interpreted as right hand sideBool equations true if the rows represent equations instead of inequalities -
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) → Array<String>
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 elementsReturns
Array<String> each string ending with end-of-line -
rows_numbered (data) → Array<String>
Equivalent to rows_labeled with omitted row_labels argument. Formerly called "numbered".
-
-
Operations on graphs.
-
adjacency_matrix (graph) → IncidenceMatrix
Returns the adjacency matrix of graph nodes. For a normal graph, it will be a kind of IncidenceMatrix, for multigraph, it will be a SparseMatrix<Int>, with entries encoding the number of parallel edges between two nodes.
-
induced_subgraph (graph, set) → Graph
-
node_edge_incidences <Coord> (graph) → SparseMatrix<Coord>
Returns the node-edge incidence matrix of a graph.
Type Parameters
Coord coordinate type for the resulting matrix, default: IntParameters
Graph graph Returns
SparseMatrix<Coord>
-
-
Functions for lattice related computations.
-
eliminate_denominators (v) → Vector<Integer>
Scale a vector with the least common multiple of the denominators of its coordinates.
-
eliminate_denominators_entire (v) → Matrix<Integer>
Scales entire matrix with the least common multiple of the denominators of its coordinates.
-
eliminate_denominators_entire_affine (v) → Matrix<Integer>
Scales entire matrix with the least common multiple of the denominators of its coordinates (ignore first column).
-
eliminate_denominators_in_rows (v) → Matrix<Integer>
Scale a matrix rowwise 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>
Scales each row of the matrix to a primitive integral vector.
-
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.
-
-
These functions are for algebraic computations and constructions of special matrices.
-
anti_diag (d) → SparseMatrix
Produces a SparseMatrix from its anti-diagonal.
-
anti_diag (m1, m2) → SparseMatrix
Returns a block anti-diagonal matrix with blocks m1 and m2.
-
basis (A) → Pair<Set<Int>, Set<Int>>
Computes subsets of the rows and columns of A that form a basis for the linear space spanned by A.
Parameters
Matrix A Returns
Pair<Set<Int>, Set<Int>> The first set corresponds to the rows, the second to the columns. -
basis_affine (A) → Pair<Set<Int>, Set<Int>>
Does the same as basis ignoring the first column of the matrix.
Parameters
Matrix A Returns
Pair<Set<Int>, Set<Int>> The first set corresponds to the rows, the second to the columns. -
basis_cols (A) → Set<Int>
-
basis_rows (A) → Set<Int>
-
diag (d) → SparseMatrix
-
diag (m1, m2) → SparseMatrix
-
equal_bases (M1, M2) → Bool
-
hadamard_product (M1, M2) → Matrix
-
lineality_space (A) → Matrix
-
normalized (A) → Matrix<Float>
Normalize a matrix by dividing each row by its length (l2-norm).
-
null_space (A) → Matrix
-
null_space (b) → Matrix
-
ones_vector <Element> (d) → Vector<Element>
Creates a vector with all elements equal to 1.
Type Parameters
Element default: 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.Returns
Vector<Element> -
pluecker (V) → Vector
Compute the vector of maximal minors of a matrix. WARNING: interpretation different in tropical::lifted_pluecker
-
project_to_orthogonal_complement (points, subspace)
Projects points into the orthogonal complement of a given subspace. The given points will be overwitten.
-
smith_normal_form (M, inv)
-
totally_unimodular (A) → Bool
The matrix A is totally unimodular if the determinant of each square submatrix equals 0, 1, or -1. This is the naive test (exponential in the size of the matrix).
For a better implementation try Matthias Walter's polymake extension at https://github.com/xammy/unimodularity-test/wiki/Polymake-Extension.
-
transpose (A) → IncidenceMatrix
Computes the transpose AT of an incidence matrix A, i.e., (aT)ij = aji.
-
unit_matrix <Element> (d) → SparseMatrix<Element>
Creates a unit matrix of given dimension
Type Parameters
Element default: RationalParameters
Int d dimension of the matrixReturns
SparseMatrix<Element> -
unit_vector <Element> (d, pos) → SparseVector<Element>
Creates a SparseVector of given length d with a one entry at position pos and zeroes elsewhere.
Type Parameters
Element default: RationalParameters
Int d the dimension of the vectorInt pos the position of the 1Returns
SparseVector<Element> -
zero_matrix <Element> (i, j) → SparseMatrix<Element>
Creates a zero matrix of given dimensions
Type Parameters
Element default: RationalParameters
Int i number of rowsInt j number of columnsReturns
SparseMatrix<Element> -
zero_vector <Element> (d) → Vector<Element>
Creates a vector with all elements equal to zero.
Type Parameters
Element default: RationalParameters
Int d vector dimension. If omitted, a vector of dimension 0 is created, which can adjust itself when involved in a block matrix operation.Returns
Vector<Element>
-
-
This category contains functions performing operations on Sets.
-
scalar2set (s) → Set<Scalar>
-
select_subset (s, indices) → Set
-
Miscellaneous functions.
-
histogram (data) → Map<Element, Int>
Produce a histogram of a container: each different element value is mapped on the number of its occurences.
-
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
-
These functions are for visualization.
-
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.
Contained in extensionbundled:javaview
.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.
Contained in extensionbundled:jreality
.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. -
sketch (vis_obj ...)
Produce a Sketch input file with given visual objects.
Parameters
Visual::Object vis_obj ... objects to displayOptions
String File "filename" or "AUTO"For the file name you can use any expression allowed for theopen
function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe. Real file names are automatically completed with the.sk
suffix if needed.An automatically generated file name is displayed in the verbose mode. -
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. -
threejs (vis_obj)
Produce an html file with given visual objects.
Parameters
Visual::Object vis_obj object to displayOptions
String File "filename" or "AUTO"For the file name you can use any expression allowed for theopen
function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe. Real file names are automatically completed with the.html
suffix if needed.An automatically generated file name is displayed in the verbose mode. -
tikz (vis_obj)
Produce a TikZ file with given visual objects.
Parameters
Visual::Object vis_obj object to displayOptions
String File "filename" or "AUTO"For the file name you can use any expression allowed for theopen
function, including "-" for terminal output, "&HANDLE" for an already opened file handle, or "| program" for a pipe. Real file names are automatically completed with the.tikz
suffix if needed.An automatically generated file name is displayed in the verbose mode.
-
Property Types
-
This category contains all "algebraic" types, such as matrices, vectors, polynomials, rings, ...
-
all_rows_or_cols
Use the keyword "All" for all rows or columns, e.g. when constructing a minor.
-
Matrix <Element, Sym>UNDOCUMENTED
Type Parameters
Element default: RationalSym default: NonSymmetric -
Matrix<Matrix::Element, Matrix::Sym>UNDOCUMENTED
User Methods of Matrix<Matrix::Element, Matrix::Sym>
-
anti_diagonal (i) → Vector<Element>
Returns the anti-diagonal of the matrix.
Parameters
Int i i=0: the main anti_diagonal (optional)i>0: the i-th anti_diagonal below the main anti_diagonali<0: the i-th anti_diagonal above the main anti_diagonalReturns
Vector<Element> -
col (i) → Vector<Element>
-
diagonal (i) → Vector<Element>
Returns the diagonal of the matrix.
Parameters
Int i i=0: the main diagonal (optional)i>0: the i-th diagonal below the main diagonali<0: the i-th diagonal above the main diagonalReturns
Vector<Element> -
row (i) → Vector<Element>
-
-
Plucker<Plucker::Scalar>UNDOCUMENTED
User Methods of Plucker<Plucker::Scalar>
-
coordinates ()
UNDOCUMENTED
-
permuted ()
UNDOCUMENTED
-
-
Polynomial <Coefficient, Exponent>
-
Polynomial<Polynomial::Coefficient, Polynomial::Exponent>UNDOCUMENTED
User Methods of Polynomial<Polynomial::Coefficient, Polynomial::Exponent>
-
coefficients_as_vector ()
UNDOCUMENTED
-
get_ring ()
UNDOCUMENTED
-
monomials_as_matrix ()
UNDOCUMENTED
-
print_ordered ()
UNDOCUMENTED
-
trivial ()
UNDOCUMENTED
-
-
RationalFunction <Coefficient, Exponent>
-
SparseMatrix <Element, Sym>derived from: Matrix<Matrix::Element, Matrix::Sym>
A SparseMatrix is a two-dimensional associative array with row and column indices as keys; elements equal to the default value (ElementType(), which is 0 for most numerical types) are not stored, but implicitly encoded by the gaps in the key set. Each row and column is organized as an AVL-tree.
Use dense to convert this into its dense form.
You can create a new SparseMatrix by entering its entries row by row, as a list of SparseVectors e.g.:
$A = new SparseMatrix<Int>(<< '.');(5) (1 1)(5) (4 2)(5)(5) (0 3) (1 -1).Type Parameters
Element Sym -
SparseMatrix<SparseMatrix::Element, SparseMatrix::Sym>UNDOCUMENTED
User Methods of SparseMatrix<SparseMatrix::Element, SparseMatrix::Sym>
-
resize ()
Resize the matrix
-
squeeze ()
Removes empty rows and columns. The remaining rows and columns are renumbered without gaps.
-
squeeze_cols ()
Removes empty columns. The remaining columns are renumbered without gaps.
-
squeeze_rows ()
Removes empty rows. The remaining rows are renumbered without gaps.
-
-
SparseVector <Element>derived from: Vector<Vector::Element>
A SparseVector is an associative container with element indices (coordinates) as keys; elements equal to the default value (ElementType(), which is 0 for most numerical types) are not stored, but implicitly encoded by the gaps in the key set. It is based on an AVL tree.
The printable representation of a SparseVector looks like a sequence (l) (p1 v1) ... (pk vk), where l is the dimension of the vector and each pair (pi vi) denotes an entry with value vi at position pi. All other entries are zero.
Use dense to convert this into its dense form.
You can create a new SparseVector by entering its printable encoding as described above, e.g.:
$v = new SparseVector<Int>(<< '.');(6) (1 1) (2 2).Type Parameters
Element -
UniMonomial <Coefficient, Exponent>
-
UniPolynomial <Coefficient, Exponent>
-
UniPolynomial<UniPolynomial::Coefficient, UniPolynomial::Exponent>UNDOCUMENTED
User Methods of UniPolynomial<UniPolynomial::Coefficient, UniPolynomial::Exponent>
-
deg ()
UNDOCUMENTED
-
low_deg ()
UNDOCUMENTED
-
print_ordered ()
UNDOCUMENTED
-
-
Vector <Element>
A type for vectors with entries of type Element.
You can perform algebraic operations such as addition or scalar multiplication.
You can create a new Vector by entering its elements, e.g.:
$v = new Vector<Int>(1,2,3);or
$v = new Vector<Int>([1,2,3]);Type Parameters
Element -
Vector<Vector::Element>UNDOCUMENTED
User Methods of Vector<Vector::Element>
-
-
These types are needed as return types of arithmetic computations.
-
TropicalNumber <Addition, Scalar>UNDOCUMENTED
Type Parameters
Addition Scalar default: Rational -
TropicalNumber<TropicalNumber::Addition, TropicalNumber::Scalar>UNDOCUMENTED
User Methods of TropicalNumber<TropicalNumber::Addition, TropicalNumber::Scalar>
-
orientation () → The
UNDOCUMENTED
Returns
The orientation of the associated addition, i.e. +1 if the corresponding 0 is +inf -1 if the corresponding 0 is -inf -
zero () → The
UNDOCUMENTED
Returns
The zero element of the tropical semiring of this element.
-
-
These types are auxiliary artifacts helping to build other classes, primarily representing template parameters or enumeration constants. They should not be used alone as property types or function arguments. In the most cases they won't even have user-accessible constructors.
-
ARRAY
A perl array of whatever contents.
-
DirectedMulti
Type tag for a directed multigraph.
-
EdgeIteratorUNDOCUMENTED
-
EdgeListUNDOCUMENTED
-
Iterator <Element>
An iterator over a container object.
Type Parameters
Element -
LocalFloatEpsilonUNDOCUMENTED
-
NodeIteratorUNDOCUMENTED
-
NodeSetUNDOCUMENTED
-
NonSymmetric
Labels an IncidenceMatrix as non-symmetric.
-
SCALAR
A perl scalar of whatever contents.
-
Serialized <X>UNDOCUMENTED
Type Parameters
X -
SparseIterator
Iterator over non-zero elements of a SparseVector or of a row/column of a SparseMatrix.
-
Symmetric
Labels an IncidenceMatrix as symmetric.
-
Undirected
Type tag for an undirected Graph.
-
UndirectedMulti
Type tag for an undirected multigraph.
-
-
This category contains all basic types, in particular those that wrap C++, GMP or perl types such as Int, Integer, Rational, Long, Float, Array, String, ...
-
Bool
Corresponds to the C++ type bool.
-
Int
Corresponds to the C++ type int.
-
List <Element>
Corresponds to the C++ type std::list.
Type Parameters
Element -
Pair <First, Second>
Corresponds to the C++ type std::Pair.
Type Parameters
First Second -
QuadraticExtension <Field>
Realizes quadratic extensions of fields.
You can construct the value a+b\(\sqrt r\) via QuadraticExtension(a, b, r) (where a, b, r are of type Field).
Type Parameters
Field default: Rational -
String
Corresponds to the C++ type std::string.
-
Text
Plain text without any imposed structure.
-
This contains all property types that are related to graphs.
-
EdgeHashMap <Dir, Element>derived from: GraphMap<GraphMap::Dir, GraphMap::Element>
Sparse mapping of edges to data items.
Type Parameters
Dir Element data associated with edges -
EdgeMap <Dir, Element>derived from: GraphMap<GraphMap::Dir, GraphMap::Element>
Dense mapping of edges to data items.
Type Parameters
Dir Element data associated with edges -
Graph <Dir>UNDOCUMENTED
Type Parameters
Dir -
Graph<Graph::Dir>UNDOCUMENTED
User Methods of Graph<Graph::Dir>
-
adjacent_nodes (node) → Set
-
contract_edge (node1, node2)
-
delete_all_edges (tail_node, head_node)
-
delete_edge (tail_node, head_node)
-
delete_edge (iterator)
-
delete_node (node)
Deletes all edges incident to the given node and marks it as invalid. The numeration of other nodes stays unchanged.
Parameters
Int node -
edge_exists (tail_node, head_node) → Bool
-
invalid_node (node) → Bool
-
in_adjacent_nodes (node) → Set
-
node_exists (node) → Bool
-
node_out_of_range (node) → Bool
-
out_adjacent_nodes (node) → Set
-
out_degree (node) → Int
-
squeeze ()
Renumbers the valid nodes as to eliminate all gaps left after deleting.
-
squeeze_isolated ()
Deletes all nodes of degree 0, then renumbers the remaining nodes without gaps.
-
NodeHashMap <Dir, Element>derived from: GraphMap<GraphMap::Dir, GraphMap::Element>
Sparse mapping of nodes to data items.
Type Parameters
Dir Element data associated with nodes -
NodeMap <Dir, Element>derived from: GraphMap<GraphMap::Dir, GraphMap::Element>
Dense mapping of nodes to data items.
Type Parameters
Dir Element data associated with nodes
-
-
These types are needed as return types of algebraic computations.
-
SmithNormalForm
Complete result of the Smith normal form computation. Contains the following fields:
SparseMatrix<Scalar> form: the Smith normal form S of the given matrix MList<Pair<Scalar, Int>> torsion: absolute values of the entries greater than 1 of the diagonal together with their multiplicityInt rank: rank of MSparseMatrix<Scalar> left_companion, right_companion: unimodular matrices L and R such thatM = LSR in normal case, or S = LMR in inverted case (as specified in the call to smith_normal_form function).
-
-
In this category you find all property types related to sets, such as Set, Map, HashMap, IncidenceMatrix, ...
-
FacetList
A FacetList is a collection of sets of integral numbers from a closed contiguous range [0..n-1]. The contained sets usually encode facets and the set elements vertices of a simplicial complex.
User Methods of FacetList
-
HashMap <Key, Value>
Similar to Map. HashMaps are associative containers that contain unique key/value pairs.
The values are stored in a hash table. Accessing and interserting a value by its key works in constant time O(1).
You can create a new HashMap mapping Ints to Strings by
$myhashmap = new HashMap<Int, String>([1, "Monday"], [2, "Tuesday"]);On the perl side HashMaps are treated like hashrefs. You can work with a HashMap like you work with a Map (keeping in mind differences in performance and memory demand).
Type Parameters
Key type of the key valuesValue type of the mapped value -
IncidenceMatrix <Sym>
A 0/1 incidence matrix.
Type Parameters
Sym -
IncidenceMatrix<IncidenceMatrix::Sym>UNDOCUMENTED
User Methods of IncidenceMatrix<IncidenceMatrix::Sym>
-
col (i) → SparseVector<Int>
-
minor (r, c) → IncidenceMatrix
Returns a minor of the matrix containing the rows in r and the columns in c. You can pass All if you want all rows or columns and ~ for the complement of a set. E.g.
$A->minor(All, ~[0]);will give you the minor of a matrix containing all rows and all but the 0-th column.
-
row (i) → SparseVector<Int>
-
squeeze ()
Removes empty rows and columns. The remaining rows and columns are renumbered without gaps.
-
squeeze_cols ()
Removes empty columns. The remaining columns are renumbered without gaps.
-
squeeze_rows ()
Removes empty rows. The remaining rows are renumbered without gaps.
-
-
Map <Key, Value>
Maps are sorted associative containers that contain unique key/value pairs. Maps are sorted by their keys.
Accessing or inserting a value needs logarithmic time O(log n), where n is the size of the map.
You can create a new Map mapping Ints to Strings by
$mymap = new Map<Int, String>([1, "Monday"], [2, "Tuesday"]);On the perl side Maps are treated like hashrefs. You can add a new key/value pair by
$mymap->{3} = "Wednesday";(If the key is already contained in the Map, the corresponding value is replaced by the new one.) or ask for the value of a key by
print $mymap->{1};Type Parameters
Key type of the key valuesValue type of the mapped value -
PowerSet <Element>derived from: Set<Set::Element>
A Set whose elements are of type Set<Element>.
Type Parameters
Element default: Int
-
These property_types are for 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
-
These options are for 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 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 PointStyleVector<Float> ViewPoint ViewPoint for Sketch visualizationVector<Float> ViewDirection ViewDirection for Sketch visualizationVector<Float> ViewUp ViewUp for Sketch visualizationFloat Scale scale 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
-