Polymake Template Library (PTL) 4.13
polymake Namespace Reference

namespace to be used for client code More...

Classes

class  AccurateFloat
 minimalistic wrapper for MPFR numbers More...
 
struct  AnyString
 
class  Array
 Container class with constant time random access. More...
 
class  Bitset
 Container class for dense sets of integers. More...
 
class  conv
 Explicit type converter. More...
 
struct  Div
 result of integer division of two numbers (a,b) More...
 
class  EdgeMap
 data structure to store data at the edges of a Graph More...
 
class  EquivalenceRelation
 An equivalence relation on the integers 0,..,n-1 for a given size n. More...
 
struct  ExtGCD
 result of the extended gcd calculation for two numbers (a, b) More...
 
class  FaceMap
 
class  FacetList
 
class  GenericGraph
 Generic type for all graph classes. More...
 
class  GenericMatrix
 Generic type for matrices More...
 
class  GenericSet
 Generic type for ordered sets More...
 
class  GenericVector
 Generic type for vectors More...
 
class  Graph
 Directed or undirected finite graphs. More...
 
class  Heap
 
class  HSV
 Color description in HSV space. More...
 
class  IncidenceMatrix
 0/1 incidence matrix. More...
 
class  Integer
 Integral number of unlimited precision. More...
 
class  ios
 STL class. More...
 
struct  is_derived_from_instance_of
 
struct  is_instance_of
 Check whether a type is an instance of a given class template. More...
 
struct  is_lossless_convertible_impl2
 
class  ListMatrix
 List of row vectors. More...
 
class  Map
 Associative array based on AVL::tree. More...
 
class  Matrix
 Matrix type class which holds the elements in a contiguous array
Additional arithmetic operations for matrices and useful constructions (unit_matrix, diag, ...) are listed at operations. More...
 
struct  mbind1st
 Reduce a binary meta-function to a unary one by fixing the first argument to a given value. More...
 
struct  mbind2nd
 Reduce a binary meta-function to a unary one by fixing the second argument to a given value. More...
 
struct  mbind_const
 Wrappers for arbitrary meta-functions. More...
 
struct  meta_function
 
struct  mget_template_parameter
 
struct  mlist
 container for arbitrary many types More...
 
struct  mlist_and_nonempty
 like mlist_and, but delivers false_type on empty input More...
 
struct  mlist_at
 
struct  mlist_difference
 
struct  mlist_even_subset
 Extract elements at even positions. More...
 
struct  mlist_filter_binary
 
struct  mlist_filter_unary
 
struct  mlist_find_first
 
struct  mlist_find_if
 
struct  mlist_fold
 
struct  mlist_fold_transform
 
struct  mlist_head
 
struct  mlist_insert
 
struct  mlist_insert_unique
 
struct  mlist_intersection
 
struct  mlist_is_tail_of
 Check whether one list coincides with the tail of another list. More...
 
struct  mlist_length
 compute the length of a meta-list More...
 
struct  mlist_match_all
 
struct  mlist_match_impl
 
struct  mlist_odd_subset
 Extract elements at odd positions. More...
 
struct  mlist_prepend_if
 
struct  mlist_replace_at
 
struct  mlist_reverse
 Reverse the elements in a meta-list. More...
 
struct  mlist_slice
 
struct  mlist_sort
 Sort a meta-list according to the given element comparator. More...
 
struct  mlist_tail
 
struct  mlist_transform_binary
 Apply a binary meta-function pairwise to the elements of two meta-lists. More...
 
struct  mlist_transform_unary
 Apply a unary meta-function to the elements of a meta-list. More...
 
struct  mlist_unwrap
 extract the single element from a meta-list, preserve the list if it contains more than one element More...
 
struct  mlist_wrap
 construct a meta-list with given elements unless it's already a meta-list itself More...
 
struct  mnegate_binary
 Negate the result of a binary boolean meta-function. More...
 
struct  mnegate_unary
 Negate the result of a unary boolean meta-function. More...
 
struct  mprefer1st
 Operation on a pair of types: selects the first one unless it is void. More...
 
struct  mprefer2nd
 Operation on a pair of types: selects the second one unless it is void. More...
 
struct  mproject1st
 Operation on a pair of types: selects the first one. More...
 
