LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
aoi_lst_erlang.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_API_AOI_LST_ERLANG_H
6#define LINE_API_AOI_LST_ERLANG_H
7
8/**
9 * @file
10 * @ingroup api_aoi
11 * Laplace-Stieltjes transform of an Erlang-k distribution.
12 *
13 * Templated port of matlab/src/api/aoi/aoi_lst_erlang.m, cross-checked against
14 * Aoi_lst.erlang in jar/src/main/java/jline/api/aoi/Aoi_lst.java (identical).
15 *
16 * H*(s) = (mu / (mu + s))^k, mean k/mu
17 *
18 * The exponent is an integer, so this stays a rational function of s and is
19 * exact in the field.
20 */
21
23#include "line/num/number.h"
24#include "line/util/error.h"
25
26namespace line {
27namespace aoi {
28
29/**
30 * @brief Laplace-Stieltjes transform of an Erlang-k distribution.
31 *
32 * @param k number of phases, >= 1
33 * @param mu per-phase rate, > 0
34 * @return s -> (mu/(mu+s))^k
35 */
36template <class T>
37Lst<T> aoi_lst_erlang(unsigned k, const T& mu) {
38 if (k < 1) throw InputError("aoi_lst_erlang: the shape k must be a positive integer");
39 detail::require_positive(mu, "aoi_lst_erlang", "the rate mu");
40 return [k, mu](const T& s) { return num_pow_int(T(mu / (mu + s)), k); };
41}
42
43} // namespace aoi
44} // namespace line
45
46#endif // LINE_API_AOI_LST_ERLANG_H
Shared return types and arithmetic helpers for the templated Age of Information port.
InputError(const std::string &what)
Definition error.h:39
The exception types the port throws.
std::function< T(const T &)> Lst
A Laplace-Stieltjes transform evaluated at real arguments.
Definition aoi_types.h:41
Lst< T > aoi_lst_erlang(unsigned k, const T &mu)
Laplace-Stieltjes transform of an Erlang-k distribution.
T num_pow_int(const T &base, unsigned e)
Integer power, valid in any field (no transcendental requirement).
Definition number.h:192
Number-type abstraction for the templated API port.