5#ifndef LINE_API_MAM_MAP_COUNT_MOMENT_H
6#define LINE_API_MAM_MAP_COUNT_MOMENT_H
71 "map_count_moment requires transcendental arithmetic");
74 for (std::size_t i = 0; i < orders.size(); ++i)
75 if (orders[i] > K) K = orders[i];
77 const std::size_t n = m.
order();
78 const std::vector<T> theta =
map_prob(m);
82 const std::size_t N = (K + 1) * n;
84 for (std::size_t bi = 0; bi <= K; ++bi) {
85 for (std::size_t bj = bi; bj <= K; ++bj) {
86 const std::size_t j = bj - bi;
89 for (std::size_t r = 0; r < n; ++r)
90 for (std::size_t c = 0; c < n; ++c) {
91 const T coeff = j == 0 ? T(Q(r, c)) : T(m.
D1(r, c) * fac);
92 G(bi * n + r, bj * n + c) = coeff * t;
99 out.reserve(orders.size());
100 for (std::size_t i = 0; i < orders.size(); ++i) {
101 const unsigned k = orders[i];
103 for (std::size_t r = 0; r < n; ++r)
104 for (std::size_t c = 0; c < n; ++c) s += theta[r] * E(r, k * n + c);
132 const std::size_t K = m.
classes();
133 if (K == 0)
throw InputError(
"mmap_count_moment: the MMAP has no classes");
135 for (std::size_t c = 0; c < K; ++c) {
138 for (std::size_t j = 0; j < K; ++j) {
139 if (j == c)
continue;
140 for (std::size_t a = 0; a < marg.
D0.rows(); ++a)
141 for (std::size_t b = 0; b < marg.
D0.cols(); ++b) marg.
D0(a, b) += m.
Dc[j](a, b);
145 for (std::size_t i = 0; i < orders.size(); ++i) out(i, c) = mm[i];
The exception types the port throws.
Matrix exponential by scaling and squaring with a diagonal Pade approximant.
Dense linear algebra over the templated number type: products, identity, inverse, and powers.
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
Dense matrix and non-owning view.
Marked MAP (MMAP) algebra: per-class rates, class probabilities, superposition, normalization and sca...
Matrix< T > map_infgen(const Map< T > &m)
Generator of the underlying phase process, D0 + D1.
Matrix< T > mmap_count_moment(const Mmap< T > &m, const T &t, const std::vector< unsigned > &orders)
Per-class counting moments of a marked MAP, mmap_count_moment.
std::vector< T > map_prob(const Map< T > &m)
Stationary distribution of the phase process, pi (D0 + D1) = 0.
std::vector< T > map_count_moment(const Map< T > &m, const T &t, const std::vector< unsigned > &orders)
Power moments of the counts of a MAP in a window of length t.
T num_factorial(unsigned n)
Factorial as a value of T.
Matrix< T > expm(const Matrix< T > &A)
Matrix exponential exp(A).
Number-type abstraction for the templated API port.
A MAP as the pair of matrices (D0, D1).
std::size_t order() const
An MMAP: the underlying MAP plus the per-class arrival matrices.
std::size_t classes() const
std::vector< Matrix< T > > Dc
per-class matrices, sum_c Dc = D1