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

Empirical probability mass function of a discrete trace (counts, batch sizes, queue-length samples). More...

#include <cstddef>
#include <vector>
#include "line/api/trace/trace_types.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for trace_pmf.h:

Go to the source code of this file.

Classes

struct  line::trace::TracePmfResult< T >
 Return value of trace_pmf, mirroring [pmf, px]. More...

Namespaces

namespace  line
namespace  line::trace

Functions

template<class T>
TracePmfResult< T > line::trace::trace_pmf (const std::vector< int > &X)
 Empirical probability mass function of a discrete trace (counts, batch sizes, queue-length samples).

Detailed Description

Empirical probability mass function of a discrete trace (counts, batch sizes, queue-length samples).

Templated port of jar/src/main/java/jline/api/trace/Trace_var.java#trace_pmf, cross-checked against matlab/lib/kpctoolbox/trace/trace_pmf.m.

DIVERGENCE, MATLAB vs JAR: MATLAB computes hist(X, max(X))' ./ numel(X), i.e. it spreads max(X) equally spaced BINS over the range of the data and returns their relative frequencies, while separately returning unique(X) as the support. The two outputs then have different lengths and are not aligned whenever the observed values are not exactly 1..max(X) – the MATLAB pmf is a histogram, not a pmf on the returned support. The JAR counts the distinct observed values, which is the documented intent and is what this port implements. The pmf sums to 1 by construction, so its cumulative sum is a proper empirical CDF.

ARITHMETIC: counts divided by the sample size, exact in Rational.

Definition in file trace_pmf.h.