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

The res struct the exact queueing-system functions return, and the numeric helpers those functions share. More...

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <limits>
#include <string>
#include <utility>
#include <vector>
#include <boost/math/special_functions/bessel.hpp>
#include <boost/math/special_functions/gamma.hpp>
#include "line/util/error.h"
Include dependency graph for qsys_res.h:

Go to the source code of this file.

Classes

struct  line::qsys::QsysResFieldT< T >
 One measure of a res struct: a scalar or a row vector. More...
struct  line::qsys::QsysResT< T >
 MATLAB's res struct: named measures in insertion order, plus res.analyzer. More...
struct  line::qsys::QsysResOptions
 The name-value options shared by the exact functions: tPoints, percentiles and nmax (a negative nmax means "not given", MATLAB's []). More...

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::qsys
namespace  line::qsys::resdetail

Typedefs

using line::qsys::QsysRes = QsysResT<double>

Functions

double line::qsys::resdetail::gammaln (double x)
 MATLAB's gammaln.
double line::qsys::resdetail::gammainc_upper (double x, double a)
 MATLAB's gammainc(x, a, 'upper'), the regularized upper tail Q(a, x).
double line::qsys::resdetail::gammainc_lower (double x, double a)
 MATLAB's gammainc(x, a, 'lower'), the regularized lower tail P(a, x).
double line::qsys::resdetail::besseli1_scaled (double x)
 MATLAB's besseli(1, x, 1) = I_1(x) exp(-x), x >= 0.
std::vector< double > line::qsys::resdetail::geometric (double c, double r, long nmax)
 The 0:nmax power law c*r.
double line::qsys::resdetail::ccdf_inverse (const std::function< double(double)> &ccdf, double target, double hi)
 The bisection inverse of a complementary CDF shared by the reference's functions (ccdf_inverse / mmck_ccdf_inverse / mmckk_ccdf_inverse): the time at which ccdf falls to target, bracketing upward from hi.
double line::qsys::resdetail::vsum (const std::vector< double > &x)
 sum(x)
std::vector< double > line::qsys::resdetail::lognormalize (const std::vector< double > &logp, const std::vector< double > &lognorm)
 exp(logp - logsumexp(lognorm)), the reference's log-space normalization.
std::vector< double > line::qsys::resdetail::cdf_of (const std::function< double(double)> &ccdf, const std::vector< double > &t)
 Fills out with 1 - ccdf(t) at each t, as 1 - arrayfun(ccdf, t).
std::vector< double > line::qsys::resdetail::pct_of (const std::function< double(double)> &ccdf, const std::vector< double > &pct, double hi)
 The percentiles by bisection, arrayfun(@(r) ccdf_inverse(ccdf, 1 - r/100, hi), pct).
void line::qsys::resdetail::require_stable (double rho, const char *fn)
 The reference's LINE:input:Unstable refusal.
void line::qsys::resdetail::throw_unstable (const char *fn, const char *what, double v)
 A LINE:input:Unstable refusal "fn: unstable system: <what> = %g >= 1".
void line::qsys::resdetail::throw_unknown_option (const char *fn, const std::string &name, bool argument_id)
 MATLAB's "unknown option 'name'" refusal, as LINE:input:Argument or as a bare LINE:Error.
double line::qsys::resdetail::nchoosek_r (double n, double k)
 The reference's nchoosek_r: exp(gammaln) rounded to the integer it is while that integer is exactly representable (below 2^52).
void line::qsys::resdetail::check_percentiles (const std::vector< double > &pct, const char *fn)
 A percentile vector checked against (0, 100), MATLAB's LINE:Error refusal.

Detailed Description

The res struct the exact queueing-system functions return, and the numeric helpers those functions share.

MATLAB's exact closed forms (qsys_mm1, qsys_mmk, qsys_mg1, qsys_gm1, qsys_mmck, qsys_mg1_prio and the finite-source, priority, busy-period and renewal-arrival functions) return a struct whose field set depends on the options passed (tPoints, percentiles, ES3, lambda, ...). QsysRes holds the same fields in the same order, by the same names, so the dispatch layer can encode them one for one; analyzer is MATLAB's res.analyzer string.

The distributional measures (incomplete gamma tails, Bessel densities, log-space distributions, bisection percentiles) are evaluated in double precision, as in the reference.

Definition in file qsys_res.h.