struct  mproject2nd
 Operation on a pair of types: selects the second one. More...
 
struct  mrepeat
 
struct  mreplace_template_parameter
 
struct  mreplicate
 Construct a meta-list consisting of N copies of the same element. More...
 
struct  msafely_eval
 
struct  msafely_eval_boolean
 
struct  mselect
 
struct  mswap_args
 Swap arguments passed to a binary meta-function. More...
 
struct  mtagged_list_add_default
 Append elements to a tagged meta-list unless another elements with identical tags are already there. More...
 
struct  mtagged_list_concat
 
struct  mtagged_list_extract
 
struct  mtagged_list_modify
 
struct  mtagged_list_remove
 
struct  mtagged_list_replace
 
struct  munwrap_index_sequence
 Convert a meta-list of encapsulated integer constants into an index sequence. More...
 
class  no_match
 
class  NodeMap
 data structure to store data at the nodes of a Graph More...
 
class  NormalRandom
 
struct  nothing
 Structure denoting the absence of data. More...
 
class  QuadraticExtension
 Realizes quadratic extensions of fields. More...
 
class  Rational
 Rational number with unlimited precision. More...
 
struct  reverse_index_sequence
 Construct a falling index sequence N-1, N-2, ..., 1, 0. More...
 
class  RGB
 Color description in RGB space: Red-Green-Blue additive color model. More...
 
class  Set
 An associative container based on a balanced binary search (AVL) tree. Comparator is a functor defining a total ordering on the element value domain. In most cases, the default choice (lexicographical order) will suffice for your needs. More...
 
class  SmithNormalForm
 Complete result of computation of Smith normal form. More...
 
class  SparseMatrix
 A two-dimensional associative array with row and column indices as keys. More...
 
class  SparseVector
 
class  TropicalNumber
 
class  Vector
 Vector type class which holds the elements in a contiguous array More...
 

Typedefs

template<typename T>
using mvalue_of = std::integral_constant<typename T::value_type, T::value>
 Canonicalized compile-time constant.
 
template<typename Const1, typename Const2>
using mis_equal = bool_constant<(Const1::value == Const2::value)>
 Operations on compile-time constants.
 
template<typename T, int Pos>
using mlist_at_rev = mlist_at<T, mlist_length<T>::value-Pos-1>
 counting position backwards
 
template<typename List, int Start, int End, typename... Insert>
using mlist_replace_between
 
template<typename List, int Pos>
using mlist_remove_at = mlist_replace_at<List, Pos>
 
template<typename List, typename Value>
using mlist_find = mlist_find_if<List, std::is_same, Value>
 Find the first occurrence of an element in a meta-list.
 
template<typename List, typename Value, template< typename, typename > class Compare = std::is_same>
using mlist_contains = bool_constant<mlist_find_if<List, Compare, Value>::value>
 Tell whether an element is contained in a meta-list.
 
template<typename List, typename Element, typename NewElement, template< typename, typename > class Compare = std::is_same>
using mlist_replace = mlist_replace_at<List, mlist_find_if<List, Compare, Element>::pos, NewElement>
 
template<typename List, typename Element, template< typename, typename > class Compare = std::is_same>
using mlist_remove = mlist_remove_at<List, mlist_find_if<List, Compare, Element>::pos>
 
template<typename T, typename... Expected>
using is_among = mlist_contains<typename mlist_wrap<Expected...>::type, T>
 
template<typename List1, typename List2, template< typename, typename > class Compare = std::is_same>
using mlists_are_equivalent
 Shortcut wrappers around mlist_match.
 
template<typename List1, typename List2, template< typename, typename > class Compare = std::is_same>
using mlists_are_intersecting = bool_not<mlist_is_empty<typename mlist_match<List1, List2, Compare>::type>>
 Tell whether meta-lists have any elements in common.
 
template<typename List1, typename List2, template< typename, typename > class Compare = std::is_same>
using mlists_are_disjoint = mlist_is_empty<typename mlist_match<List1, List2, Compare>::type>
 Tell whether meta-lists do not have any elements in common.
 
template<typename List1, typename List2, template< typename, typename > class Compare = std::is_same>
using mlist_is_included = mlist_is_empty<typename mlist_match<List1, List2, Compare>::complement>
 Tell whether one meta-list is completely contained in another one regardless the element order.
 
