LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
mtrace_forward_moment.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012-2026, QORE Lab, Imperial College London
3
* All rights reserved.
4
*/
5
#ifndef LINE_API_TRACE_MTRACE_FORWARD_MOMENT_H
6
#define LINE_API_TRACE_MTRACE_FORWARD_MOMENT_H
7
8
/**
9
* @file
10
* @ingroup api_trace
11
* Forward moments of a marked trace: the moments of the inter-arrival time
12
* that FOLLOWS an event of each class,
13
*
14
* F(c,k) = (1/(N-1)) sum_{i<N: A_i = c} T_{i+1}^k,
15
*
16
* normalized by N/count_c when norm is set, so that M_k = sum_c F(c,k) p_c.
17
*
18
* Templated port of matlab/lib/m3a/m3a/mtrace/mtrace_forward_moment.m,
19
* cross-checked against
20
* jar/src/main/java/jline/api/trace/Mtrace_forward_moment.java.
21
*
22
* In MATLAB this function is literally mtrace_moment(T,A,orders,1,NORM) with
23
* NORM defaulting to on, and it is implemented here the same way. The two JAR
24
* divergences described in mtrace_moment.h (the sum divided by count_c
25
* already in the unnormalized branch, and the (N-1)/count_c normalization
26
* factor) apply verbatim to Mtrace_forward_moment.java as well.
27
*
28
* ARITHMETIC: sums of integer powers and a division, exact in Rational.
29
*/
30
31
#include <vector>
32
33
#include "
line/api/trace/mtrace_moment.h
"
34
#include "
line/api/trace/trace_types.h
"
35
#include "
line/num/number.h
"
36
#include "
line/util/matrix.h
"
37
38
namespace
line
{
39
namespace
trace
{
40
41
/**
42
* @brief Forward moments of a marked trace: the moments of the inter-arrival
43
* time that FOLLOWS an event of each class, F(c,k) = (1/(N-1))
44
* sum_{i<N: A_i = c} T_{i+1}^k, normalized by N/count_c when norm is
45
* set, so that M_k = sum_c F(c,k) p_c.
46
*
47
* @param Tv inter-arrival times
48
* @param A class labels
49
* @param orders moment orders
50
* @param norm normalize by N/count_c (the MATLAB default)
51
*/
52
template
<
class
T>
53
Matrix<T>
mtrace_forward_moment
(
const
std::vector<T>& Tv,
const
std::vector<int>& A,
54
const
std::vector<unsigned>& orders,
bool
norm =
true
) {
55
return
mtrace_moment
(Tv, A, orders,
true
, norm);
56
}
57
58
}
// namespace trace
59
}
// namespace line
60
61
#endif
// LINE_API_TRACE_MTRACE_FORWARD_MOMENT_H
line::Matrix
Definition
matrix.h:56
matrix.h
Dense matrix and non-owning view.
mtrace_moment.h
Empirical class-dependent moments of a marked trace.
line::trace
Definition
autocov.h:38
line::trace::mtrace_forward_moment
Matrix< T > mtrace_forward_moment(const std::vector< T > &Tv, const std::vector< int > &A, const std::vector< unsigned > &orders, bool norm=true)
Forward moments of a marked trace: the moments of the inter-arrival time that FOLLOWS an event of eac...
Definition
mtrace_forward_moment.h:53
line::trace::mtrace_moment
Matrix< T > mtrace_moment(const std::vector< T > &Tv, const std::vector< int > &A, const std::vector< unsigned > &orders, bool after=false, bool norm=false)
Empirical class-dependent moments of a marked trace.
Definition
mtrace_moment.h:65
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
trace_types.h
Shared declarations for the empirical trace statistics domain.
include
line
api
trace
mtrace_forward_moment.h
Generated by
1.18.0