LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
map_count_idc.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_MAM_MAP_COUNT_IDC_H
6#define LINE_API_MAM_MAP_COUNT_IDC_H
7
8/**
9 * @file
10 * @ingroup api_mam
11 * Index of dispersion for counts (IDC) of a MAP at resolution t.
12 *
13 * Templated port of matlab/lib/kpctoolbox/map/map_count_idc.m. The IDC of the
14 * counting process A(t) is the scaled variance-time curve
15 * I_a(t) = Var(A(t)) / E[A(t)], t > 0,
16 * interpolating between the interarrival SCV at t->0+ and map_idc at t->Inf
17 * (Whitt-You, "A Robust Queueing Network Analyzer Based on Indices of
18 * Dispersion", eq. 1). It is the traffic descriptor RQNA is built on.
19 *
20 * ARITHMETIC: transcendental. Var(A(t)) needs the matrix exponential
21 * (map_count_var), so this refuses under Rational like its variance input.
22 */
23
24#include <cstddef>
25#include <vector>
26
30#include "line/num/number.h"
31#include "line/util/error.h"
32
33namespace line {
34namespace mam {
35
36/**
37 * @brief Index of dispersion for counts (IDC) of a MAP at resolution t.
38 *
39 * @param m the MAP (D0, D1)
40 * @param t window lengths (t > 0)
41 * @return the IDC at each window length, in the order of t; 1 where the mean is
42 * zero (an orderly point process is locally Poisson as t -> 0)
43 */
44template <class T>
45std::vector<T> map_count_idc(const Map<T>& m, const std::vector<T>& t) {
47 "map_count_idc requires transcendental arithmetic (matrix exponential)");
48 const std::vector<T> mean = map_count_mean(m, t);
49 const std::vector<T> var = map_count_var(m, t);
50 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
51 std::vector<T> out(t.size(), one);
52 for (std::size_t k = 0; k < t.size(); ++k)
53 if (mean[k] > zero) out[k] = T(var[k] / mean[k]);
54 return out;
55}
56
57/** Scalar convenience: the IDC at a single window length t. */
58template <class T>
59T map_count_idc(const Map<T>& m, const T& t) {
60 const std::vector<T> tv(1, t);
61 return map_count_idc(m, tv)[0];
62}
63
64} // namespace mam
65} // namespace line
66
67#endif // LINE_API_MAM_MAP_COUNT_IDC_H
The exception types the port throws.
Mean of the counting process of a MAP at resolution t.
Variance of the counting process of a MAP at resolution t.
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
std::vector< T > map_count_var(const Map< T > &m, const std::vector< T > &t)
Variance of the counting process of a MAP at resolution t.
std::vector< T > map_count_mean(const Map< T > &m, const std::vector< T > &t)
Mean of the counting process of a MAP at resolution t.
std::vector< T > map_count_idc(const Map< T > &m, const std::vector< T > &t)
Index of dispersion for counts (IDC) of a MAP at resolution t.
Number-type abstraction for the templated API port.
A MAP as the pair of matrices (D0, D1).
Definition map_moment.h:53