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

Container-abstracted permutation. More...

#include <Permutations.h>

Inheritance diagram for Scine::Molassembler::Temple::Permutation:

Public Types

using Sigma = std::vector< unsigned >
 

Public Member Functions

 Permutation (Sigma p)
 
template<typename T , std::enable_if_t< std::is_convertible< T, unsigned >::value, int > * = nullptr>
 Permutation (std::initializer_list< T > vs)
 
 Permutation (const std::size_t N, std::size_t i)
 Construct the i-th permutation of size N.
 
bool next ()
 
bool prev ()
 
unsigned index () const
 
unsigned indexOf (unsigned v) const
 
Permutation inverse () const
 
auto at (const unsigned i) const -> decltype(auto)
 
auto operator() (const unsigned i) const -> decltype(auto)
 
void push ()
 
void clear ()
 
unsigned size () const
 
template<typename OtherContainer >
OtherContainer apply (const OtherContainer &other) const
 
Permutation compose (const Permutation &other) const
 Compose two permutations. More...
 
auto tie () const
 
- Public Member Functions inherited from Scine::Molassembler::Temple::Crtp::LexicographicComparable< Permutation >
constexpr bool operator== (const LexicographicComparable &other) const
 
constexpr bool operator!= (const LexicographicComparable &other) const
 
constexpr bool operator< (const LexicographicComparable &other) const
 
constexpr bool operator<= (const LexicographicComparable &other) const
 
constexpr bool operator> (const LexicographicComparable &other) const
 
constexpr bool operator>= (const LexicographicComparable &other) const
 

Static Public Member Functions

static Permutation identity (unsigned N)
 Construct the identity permutation of size N.
 
template<typename Container >
static std::enable_if_t
<!std::is_same< Container,
Sigma >::value, Permutation
from (const Container &p)
 Construct a permutation from data (unchecked!)
 
template<typename Container >
static std::enable_if_t
< std::is_same< std::decay_t
< Container >, Sigma >::value,
Permutation
from (Container &&p)
 
template<typename OtherContainer >
static Permutation ordering (const OtherContainer &unordered)
 Discover on ordering permutation of an unordered container.
 
- Static Public Member Functions inherited from Scine::Molassembler::Temple::Crtp::LexicographicComparable< Permutation >
static constexpr const
Permutation
derived (const LexicographicComparable &base)
 

Data Fields

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

Detailed Description

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

Permutation Scine::Molassembler::Temple::Permutation::compose ( const Permutation other) const
inline

Compose two permutations.

The resulting permutation of this composition applies this first, then other. Note that composition is not commutative!


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