5#ifndef LINE_API_MAM_MAP_ACFC_H
6#define LINE_API_MAM_MAP_ACFC_H
57std::vector<T>
map_acfc(
const Map<T>& m,
const std::vector<unsigned>& kset,
const T& u) {
59 "map_acfc requires transcendental arithmetic");
60 const std::size_t n = m.
order();
63 const std::vector<T> piq =
map_prob(m);
64 const Matrix<T> tmp = detail::map_count_deviation(Q, piq);
66 const std::vector<T> e =
ones<T>(n);
69 const std::vector<T> piD1 =
vecmul(piq, m.
D1);
70 const std::vector<T> piD1Eu =
vecmul(piD1, Eu);
71 std::vector<T> pre(n);
72 for (std::size_t i = 0; i < n; ++i) pre[i] = piD1[i] - piD1Eu[i];
75 const std::vector<T> Eutail =
mulvec(Eu, tail);
76 std::vector<T> post(n);
77 for (std::size_t i = 0; i < n; ++i) post[i] = tail[i] - Eutail[i];
79 const std::vector<T> uv(1, u);
82 throw NumericError(
"map_acfc: the counts have zero variance at this timescale");
85 out.reserve(kset.size());
86 for (std::size_t j = 0; j < kset.size(); ++j) {
87 if (kset[j] < 1u)
throw InputError(
"map_acfc: lags must be at least 1");
89 std::vector<T> v = pre;
92 for (std::size_t i = 0; i < n; ++i) s += v[i] * post[i];
93 out.push_back(s / vart);
NumericError(const std::string &what)
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...
Variance of the counts of a MAP over windows of length t, in the spelling of matlab/lib/kpctoolbox/ma...
Dense matrix and non-owning view.
Matrix< T > map_infgen(const Map< T > &m)
Generator of the underlying phase process, D0 + D1.
std::vector< T > map_varcount(const Map< T > &m, const std::vector< T > &tset)
Variance of the counts of a MAP over windows of length t, in the spelling of matlab/lib/kpctoolbox/ma...
std::vector< T > map_acfc(const Map< T > &m, const std::vector< unsigned > &kset, const T &u)
Autocorrelation of the counting process of a MAP at a given timescale.
std::vector< T > map_prob(const Map< T > &m)
Stationary distribution of the phase process, pi (D0 + D1) = 0.
std::vector< T > vecmul(const std::vector< T > &v, const Matrix< T > &A)
Row vector times matrix, v A.
Matrix< T > matmul(const Matrix< T > &A, const Matrix< T > &B)
Matrix product A B.
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).
std::size_t order() const