![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Sample autocovariance sequence of a trace, lags 0 . More...
#include <cstddef>#include <vector>#include "line/api/trace/trace_mean.h"#include "line/api/trace/trace_types.h"#include "line/num/number.h"#include "line/util/error.h"Go to the source code of this file.
Namespaces | |
| namespace | line |
| namespace | line::trace |
Functions | |
| template<class T> | |
| std::vector< T > | line::trace::autocov (const std::vector< T > &S) |
| Sample autocovariance sequence of a trace, lags 0 . | |
Sample autocovariance sequence of a trace, lags 0 .
. n-2.
Templated port of matlab/lib/kpctoolbox/contrib/autocov.m, cross-checked against the private autocov() of jar/src/main/java/jline/api/trace/Trace_var.java (identical formula; the MATLAB implementation evaluates it by FFT, which is the same quantity up to rounding but is not usable in exact arithmetic, so this port evaluates the defining sum directly).
acv(p) = 1/(n-p) sum_{i=1}^{n-p} (S_i - Sbar)(S_{i+p} - Sbar)
The lag-0 term is therefore the POPULATION variance (denominator n), not MATLAB's var: the header comment of autocov.m claiming acv(1) = var(X) is wrong by the factor n/(n-1). See trace_var.h.
ARITHMETIC: sums, products and divisions, exact in Rational.
Definition in file autocov.h.