LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
mtrace_var.h File Reference

Per-class variance of a marked trace. More...

#include <cstddef>
#include <limits>
#include <vector>
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for mtrace_var.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::trace

Functions

template<class T>
std::vector< T > line::trace::mtrace_var (const std::vector< T > &tv, std::size_t ntypes, const std::vector< int > &types)
 Per-class variance of a marked trace.

Detailed Description

Per-class variance of a marked trace.

Port of mtrace_var in python/line_solver/api/trace/trace_analysis.py. PYTHON-ONLY: no MATLAB or JAR twin. The unmarked twin is trace_var.h.

IT IS THE POPULATION VARIANCE, E[X^2] - E[X]^2, not the sample one: the reference divides by the class count, not by count minus one. That matters when a class is short, and the two differ by the factor n/(n-1).

A CLASS WITH ONE OR NO SAMPLE GETS NaN, NOT ZERO. A single observation has no dispersion to report, and zero would be indistinguishable from a class whose samples happen to be identical – which is a real and different finding. The reference returns NaN and so does this; a caller aggregating these must test.

ARITHMETIC: field.

Definition in file mtrace_var.h.