HyperHDG
Public Member Functions | Private Attributes | List of all members
TPCC::Combination< n, k, T > Class Template Reference

Dataset for a combination k out of n. More...

#include <combinations.h>

Public Member Functions

 Combination (const std::array< T, k > &combi, const std::array< T, n - k > &comp)
 
in (unsigned int i) const
 The ith element which is part of the combination in descending order. More...
 
out (unsigned int i) const
 The ith element which is not part of the combination in descending order. More...
 
Combination< n, n - k, T > complement () const
 Return the complement of this combination. More...
 
template<int kk = k>
constexpr std::enable_if<(kk > 0), Combination< n, k - 1, T > >::type eliminate (unsigned int i) const
 The combination obtained by eliminating the ith element. More...
 
template<int kk = k>
constexpr std::enable_if<(kk< n), Combination< n, k+1, T > >::type add (unsigned int i) const
 The combination obtained by adding the element i. More...
 
template<int kk = k>
constexpr std::enable_if<(kk<=n), Combination< n+1, k+1, T > >::type add_and_expand (unsigned int i) const
 The combination out of n+1 obtained by adding one element. More...
 
void print_debug (std::ostream &os) const
 Print the content of this object for debugging. More...
 

Private Attributes

std::array< T, k > data
 The array of members. More...
 
std::array< T, n - k > cdata
 The array of non-members. More...
 

Detailed Description

template<int n, int k, typename T = unsigned int>
class TPCC::Combination< n, k, T >

Dataset for a combination k out of n.

Constructor & Destructor Documentation

◆ Combination()

template<int n, int k, typename T = unsigned int>
TPCC::Combination< n, k, T >::Combination ( const std::array< T, k > &  combi,
const std::array< T, n - k > &  comp 
)
inline

Member Function Documentation

◆ add()

template<int n, int k, typename T = unsigned int>
template<int kk = k>
constexpr std::enable_if<(kk < n), Combination<n, k + 1, T> >::type TPCC::Combination< n, k, T >::add ( unsigned int  i) const
inlineconstexpr

The combination obtained by adding the element i.

Note
The return value type declaration with std::enable_if eliminates this function for k==n, since you cannot choose more than n items out of n.

◆ add_and_expand()

template<int n, int k, typename T = unsigned int>
template<int kk = k>
constexpr std::enable_if<(kk <= n), Combination<n + 1, k + 1, T> >::type TPCC::Combination< n, k, T >::add_and_expand ( unsigned int  i) const
inlineconstexpr

The combination out of n+1 obtained by adding one element.

◆ complement()

template<int n, int k, typename T = unsigned int>
Combination<n, n - k, T> TPCC::Combination< n, k, T >::complement ( ) const
inline

Return the complement of this combination.

◆ eliminate()

template<int n, int k, typename T = unsigned int>
template<int kk = k>
constexpr std::enable_if<(kk > 0), Combination<n, k - 1, T> >::type TPCC::Combination< n, k, T >::eliminate ( unsigned int  i) const
inlineconstexpr

The combination obtained by eliminating the ith element.

Note
The return value type declaration with std::enable_if eliminates this function for k==0, since you cannot remove an item from an empty set.

◆ in()

template<int n, int k, typename T = unsigned int>
T TPCC::Combination< n, k, T >::in ( unsigned int  i) const
inline

The ith element which is part of the combination in descending order.

◆ out()

template<int n, int k, typename T = unsigned int>
T TPCC::Combination< n, k, T >::out ( unsigned int  i) const
inline

The ith element which is not part of the combination in descending order.

◆ print_debug()

template<int n, int k, typename T = unsigned int>
void TPCC::Combination< n, k, T >::print_debug ( std::ostream &  os) const
inline

Print the content of this object for debugging.

Member Data Documentation

◆ cdata

template<int n, int k, typename T = unsigned int>
std::array<T, n - k> TPCC::Combination< n, k, T >::cdata
private

The array of non-members.

◆ data

template<int n, int k, typename T = unsigned int>
std::array<T, k> TPCC::Combination< n, k, T >::data
private

The array of members.


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