This assertion is checked only in the INDEX_CHECKS compilation mode.
Either a reference to a container whose lifetime is not shorter than that of the permutation object,
or a "bare" container type for a temporary object.
See also the detailed discussion.
Either a functor class satisfying the extended requirements
for unary operations, or
an untyped template of such a class wrapped into BuildUnary or BuildUnaryIt
(preferably expressed via the convenience typedef from namespace polymake::operations.
This is a convenience function, which allows to embed a temporary object into an expression without writing down its exact
type. The result is identical to a direct call to the constructor of the corresponding class with the same arguments.
Please note that this and similar convenience functions always create an object parameterized with references
to the input data (containers.) Sometimes, especially in a function return statement, you will need a reference-less variant;
then you have to use the constructor.
This is a convenience function, which allows to embed a temporary object into an expression without writing down its exact
type. The result is identical to a direct call to the constructor of the corresponding class with the same arguments.
Either a functor class satisfying the extended requirements
for binary operations, or
an untyped template of such a class wrapped into BuildBinary or BuildBinaryIt
(preferably expressed via the convenience typedef from namespace polymake::operations.
There is a little collection of enumeration algorithms generating objects of some class in a
systematic manner. They are implemented as pseudo-containers,
so that you can browse through the class exactly the same you would visit all elements of a standard list.
The "source" of all permutations of a fixed length. The elements are permutations of the integer sequence [0..n).
The first permutation is always the increasing sequence 0,1,...,n-1.
You have the choice between three different algorithms.
permutations_heap deploys the Heap's generating algorithm (see Heap, B.R., "Permutations by Interchanges,"
Computer Journal 6 (1963) pp. 293-294), the implementation follows the suggestion of R. Sedgewick.
This algorithm guarantees that each two consecutive permutations differ by interchanging exactly one pair of elements.
This implies that the permutations in the sequence have alternating evenness.
permutations_adjacent is similar to the first variant, but generates the permutations by interchanging the adjacent
elements only. The iterator over the sequence has an additional method next_swap(), returning the index of the
right element of the pair which is going to be swapped by the next increment operator.
permutations_lex generates is based on the standard function
std::next_permutation, generating the permutations in lexicographical
order. This is the slowest of all algorithms.
Prerequisits
#include <permutations.h>
using namespace polymake;
Finds a permutation of indices 0 .. c1.size()-1 which would make c1 equal to c2.
Raises an exception if no such permutation exists (due to different container sizes or an unmatched element).
The first variant uses the default comparison functor operations::cmp, the second one allows to
use a non-standard comparator.
Create a temporary sparse matrix equal to a unary matrix
with columns permuted according to perm. The template parameter Element specifies
the apparent type of the matrix elements; it must be specified explicitly in the convenience function call,
as it can't be deduced from its argument.
template <bool left_to_right=true, typename Element=int>
class MultiDimCounter;
The MultiDimCounter is a bidirectional iterator,
yielding all integral points in a d-dimensional cuboid.
The points are represented by Array<int> objects.
The template parameter left_to_right determines whether coordinate [0] or [d-1] is the least significant (that is, changes
first.) Default is true, where the counter is read from left to right and the element [0] is the least significant.
This is a list of all facets of a d-dimensional cube.
The facets are represented combinatorially as sets of vertex indices, the vertices are enumerated
contiguously (usually from 0 to 2d-1.)
During the iteration the facets do not appear in lexicographical order.
Template parameter Element specifies the type of the vertex indices. For dimensions less than the machine word size
(for example, 32 on an usual PC), it can be safely chosen as int.
CubeFacets implements the forward container interface;
it is a virtual container, producing its elements "on the fly" just when they are needed.
Prerequisits
#include <CubeFacets.h>
using namespace polymake::polytope;
Construction
CubeFacets(int dim, Element start=0);
dim is the cube dimension, start is the index of the first vertex.