5#ifndef LINE_API_MAM_MMAP_COUNT_VAR_H
6#define LINE_API_MAM_MMAP_COUNT_VAR_H
56 "mmap_count_var requires transcendental arithmetic");
58 const std::size_t n = mm.
order();
59 const std::size_t K = mm.
classes();
60 if (K == 0)
throw InputError(
"mmap_count_var: the MMAP has no classes");
64 const std::vector<T> theta =
map_prob(base);
65 const Matrix<T> tmp = detail::map_count_deviation(D, theta);
66 const std::vector<T> e =
ones<T>(n);
72 for (std::size_t k = 0; k < K; ++k) {
74 const std::vector<T> thetaDk =
vecmul(theta, Dk);
76 for (
const T& v : thetaDk) lam += v;
77 const std::vector<T> c =
vecmul(thetaDk, tmp);
79 const std::vector<T> cDk =
vecmul(c, Dk);
81 for (
const T& v : cDk) cDke += v;
83 const std::vector<T> cE =
vecmul(c, E);
85 for (std::size_t i = 0; i < n; ++i) corr += (c[i] - cE[i]) * d[i];
86 out.push_back((lam - two * lam * lam + two * cDke) * t - two * corr);
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.
Variance of the counting process of a MAP at resolution t.
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.
std::vector< T > map_prob(const Map< T > &m)
Stationary distribution of the phase process, pi (D0 + D1) = 0.
std::vector< T > mmap_count_var(const Mmap< T > &mm, const T &t)
Per-class variance of the counting process of a marked MAP.
std::vector< T > vecmul(const std::vector< T > &v, const Matrix< T > &A)
Row vector times matrix, v A.
std::vector< T > mulvec(const Matrix< T > &A, const std::vector< T > &v)
Matrix times column vector, A v.
std::vector< T > ones(std::size_t n)
Column vector of ones, the ubiquitous e in MAP algebra.
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).
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
std::size_t order() const