LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
population.h File Reference

Population-vector enumeration and combinatorics. More...

#include <cstddef>
#include <vector>
#include "line/util/error.h"
Include dependency graph for population.h:

Go to the source code of this file.

Namespaces

namespace  line

Functions

std::vector< std::size_t > line::plane_sizes (const std::vector< int > &N)
 Mixed-radix plane sizes: prods[r] = prod_{s<r} (N[s]+1).
std::size_t line::population_count (const std::vector< int > &N)
 Number of population vectors n with 0 <= n <= N.
std::size_t line::pop_index (const std::vector< int > &n, const std::vector< std::size_t > &prods)
 Index of n in the lattice, 0-based (MATLAB hashpop is 1-based).
bool line::next_pop (std::vector< int > &n, const std::vector< int > &N)
 Advance n to the next population vector in the lattice 0 <= n <= N, odometer order with the last class varying fastest.
double line::nck (int n, int k)
 Binomial coefficient with a thread-local memo table (mp_pfqn util/nck.c).
double line::multichoose (int n, int k)
 Number of multisets of size k from n types, i.e.
template<class T>
line::num_nck (int n, int k)
 Binomial coefficient as a value of T, by the Pascal recurrence.

Detailed Description

Population-vector enumeration and combinatorics.

Mirrors MATLAB's pprod/hashpop (matlab/src/api/pfqn/pfqn_ca.m) and mp_pfqn's util/population.c (initpop/nextpop/popindex/getplanesizes), with no global state: the memo table for binomials is function-local and thread-local so the library stays callable with the Python GIL released.

Definition in file population.h.