Molassembler  1.1.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::Temple::Permutation< Container > Struct Template Reference

Constexpr-compatible container-abstracted permutation. More...

#include <Permutations.h>

Public Types

using T = std::decay_t< decltype(std::declval< Container >().at(0))>
 

Public Member Functions

constexpr Permutation (unsigned N)
 Construct the identity permutation of size N.
 
constexpr Permutation (Container p)
 Construct a permutation from data.
 
constexpr Permutation (const unsigned N, unsigned i)
 Construct the i-th permutation of size N.
 
constexpr bool next ()
 
constexpr bool prev ()
 
constexpr std::size_t index () const
 
constexpr Permutation inverse () const
 
constexpr auto at (const std::size_t i) const -> decltype(auto)
 
constexpr auto operator() (const std::size_t i) const -> decltype(auto)
 
template<typename OtherContainer >
constexpr OtherContainer apply (const OtherContainer &other) const
 
constexpr Permutation compose (const Permutation &other) const
 Compose two permutations. More...
 

Static Public Member Functions

template<typename OtherContainer >
static constexpr Permutation ordering (const OtherContainer &unordered)
 Discover on ordering permutation of an unordered container.
 

Data Fields

Container sigma
 The permutation in 'one-line' representation.
 

Detailed Description

template<typename Container>
struct Scine::Molassembler::Temple::Permutation< Container >

Constexpr-compatible container-abstracted permutation.

Permutations contain only non-negative integers, with each number up less than its length used once. This class can be used only to represent permutations of sequences of a set of items, not of a multiset (with repeated elements).

Template Parameters
Containerimplementing begin/end, at and size methods. If these methods of the container are constexpr, then this class is constexpr.

The permutation itself represented in one-line 'notation'. E.g. a vector containing the indices 0, 3, 2, 1 represents the permutation with p(0) = 0, p(1) = 3, p(2) = 2 and p(3) = 1.

Member Function Documentation

template<typename Container >
constexpr Permutation Scine::Molassembler::Temple::Permutation< Container >::compose ( const Permutation< Container > &  other) const
inline

Compose two permutations.

The resulting permutation of this composition applies other first, then this.


The documentation for this struct was generated from the following file: