LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
trace_idc.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_TRACE_IDC_H
6
#define LINE_API_TRACE_TRACE_IDC_H
7
8
/**
9
* @file
10
* @ingroup api_trace
11
* Index of dispersion for counts, estimated by its asymptotic equality with
12
* the index of dispersion for intervals at a large aggregation level.
13
*
14
* Templated port of matlab/lib/kpctoolbox/trace/trace_idc.m, cross-checked
15
* against `jar/src/main/java/jline/api/trace/Trace_var.java#trace_idc`.
16
*
17
* DIVERGENCE, MATLAB vs JAR: the aggregation level is
18
* min(1000, ceil(n/30)) in MATLAB but min(1000, n/30) with integer division
19
* in the JAR. They differ on every trace whose length is not a multiple of
20
* 30, and for n < 30 the JAR asks for k = 0, which its trace_idi turns into a
21
* division by zero (NaN). MATLAB is the reference.
22
*
23
* ARITHMETIC: as trace_idi, exact in Rational.
24
*/
25
26
#include <vector>
27
28
#include "
line/api/trace/trace_idi.h
"
29
#include "
line/api/trace/trace_types.h
"
30
#include "
line/num/number.h
"
31
#include "
line/util/error.h
"
32
33
namespace
line
{
34
namespace
trace
{
35
36
/**
37
* @brief Index of dispersion for counts, estimated by its asymptotic equality
38
* with the index of dispersion for intervals at a large aggregation
39
* level.
40
*
41
* @param S the trace; the aggregation level is min(1000, ceil(n/30)).
42
*/
43
template
<
class
T>
44
T
trace_idc
(
const
std::vector<T>& S) {
45
detail::require_nonempty(S,
"trace_idc"
);
46
const
long
n =
static_cast<
long
>
(S.size());
47
const
long
k = std::min<long>(1000, (n + 29) / 30);
48
const
TraceIdiResult<T>
r =
trace_idi
(S, std::vector<long>(1, k));
49
return
r.
idi
[0];
50
}
51
52
}
// namespace trace
53
}
// namespace line
54
55
#endif
// LINE_API_TRACE_TRACE_IDC_H
error.h
The exception types the port throws.
line::trace
Definition
autocov.h:38
line::trace::trace_idc
T trace_idc(const std::vector< T > &S)
Index of dispersion for counts, estimated by its asymptotic equality with the index of dispersion for...
Definition
trace_idc.h:44
line::trace::trace_idi
TraceIdiResult< T > trace_idi(const std::vector< T > &S, const std::vector< long > &k_set, long aggregate_n=0, bool drop_trailing_zero=false)
Index of dispersion for intervals, IDI(k) = k * var(S_t + ... + S_{t+k-1}) / mean(S_t + ....
Definition
trace_idi.h:71
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
line::trace::TraceIdiResult
Return value of trace_idi, mirroring [IDIk, support].
Definition
trace_idi.h:52
line::trace::TraceIdiResult::idi
std::vector< T > idi
one value per requested k
Definition
trace_idi.h:53
trace_idi.h
Index of dispersion for intervals,.
trace_types.h
Shared declarations for the empirical trace statistics domain.
include
line
api
trace
trace_idc.h
Generated by
1.18.0