template<typename... T>
using mlist_and = bool_not<mlist_find_first<typename mlist_concat<T...>::type, bool_not>>
 Compute the boolean conjunction (AND) of one or more constants.
 
template<typename... T>
using mlist_or = mlist_find_first<typename mlist_concat<T...>::type, mvalue_of>
 Compute the boolean disjunction (OR) of one or more constants.
 
template<typename List, typename Depth = int_constant<-1>>
using mlist_flatten = mlist_flatten_impl<typename mlist_wrap<List>::type, Depth::value>
 
template<typename List, template< typename, typename > class Compare = std::is_same>
using mlist_remove_duplicates = mlist_wrap<typename mlist_fold<List, mlist_remove_duplicates_impl<Compare>::template func>::type>
 Remove duplicate elements from a meta-list.
 
template<typename List1, typename List2>
using mlist_union = mlist_fold<List1, mlist_remove_duplicates_impl<std::is_same>::template func, List2>
 
template<typename List1, typename List2>
using mlist_symdifference
 
template<typename List, typename Tags>
using mtagged_list_intersect = mlist_match_all<List, Tags, has_same_tag>
 
template<typename Derived, typename Base>
using is_derived_from = std::is_base_of<Base, Derived>
 convenience shortcut
 
template<typename Derived, typename... Bases>
using is_derived_from_any = mlist_find_if<typename mlist_wrap<Bases...>::type, std::is_base_of, Derived>
 
template<typename... T>
using least_derived_class = mlist_fold<typename mlist_wrap<T...>::type, least_derived_helper>
 
template<typename... T>
using most_derived_class = mlist_fold<typename mlist_wrap<T...>::type, most_derived_helper>
 
template<typename Target, typename Source>
using is_direct_constructible = std::is_constructible<Target, Source>
 alias wrapping variadic std::is_constructible into a binary meta-function
 
template<typename Source, typename... Targets>
using can_construct_any = mlist_find_if<typename mlist_wrap<Targets...>::type, is_direct_constructible, Source>
 
template<typename Source, typename Target>
using can_assign_to = std::is_assignable<std::add_lvalue_reference_t<Target>, Source>
 convenience shortcut swapping the order of arguments
 
template<typename T>
using is_comparable = are_comparable<T, T>
 Check whether the "equal" and "not equal" operators are defined for a given type.
 
template<typename T>
using is_less_greater_comparable = are_less_greater_comparable<T, T>
 Check whether the "less than" and "greater than" operators are defined for a given type.
 

Functions

template<typename T>
private_mutable_t< T > ensure_private_mutable (T &&x)
 enforce a local copy of an object unless it's already a prvalue
 
template<typename Source, typename Member, typename Owner>
auto reverse_cast (Source *data_member, Member Owner::*member_ptr)
 Calculate a pointer to an enclosing class object from a given pointer to a data member.
 
template<typename Member, typename Source, typename Owner, size_t size>
auto reverse_cast (Source *data_member, Int i, Member(Owner::*member_ptr)[size])
 Calculate a pointer to an enclosing class object from a given pointer to an element in a data member array.
 
std::string legible_typename (const std::type_info &ti)
 
template<typename T>
std::string legible_typename ()
 convenience wrapper
 
template<typename E>
auto same_element_matrix (E &&x, Int m, Int n)
 
template<typename TargetType, typename TMatrix>
const TMatrix & convert_to (const GenericMatrix< TMatrix, TargetType > &m)
 explicit conversion of matrix elements to another type
 
template<typename E>
auto zero_matrix (Int m, Int n)
 
template<typename E>
auto ones_matrix (Int m, Int n)
 
template<typename E>
auto unit_matrix (Int dim)
 Create a unit_matrix of dimension dim.
 
template<typename Matrix1, typename Matrix2>
auto diag (const GenericIncidenceMatrix< Matrix1 > &m1, const GenericIncidenceMatrix< Matrix2 > &m2) -> decltype(make_block_diag< false >(m1.top(), m2.top()))
 create a block-diagonal incidence matrix
 
template<typename Comparator, typename E>
auto scalar2set (E &&x)
 construct an one-element set with explicitly specified comparator type
 
