EcGen 1.1.8
Loading...
Searching...
No Matches
set_partition.hpp
Go to the documentation of this file.
1
35
36#pragma once
37
38#include <py2cpp/recursive_gen.hpp>
39#include <type_traits> // for integral_constant
40// #include <utility> // neccessary???
41
42namespace ecgen {
43
63 template <int N, int K> constexpr auto Stirling2nd() {
64 if constexpr (K >= N || K <= 1) {
65 return std::integral_constant<size_t, 1U>{};
66 } else {
67 return std::integral_constant<size_t, Stirling2nd<N - 1, K - 1>()
68 + K * Stirling2nd<N - 1, K>()>{};
69 }
70 }
71
86 extern auto set_partition_gen(int n, int k) -> py::RecursiveGenerator<std::pair<int, int>>;
87
88} // namespace ecgen
Definition combin.hpp:13
constexpr auto Stirling2nd()
Compute Stirling numbers of the second kind S(N, K).
Definition set_partition.hpp:63
auto set_partition_gen(int n, int k) -> py::RecursiveGenerator< std::pair< int, int > >