LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
map2mmpp.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_MAP2MMPP_H
6
#define LINE_API_MAM_MAP2MMPP_H
7
8
/**
9
* @file
10
* @ingroup api_mam
11
* Read a MAP as an MMPP (matlab/lib/kpctoolbox/map/map2mmpp.m).
12
*
13
* Returns the modulating generator Q = D0 + D1 and the arrival-rate matrix
14
* LAMBDA = D1. The representation is an MMPP only when D1 is diagonal; MATLAB
15
* emits a warning in that case and returns anyway, whereas this port reports
16
* the off-diagonal mass through the result struct so the caller decides.
17
*
18
* Pure additions and copies, exact at Rational: no transcendental gate.
19
*/
20
21
#include "
line/api/mam/map_moment.h
"
22
#include "
line/num/number.h
"
23
#include "
line/util/matrix.h
"
24
25
namespace
line
{
26
namespace
mam
{
27
28
/** Result of map2mmpp. */
29
template
<
class
T>
30
struct
Map2mmppResult
{
31
Matrix<T>
Q
;
///< modulating generator D0 + D1
32
Matrix<T>
LAMBDA
;
///< arrival rates D1
33
T
offdiag_norm
;
///< max |D1(i,j)| over i != j; zero iff a true MMPP
34
bool
is_mmpp
;
///< offdiag_norm == 0
35
};
36
37
/** Modulating generator and arrival-rate matrix of a MAP read as an MMPP. */
38
template
<
class
T>
39
Map2mmppResult<T>
map2mmpp
(
const
Map<T>
& m) {
40
const
T zero =
num_traits<T>::from_int
(0);
41
Map2mmppResult<T>
r;
42
r.
Q
=
map_infgen
(m);
43
r.
LAMBDA
= m.
D1
;
44
r.
offdiag_norm
= zero;
45
for
(std::size_t i = 0; i < m.
D1
.rows(); ++i)
46
for
(std::size_t j = 0; j < m.
D1
.cols(); ++j) {
47
if
(i == j)
continue
;
48
const
T a =
num_abs
(T(m.
D1
(i, j)));
49
if
(a > r.
offdiag_norm
) r.
offdiag_norm
= a;
50
}
51
r.
is_mmpp
= (r.
offdiag_norm
== zero);
52
return
r;
53
}
54
55
}
// namespace mam
56
}
// namespace line
57
58
#endif
// LINE_API_MAM_MAP2MMPP_H
line::Matrix
Definition
matrix.h:56
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_infgen
Matrix< T > map_infgen(const Map< T > &m)
Generator of the underlying phase process, D0 + D1.
Definition
map_moment.h:62
line::mam::map2mmpp
Map2mmppResult< T > map2mmpp(const Map< T > &m)
Modulating generator and arrival-rate matrix of a MAP read as an MMPP.
Definition
map2mmpp.h:39
line
Definition
aoi_dist2ph.h:52
line::num_abs
T num_abs(const T &v)
Definition
number.h:172
number.h
Number-type abstraction for the templated API port.
line::mam::Map2mmppResult
Result of map2mmpp.
Definition
map2mmpp.h:30
line::mam::Map2mmppResult::is_mmpp
bool is_mmpp
offdiag_norm == 0
Definition
map2mmpp.h:34
line::mam::Map2mmppResult::offdiag_norm
T offdiag_norm
max |D1(i,j)| over i != j; zero iff a true MMPP
Definition
map2mmpp.h:33
line::mam::Map2mmppResult::LAMBDA
Matrix< T > LAMBDA
arrival rates D1
Definition
map2mmpp.h:32
line::mam::Map2mmppResult::Q
Matrix< T > Q
modulating generator D0 + D1
Definition
map2mmpp.h:31
line::mam::Map
A MAP as the pair of matrices (D0, D1).
Definition
map_moment.h:53
line::mam::Map::D1
Matrix< T > D1
Definition
map_moment.h:55
line::num_traits
Definition
number.h:111
include
line
api
mam
map2mmpp.h
Generated by
1.18.0