template<typename E>
auto same_element_vector (E &&x, Int dim=0)
 Create a vector with all entries equal to the given element x.
 
template<typename TargetType, typename TMatrix>
const TMatrix & convert_to (const GenericMatrix< TMatrix, TargetType > &m)
 explicit conversion of matrix elements to another type
 
template<typename E>
auto ones_vector (Int dim=0)
 Create a vector with all entries equal to 1.
 
template<typename E>
auto zero_vector (Int dim=0)
 Create a vector with all entries equal to 0.
 
graph::Graph complete_graph (Int n_nodes)
 create complete graph on given number of nodes
 
template<typename TargetType, typename TMatrix>
const TMatrix & convert_to (const GenericMatrix< TMatrix, TargetType > &m)
 explicit conversion of matrix elements to another type
 
template<typename Iterator, typename Predicate>
auto make_unary_predicate_selector (Iterator &&it, const Predicate &pred)
 Convenience function creating an iterator with element selection.
 
template<typename VectorIterator, typename RowBasisOutputIterator, typename ColBasisOutputIterator, typename AH_matrix>
void null_space (VectorIterator v, RowBasisOutputIterator row_basis_consumer, ColBasisOutputIterator col_basis_consumer, AH_matrix &H, bool simplify=false)
 
template<typename Iterator>
void normalize (Iterator dst)
 Divide each vector in a sequence thru its length (L2-norm)
 
template<typename TargetType, typename TMatrix>
const TMatrix & convert_to (const GenericMatrix< TMatrix, TargetType > &m)
 explicit conversion of matrix elements to another type
 
template<typename Top, typename ElementSet, typename = std::enable_if_t<is_generic_set<ElementSet>::value>>
PowerSet< typename ElementSet::element_type, typename ElementSet::element_comparator > ridges (const GenericSet< Top, ElementSet > &power_set)
 Gather all independent intersections of subsets from the given PowerSet.
 
template<typename E>
Int smith_normal_form_only (SparseMatrix< E > &M, std::list< std::pair< E, Int > > &torsion)
 

Detailed Description

namespace to be used for client code

Typedef Documentation

◆ can_construct_any

template<typename Source, typename... Targets>
using polymake::can_construct_any = mlist_find_if<typename mlist_wrap<Targets...>::type, is_direct_constructible, Source>

Tell whether the given type can be used as a constructor argument for any of the given targets.

Returns
match first target type from the list or void

◆ is_among

template<typename T, typename... Expected>
using polymake::is_among = mlist_contains<typename mlist_wrap<Expected...>::type, T>

Tell whether the first type occurs among the rest. Convenience wrapper for SFINAE-overloaded functions.

◆ is_derived_from_any

template<typename Derived, typename... Bases>
using polymake::is_derived_from_any = mlist_find_if<typename mlist_wrap<Bases...>::type, std::is_base_of, Derived>

Tell whether the given type is derived from any of the given base types

Returns
match first base type from the list or void

◆ least_derived_class

template<typename... T>
using polymake::least_derived_class = mlist_fold<typename mlist_wrap<T...>::type, least_derived_helper>

Find a class among all given types all others are derived from. If there is none, the result is void. This differs from std::common_type in two aspects:

  • default class constructors may be protected or even deleted; clang can only report common types for classes with public default constructors
  • this function does not report the common base class if that does not occur among the arguments

◆ mlist_flatten

template<typename List, typename Depth = int_constant<-1>>
using polymake::mlist_flatten = mlist_flatten_impl<typename mlist_wrap<List>::type, Depth::value>

Create a flattened list from a list of (possibly) nested lists. Empty elements are elided. TDepth::value sets the descending depth limit: 0 means no conversion at all; -1 means unlimited descending

◆ mlist_remove

template<typename List, typename Element, template< typename, typename > class Compare = std::is_same>
using polymake::mlist_remove = mlist_remove_at<List, mlist_find_if<List, Compare, Element>::pos>

Remove an element from a meta-list. If it does not occur in the list, the result equals the input list.

◆ mlist_remove_at

template<typename List, int Pos>
using polymake::mlist_remove_at = mlist_replace_at<List, Pos>

Remove an element from a meta-list at the given position. When Pos==-1, nothing is changed.

