C++ Library Extensions 2022.12.09
To help learn modern C++ programming
tpf_ncrnpr.hpp File Reference
#include <tpf_euclidean.hpp>
#include <iostream>
#include <sstream>
#include <list>
#include <functional>
#include <iterator>
#include <future>
#include <vector>
#include <algorithm>
#include <tpf_safe_type.hpp>
Include dependency graph for tpf_ncrnpr.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tpf::ncrnpr::range_t
 
class  tpf::ncrnpr::simple_positive_rational< NumberType, typename >
 
class  tpf::ncrnpr::combination
 
class  tpf::ncrnpr::permutation
 

Namespaces

namespace  tpf
 Includes subnamespace conversion.
 
namespace  tpf::ncrnpr
 Implements nCr, nPr.
 

Macros

#define NOMINMAX
 

Typedefs

using tpf::ncrnpr::range_vector_t = std::vector< range_t >
 

Functions

template<template< typename, typename... > class ContainerType, typename EleType , typename... Types>
int tpf::ncrnpr::sgn (const ContainerType< EleType, Types... > &cntr)
 Computes the inversion of a permutation. More...
 
template<typename SpanType , typename StartType , typename EndType >
range_vector_t tpf::ncrnpr::split_range_span (SpanType min_span, StartType st, EndType ed)
 Split range. More...
 
template<typename CountType , typename StartType , typename EndType >
range_vector_t tpf::ncrnpr::split_range_count (CountType count, StartType st, EndType ed)
 
template<typename Type1 , typename Type2 , typename ReturnType = unsigned long long>
enable_if_all_in_list_t< types::type_list_t< Type1, Type2 >, integral_list_t, ReturnType > tpf::ncrnpr::ncr (Type1 nn, Type2 rr)
 
template<typename Type1 , typename Type2 , typename ReturnType = unsigned long long>
enable_if_all_in_list_t< types::type_list_t< Type1, Type2 >, integral_list_t, ReturnType > tpf::ncrnpr::npr (Type1 nn, Type2 rr)
 
template<typename Type , typename ReturnType = unsigned long long>
enable_if_in_list_t< Type, integral_list_t, ReturnType > tpf::ncrnpr::fact (Type n)
 
template<template< typename, typename... > class SetContainer = std::vector, typename... ContainerTails, typename MthType = combination::m_th_t, typename EleType = int, typename SelectCountType = size_t, typename ReturnType = std::vector<EleType>>
ReturnType tpf::ncrnpr::enumerate_combination (combination cmb, MthType m_th, SetContainer< EleType, ContainerTails... > from_set, SelectCountType select_count)
 
template<template< typename, typename... > class ReturnContainer = std::vector, template< typename, typename... > class SetContainer = std::list, typename... ContainerTails, typename MthType = combination::m_th_t, typename EleType = int, typename SelectCountType = size_t, typename SetTagType = tpf::set_tag<ReturnContainer, EleType>, typename ReturnType = tpf::duet_set_t<SetTagType>>
ReturnType tpf::ncrnpr::enumerate_combination_and_complement (combination cmb, MthType m_th, SetContainer< EleType, ContainerTails... > from_set, SelectCountType select_count)
 
template<template< typename, typename... > class ReturnContainer = std::vector, typename MthType = combination::m_th_t, typename SetSizeType = size_t, typename SelectCountType = size_t, typename SetTagType = tpf::set_tag<ReturnContainer, int>, typename ReturnType = tpf::duet_set_t<SetTagType>>
auto tpf::ncrnpr::enumerate_combination_and_complement (MthType m_th, SetSizeType set_size, SelectCountType select_count)
 
template<template< typename, typename... > class ReturnContainer = std::vector, template< typename, typename... > class SetContainer = std::list, typename... ContainerTails, typename MthType = combination::m_th_t, typename EleType = int, typename SelectCountType = size_t, typename SetTagType = tpf::set_tag<ReturnContainer, EleType>, typename ReturnType = tpf::set_of_duets_t<SetTagType>>
auto tpf::ncrnpr::enumerate_combinations_and_offsets (SetContainer< EleType, ContainerTails... > from_set, SelectCountType select_count=tpf::InvalidIndex)
 
template<template< typename, typename... > class ReturnContainer = std::vector, typename MthType = combination::m_th_t, typename SelectCountType = size_t, typename SetTagType = tpf::set_tag<ReturnContainer, int>, typename ReturnType = tpf::duet_set_t<SetTagType>>
ReturnType tpf::ncrnpr::enumerate_combinations_and_offsets_indices (combination cmb, MthType m_th, std::vector< int > from_set, SelectCountType select_count)
 
template<template< typename, typename... > class ReturnContainer = std::vector, typename SetSizeType = size_t, typename SelectCountType = size_t, typename SetTagType = tpf::set_tag<ReturnContainer, int>, typename ReturnType = tpf::set_of_duets_t<SetTagType>>
auto tpf::ncrnpr::enumerate_combinations_and_offsets_indices (SetSizeType set_size, SelectCountType select_count=tpf::InvalidIndex)
 
template<template< typename, typename... > class ReturnContainer = std::vector, typename SetSizeType = size_t, typename SelectCountType = size_t, typename SetTagType = tpf::set_tag<ReturnContainer, int>, typename ReturnType = tpf::set_of_duets_t<SetTagType>>
auto tpf::ncrnpr::enumerate_combination_including_indices (std::vector< int > include_set, SetSizeType set_size, SelectCountType select_count=tpf::InvalidIndex)
 
