ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
FastGeneration.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*------------------------- File FastGeneration.h --------------------------*/
3
/*--------------------------------------------------------------------------*/
69
/*--------------------------------------------------------------------------*/
70
/*----------------------------- DEFINITIONS --------------------------------*/
71
/*--------------------------------------------------------------------------*/
72
73
#ifndef __ADS_FastGeneration
74
#define __ADS_FastGeneration
75
/* self-identification: #endif constant */
76
77
/*--------------------------------------------------------------------------*/
78
/*------------------------------ INCLUDES ----------------------------------*/
79
/*--------------------------------------------------------------------------*/
80
81
#include "
ADS/Contract.h
"
82
#include "
ADS/combinatorial/Bitwise.h
"
83
#include "
ADS/combinatorial/Generation.h
"
84
85
#include <algorithm>
86
#include <bit>
87
#include <cstdint>
88
#include <type_traits>
89
#include <utility>
90
#include <vector>
91
92
/*--------------------------------------------------------------------------*/
93
/*--------------------------- NAMESPACE ------------------------------------*/
94
/*--------------------------------------------------------------------------*/
95
96
namespace
ADS
97
{
98
124
template
<
class
T ,
class
F >
125
long
forEachPermutation
( std::vector< T > & a , F && visit );
126
157
template
<
class
T ,
class
F >
158
long
forEachPermutationLex
( std::vector< T > & a , F && visit );
159
182
template
<
class
F >
183
long
forEachCombination
(
int
n ,
int
t , F && visit );
184
199
[[nodiscard]]
constexpr
Word
nextCombination
(
Word
x );
200
223
template
<
class
F >
224
long
forEachCombinationMask
(
int
n ,
int
t , F && visit );
225
226
/*--------------------------------------------------------------------------*/
227
228
}
// end( namespace ADS )
229
230
/*--------------------------------------------------------------------------*/
231
/*-------------------------- IMPLEMENTATION --------------------------------*/
232
/*--------------------------------------------------------------------------*/
233
234
#include "ADS/combinatorial/impl/FastGeneration.tpp"
235
236
/*--------------------------------------------------------------------------*/
237
238
#endif
/* FastGeneration.h included */
239
240
/*--------------------------------------------------------------------------*/
241
/*----------------------- End File FastGeneration.h ------------------------*/
242
/*--------------------------------------------------------------------------*/
Bitwise.h
The broadword tricks of Knuth (section 7.1.3 of The Art of Computer Programming), beyond the book: op...
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
Generation.h
The generation of the basic combinatorial objects of Knuth (section 7.2.1 of The Art of Computer Prog...
ADS::forEachPermutation
long forEachPermutation(std::vector< T > &a, F &&visit)
the arrangements of by Heap's method, visit( a ) on each
ADS::forEachCombinationMask
long forEachCombinationMask(int n, int t, F &&visit)
the words of 1 bits below in increasing order, visit( x ) on each
ADS::forEachPermutationLex
long forEachPermutationLex(std::vector< T > &a, F &&visit)
the distinct permutations of the multiset in lexicographic order from sorted, visit( a ) on each; ...
ADS::forEachCombination
long forEachCombination(int n, int t, F &&visit)
the increasing -tuples of in lexicographic order, visit( c ) on each, a const std::vector< int > of...
ADS::nextCombination
constexpr Word nextCombination(Word x)
the next larger word with as many 1 bits as
ADS
Definition
ADT.h:96
ADS::Word
std::uint64_t Word
a word of 64 bits
Definition
Bitwise.h:73
ADS
combinatorial
FastGeneration.h
Generated by
1.17.0