◆ mlist_replace

template<typename List, typename Element, typename NewElement, template< typename, typename > class Compare = std::is_same>
using polymake::mlist_replace = mlist_replace_at<List, mlist_find_if<List, Compare, Element>::pos, NewElement>

Replace an element in a meta-list If it does not occur in the list, the result equals the input list.

◆ mlist_replace_between

template<typename List, int Start, int End, typename... Insert>
using polymake::mlist_replace_between
Initial value:
mlist_concat<typename mlist_slice<List, 0, Start>::type,
Insert...,
Definition meta_list.h:211

Replace a slice in a meta-list with new elements. The slice is specified like in mlist_slice. If Start==End, no elements are removed; the new elements are inserted at the given position.

◆ mlist_symdifference

template<typename List1, typename List2>
using polymake::mlist_symdifference
Initial value:
mlist_concat<typename mlist_match<List1, List2>::complement,
typename mlist_match<List1, List2>::complement2>

Compute a symmetric difference of two meta-lists. Lists are supposed to be free from duplicates.

◆ mlist_union

template<typename List1, typename List2>
using polymake::mlist_union = mlist_fold<List1, mlist_remove_duplicates_impl<std::is_same>::template func, List2>

Compute a union of two meta-lists. Lists are supposed to be free from duplicates.

◆ mlists_are_equivalent

template<typename List1, typename List2, template< typename, typename > class Compare = std::is_same>
using polymake::mlists_are_equivalent
Initial value:
bool_constant<(mlist_is_empty<typename mlist_match<List1, List2, Compare>::complement>::value &&
mlist_is_empty<typename mlist_match<List1, List2, Compare>::complement2>::value)>

Shortcut wrappers around mlist_match.

Tell whether meta-lists are equal regardless the element order

◆ most_derived_class

template<typename... T>
using polymake::most_derived_class = mlist_fold<typename mlist_wrap<T...>::type, most_derived_helper>

Find a class derived from all others in the list. If there is none, the result is void.

◆ mtagged_list_intersect

template<typename List, typename Tags>
using polymake::mtagged_list_intersect = mlist_match_all<List, Tags, has_same_tag>

Find all elements with desired tags in a tagged meta-list. The desired tags can be specified with arbitrary contents, e.g. with void.

Function Documentation

◆ legible_typename()

std::string polymake::legible_typename ( const std::type_info & ti)

Produce a type name as a valid C++ source code type id. Namespace prefixes polymake:: are removed for better legibility.

◆ null_space()

template<typename VectorIterator, typename RowBasisOutputIterator, typename ColBasisOutputIterator, typename AH_matrix>
void pm::null_space ( VectorIterator v,
RowBasisOutputIterator row_basis_consumer,
ColBasisOutputIterator col_basis_consumer,
AH_matrix & H,
bool simplify = false )

Compute the basis of the subspaces spanned by a sequence of vectors and orthogonal one. Projects all row vectors in H into the orthogonal complement of the vectors that v iterates over, and keeps a basis of rowspan(H) intersect orthogonal(v_i)

Parameters
vinput iterator over the vectors
row_basis_consumeroutput iterator consuming the indices of basis rows (=vectors)
col_basis_consumeroutput iterator consuming the indices of basis columns (=coordinates)

◆ ones_matrix()

template<typename E>
auto pm::ones_matrix ( Int m,
Int n )

Create a matrix with m rows and n columns whose entries are all equal to 1.

◆ same_element_matrix()

template<typename E>
auto pm::same_element_matrix ( E && x,
Int m,
Int n )

Create a matrix with m rows and n columns whose entries are all equal to the given element x.

◆ smith_normal_form_only()

template<typename E>
Int pm::smith_normal_form_only ( SparseMatrix< E > & M,
std::list< std::pair< E, Int > > & torsion )

Compute the compact respresentation of the Smith normal form, without companion matrices. Input matrix M is corrupted during the computations.

Parameters
[out]torsionlist of diagonal elements of SNF not equal 1 with multiplicities.
Returns
rank of M.

◆ zero_matrix()

template<typename E>
auto pm::zero_matrix ( Int m,
Int n )

Create a matrix with m rows and n columns whose entries are all equal to 0.