LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
map_count_moment.h File Reference

Power moments of the counts of a MAP in a window of length t. More...

#include <cstddef>
#include <vector>
#include "line/api/mam/map_moment.h"
#include "line/api/mam/mmap_lambda.h"
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/expm.h"
#include "line/util/linalg.h"
#include "line/util/matrix.h"
Include dependency graph for map_count_moment.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::mam

Functions

template<class T>
std::vector< T > line::mam::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.
template<class T>
Matrix< T > line::mam::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.

Detailed Description

Power moments of the counts of a MAP in a window of length t.

Templated port of matlab/lib/kpctoolbox/map/map_count_moment.m. The moment generating function of the number of arrivals N(t) is

M(z) = theta exp(D0 t + e^z D1 t) e, E[N(t)^k] = d^k M / dz^k |_{z=0},

with theta the stationary phase vector.

DIVERGENCE, deliberately: MATLAB evaluates those derivatives by NUMERICAL differentiation (derivest, Richardson extrapolation) for orders up to 4 and by symbolic differentiation beyond, so its accuracy degrades quickly with the order and it needs the Symbolic Toolbox for order 5 and above. This port takes the derivatives analytically, at the cost of one larger exponential. Write the exponent as a polynomial in z,

B(z) = Q t + sum_{j>=1} (D1 t / j!) z^j, Q = D0 + D1,

truncated at z^K. Polynomials in z modulo z^(K+1) are represented faithfully by block upper-triangular Toeplitz matrices, G[i][i+j] = B_j, and that representation is a ring homomorphism, so exp(G) is the representation of exp(B(z)) mod z^(K+1): its (0,j) block is exactly the z^j Taylor coefficient, i.e. the j-th derivative divided by j!. Hence

E[N(t)^k] = k! theta [exp(G)]_{0,k} e,

accurate to the tolerance of the exponential at every order, with no step size to choose and no symbolic algebra. The cost is one exponential of an (K+1)n square matrix.

ARITHMETIC: transcendental (one matrix exponential).

The JAR has no counterpart of this function.

Definition in file map_count_moment.h.