LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
map_count_mean.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_MEAN_H
6
#define LINE_API_MAM_MAP_COUNT_MEAN_H
7
8
/**
9
* @file
10
* @ingroup api_mam
11
* Mean of the counting process of a MAP at resolution t.
12
*
13
* Templated port of matlab/lib/kpctoolbox/map/map_count_mean.m. The number of
14
* arrivals in a window of length t has stationary mean lambda t, with lambda
15
* the stationary arrival rate pi D1 e, so the whole function is one linear
16
* solve and a product.
17
*
18
* ARITHMETIC: exact. No exponential appears, and the mean of the counts is a
19
* rational function of the entries of (D0, D1) -- which makes it the natural
20
* consistency check on the counting-process functions that do need expm
21
* (map_count_var, map_count_moment), since M1 from map_count_moment must
22
* reproduce this value to the exponential's tolerance.
23
*/
24
25
#include <cstddef>
26
#include <vector>
27
28
#include "
line/api/mam/map_moment.h
"
29
#include "
line/num/number.h
"
30
#include "
line/util/error.h
"
31
#include "
line/util/matrix.h
"
32
33
namespace
line
{
34
namespace
mam
{
35
36
/**
37
* @brief Mean of the counting process of a MAP at resolution t.
38
*
39
* @param m the MAP (D0, D1)
40
* @param t window lengths
41
* @return lambda t for each window length, in the order of t
42
*/
43
template
<
class
T>
44
std::vector<T>
map_count_mean
(
const
Map<T>
& m,
const
std::vector<T>& t) {
45
const
T lam =
map_lambda
(m);
46
std::vector<T> out;
47
out.reserve(t.size());
48
for
(std::size_t k = 0; k < t.size(); ++k) {
49
if
(t[k] <
num_traits<T>::from_int
(0))
50
throw
InputError
(
"map_count_mean: negative window length"
);
51
out.push_back(lam * t[k]);
52
}
53
return
out;
54
}
55
56
}
// namespace mam
57
}
// namespace line
58
59
#endif
// LINE_API_MAM_MAP_COUNT_MEAN_H
line::InputError::InputError
InputError(const std::string &what)
Definition
error.h:39
error.h
The exception types the port throws.
map_moment.h
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
matrix.h
Dense matrix and non-owning view.
line::mam
Definition
amap2_adjust_gamma.h:78
line::mam::map_count_mean
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.
Definition
map_count_mean.h:44
line::mam::map_lambda
T map_lambda(const Map< T > &m)
Stationary arrival rate, lambda = pi D1 e.
Definition
map_moment.h:79
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
line::mam::Map
A MAP as the pair of matrices (D0, D1).
Definition
map_moment.h:53
line::num_traits
Definition
number.h:111
include
line
api
mam
map_count_mean.h
Generated by
1.18.0