5#ifndef LINE_API_MAM_MAP_ALGEBRA_H
6#define LINE_API_MAM_MAP_ALGEBRA_H
53 const std::size_t n = m.
D0.rows();
54 const std::vector<T> piq =
map_prob(m);
58 for (std::size_t i = 0; i < n; ++i)
59 for (std::size_t j = 0; j < n; ++j) {
60 out.
D0(i, j) = m.
D0(j, i) * piq[j] / piq[i];
61 out.
D1(i, j) = m.
D1(j, i) * piq[j] / piq[i];
70 for (std::size_t i = 0; i < D0.
rows(); ++i)
71 for (std::size_t j = 0; j < D0.
cols(); ++j) D0(i, j) = -D0(i, j);
78 if (maps.size() < 2)
throw InputError(
"map_kpc: at least two MAPs are required");
80 for (std::size_t k = 2; k < maps.size(); ++k) out =
map_kpc(out, maps[k]);
87 std::vector<std::complex<double>> ev =
eig_values(P);
88 if (ev.size() < 2)
throw InputError(
"map_gamma2: the MAP must have order at least 2");
89 std::sort(ev.begin(), ev.end(),
90 [](
const std::complex<double>& x,
const std::complex<double>& y) {
91 return std::abs(x) > std::abs(y);
Eigenvalues and singular values, backed by LAPACK.
The exception types the port throws.
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...
Map< T > map_timereverse(const Map< T > &m)
Time-reversed MAP, diag(pi)^-1 M' diag(pi) applied to D0 and D1.
std::complex< double > map_gamma2(const Map< double > &m)
Subdominant eigenvalue of the embedded chain, the leading ACF decay rate.
Matrix< T > kron(const Matrix< T > &A, const Matrix< T > &B)
Kronecker product.
std::vector< T > map_prob(const Map< T > &m)
Stationary distribution of the phase process, pi (D0 + D1) = 0.
std::size_t map_largemap()
Order above which a MAP counts as large for the fitting heuristics.
Map< T > map_kpc(const Map< T > &a, const Map< T > &b)
Kronecker product composition of two MAPs.
Matrix< T > map_embedded(const Map< T > &m)
Embedded DTMC at arrival epochs, P = (-D0)^-1 D1.
std::vector< std::complex< double > > eig_values(const Matrix< double > &A)
Eigenvalues of a general real square matrix, in LAPACK's order.
Number-type abstraction for the templated API port.
A MAP as the pair of matrices (D0, D1).