![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Randomness scaffolding shared by the Monte Carlo normalizing-constant estimators (pfqn_mci, pfqn_is, pfqn_ld_is, pfqn_oi_is, pfqn_pas_is, pfqn_ls, pfqn_mmsample2) and by the perfect sampler pfqn_cftp. More...
#include <cmath>#include <cstdint>#include <limits>#include <random>#include <vector>#include "line/num/number.h"#include "line/util/error.h"Go to the source code of this file.
Namespaces | |
| namespace | line |
| namespace | line::pfqn |
Typedefs | |
| using | line::pfqn::McRng = std::mt19937_64 |
| The generator type every Monte Carlo entry point in this tree accepts. | |
Functions | |
| double | line::pfqn::mc_uniform01 (McRng &g) |
| Uniform deviate on [0,1) with 53 significant bits, as a double. | |
| template<class T> | |
| T | line::pfqn::mc_uniform (McRng &g) |
| The same deviate materialized in the working arithmetic. | |
| std::uint64_t | line::pfqn::mc_uniform_int (McRng &g, std::uint64_t n) |
| Uniform integer on [0, n), unbiased by rejection. | |
| double | line::pfqn::mc_normal01 (McRng &g) |
| Standard normal deviate by the Box-Muller transform. | |
| double | line::pfqn::mc_logmeanexp (const std::vector< double > &v) |
| log(mean(exp(v))), computed by factoring out the maximum so that the exponentials stay in range. | |
| template<class T> | |
| T | line::pfqn::mc_exp (double lv) |
| exp of a log-domain value, materialized in the working arithmetic. | |
| template<class T> | |
| double | line::pfqn::mc_log_factorial (long n) |
| log(n!) for a non-negative integer n, the factln / gammaln(1+n) of the references, accumulated in the working arithmetic so the high-precision backends do not lose the digits a double lgamma would drop. | |
Randomness scaffolding shared by the Monte Carlo normalizing-constant estimators (pfqn_mci, pfqn_is, pfqn_ld_is, pfqn_oi_is, pfqn_pas_is, pfqn_ls, pfqn_mmsample2) and by the perfect sampler pfqn_cftp.
This header is NOT a port of a MATLAB function. It exists because the MATLAB references draw from the global MATLAB stream (rand / randi / mvnrnd, seeded out of band by rng(options.seed)), and a library must not carry a hidden global stream. Every estimator in this tree therefore takes a std::mt19937_64& as an explicit argument and consumes it through the helpers below.
REPRODUCIBILITY CONTRACT, which every estimator's own header repeats:
Arithmetic: everything here is inherently inexact (uniform deviates are dyadic approximations of a continuous law, the normal transform needs log/cos), so each consumer gates on num_traits<T>::has_transcendental.
Definition in file pfqn_mc_common.h.