template<template< typename, typename... > class ReturnContainer = std::vector, typename SetSizeType = size_t, typename SelectCountType = size_t, typename SetTagType = tpf::set_tag<ReturnContainer, int>, typename ReturnType = tpf::set_of_duets_t<SetTagType>>
auto tpf::ncrnpr::enumerate_combination_excluding_indices (std::vector< int > exclude_set, SetSizeType set_size, SelectCountType select_count=tpf::InvalidIndex)
 
template<typename RType , typename MType >
std::vector< int > tpf::ncrnpr::enumerate_permutation (std::vector< int > e, RType r, MType m_th)
 
template<typename T >
std::vector< T > tpf::ncrnpr::enum_permutation (T n, T r, T m_th)
 
template<typename T >
std::vector< T > tpf::ncrnpr::enum_permutation_remainder (T n, T r, T m_th)
 
template<typename PType , typename NRType , typename MType >
std::vector< NRType > tpf::ncrnpr::enum_permutation_static (PType permu, NRType n, NRType r, MType m_th)
 
template<typename T >
std::vector< T > tpf::ncrnpr::enum_permutation_list (T n, T r, T mth)
 
template<template< typename, typename... > class ReturnContainer = std::vector, template< typename, typename... > class SetContainer = std::list, typename... ContainerTails, typename MthType = unsigned long long, typename EleType = int, typename CountType = int>
ReturnContainer< EleType > tpf::ncrnpr::enumerate_permutation (MthType m_th, SetContainer< EleType, ContainerTails... > from_set, CountType r)
 
template<typename CallbackType , typename... ArgTypes>
void tpf::visit (const ncrnpr::range_t &range, CallbackType &&callback, ArgTypes &&... args)
 Calls callback(args...) function in sequence. Iteration index is not passed to the callback() function. More...
 
template<typename CallbackType , typename... ArgTypes>
void tpf::visit_parallel (unsigned int thread_count, const ncrnpr::range_t &range, CallbackType &&callback, ArgTypes &&... args)
 Calls callback(args...) function in parallel. Iteration index is not passed to the callback() function. More...
 
template<typename CallbackType , typename... ArgTypes>
void tpf::visit_index (const ncrnpr::range_t &range, CallbackType &&callback, ArgTypes &&... args)
 Calls callback(index, args...) in sequence. Iteration index is passed to the callback() function. More...
 
template<typename CallbackType , typename... ArgTypes>
void tpf::visit_index_parallel (unsigned int thread_count, const ncrnpr::range_t &range, CallbackType &&callback, ArgTypes &&... args)
 calls callback(index, args...) in parallel. Iteration index is passed to the callback() as the first argument More...
 
template<typename NRType , typename CallbackType , typename... ArgTypes>
void tpf::visit_permutations (NRType n, NRType r, const ncrnpr::range_t &range, CallbackType &&callback, ArgTypes &&... args)
 Calls callback(enumerated_permutation, args...) in sequence. More...
 
template<typename TCType , typename NRType , typename CallbackType , typename... ArgTypes>
void tpf::visit_permutations_parallel (TCType thread_count, NRType n, NRType r, CallbackType &&callback, ArgTypes &&... args)
 Calls callback(enumerated_permutation, args...) in parallel. More...
 
template<typename CallbackType , typename... ArgTypes>
void tpf::parallel_visit_permutations (const std::pair< size_t, size_t > permutation_specification, CallbackType &&callback, ArgTypes &&... args)
 
template<typename CallbackType , typename... ArgTypes>
void tpf::visit_combinations_and_offsets (const std::pair< size_t, size_t > &combination_specification, const ncrnpr::range_t &range, CallbackType &&callback, ArgTypes &&... args)
 Calls callback(enumerated_combination, args...) in sequence enumerated_combination is generated and pass to the callback() as the first argument. More...
 
template<typename NRType , typename CallbackType , typename... ArgTypes>
void tpf::visit_combinations (NRType n, NRType r, const ncrnpr::range_t &range, CallbackType &&callback, ArgTypes &&... args)
 
template<typename NRType , typename CallbackType , typename... ArgTypes>
void tpf::parallel_visit_combinations_and_complements (NRType n, NRType r, CallbackType &&callback, ArgTypes &&... args)
 
template<typename NRType , typename CallbackType , typename... ArgTypes>
void tpf::parallel_visit_combinations (NRType n, NRType r, CallbackType &&callback, ArgTypes &&... args)
 
template<typename ThreadCountType , typename CallbackType , typename... ArgTypes>
void tpf::visit_combinations_and_offsets_parallel (ThreadCountType thread_count, const std::pair< size_t, size_t > &combination_specification, CallbackType &&callback, ArgTypes &&... args)
 Calls callback(enumerated_combination, args...) in parallel. More...
 

Detailed Description

Author
your name (you@d.nosp@m.omai.nosp@m.n.com)
Version
0.1
Date
2019-04-18

Definition in file tpf_ncrnpr.hpp.

Macro Definition Documentation

◆ NOMINMAX

#define NOMINMAX

Definition at line 15 of file tpf_ncrnpr.hpp.