LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::trace Namespace Reference

Classes

struct  MtraceBootstrapResult
 Lower and upper BCa endpoints of each descriptor, and the point estimate. More...
struct  MtraceCountResult
 Return value of mtrace_count. More...
struct  MtraceCountsResult
 Return value of mtrace_iat2counts. More...
struct  MtraceCrossMomentResult
 Return value of mtrace_cross_moment. More...
struct  MtraceJointResult
 Return value of mtrace_joint. More...
struct  MtraceMeanResult
 Return value of mtrace_mean. More...
struct  MtraceMergeResult
 Return value of mtrace_merge, mirroring [T, L]. More...
struct  MtraceSplitResult
 Return value of mtrace_split. More...
struct  MtraceSummary
 Return value of mtrace_summary. More...
struct  TraceBicovResult
 Return value of trace_bicov, mirroring [BiCov, BiCovLags]. More...
struct  TraceBinsResult
 Return value of trace_iat2bins, mirroring [C, bC]. More...
struct  TraceGammaResult
 Return value of trace_gamma, mirroring [GAMMA, RHO0, RESIDUALS]. More...
struct  TraceIdiResult
 Return value of trace_idi, mirroring [IDIk, support]. More...
struct  TracePmfResult
 Return value of trace_pmf, mirroring [pmf, px]. More...
struct  TraceSummary
 Return value of trace_summary. More...

Functions

template<class T>
std::vector< T > autocov (const std::vector< T > &S)
 Sample autocovariance sequence of a trace, lags 0 .
template<class T>
Matrix< T > mtrace_backward_moment (const std::vector< T > &Tv, const std::vector< int > &A, const std::vector< unsigned > &orders, bool norm=true)
 Backward moments of a marked trace: the moments of the inter-arrival time that PRECEDES an event of each class, B(c,k) = (1/N) sum_{i: A_i = c} T_i^k, normalized by N/count_c when norm is set, so that M_k = sum_c B(c,k) p_c.
template<class T>
MtraceBootstrapResult< T > mtrace_bootstrap (const std::vector< T > &Tv, const std::vector< int > &A, pfqn::McRng &rng, std::size_t resamples=1000, double alpha=0.05, std::size_t blockLen=50)
 Block-bootstrap confidence intervals for the descriptors of a marked trace.
template<class T>
MtraceCountResult< T > mtrace_count (const std::vector< T > &Tv, const std::vector< int > &A, const T &t)
 Per-class count process of a marked trace on a fixed resolution: the number of events of each class in the successive windows of length t that start at the first arrival epoch.
template<class T>
std::vector< std::vector< Matrix< T > > > mtrace_cov (const std::vector< T > &Tv, const std::vector< int > &A)
 Class-pair covariance matrices of a marked trace.
template<class T>
MtraceCrossMomentResult< T > mtrace_cross_moment (const std::vector< T > &Tv, const std::vector< int > &L, unsigned k)
 Class-pair cross moments of a marked trace: the k-th moment of the interval that separates an event of class i from the next event, of class j, MC(i,j) = mean{ T_t^k : A_{t-1} = i, A_t = j }.
template<class T>
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 each class, F(c,k) = (1/(N-1)) sum_{i<N: A_i = c} T_{i+1}^k, normalized by N/count_c when norm is set, so that M_k = sum_c F(c,k) p_c.
template<class T>
MtraceCountsResult< T > mtrace_iat2counts (const std::vector< T > &Tv, const std::vector< int > &A, const T &scale)
 Per-class counting processes of a marked trace: for each arrival, how many events of each class fall in the window of length scale that starts at that arrival.
template<class T>
MtraceJointResult< T > mtrace_joint (const std::vector< T > &Tv, const std::vector< int > &A, unsigned i1, unsigned i2)
 Class-dependent joint moments of a marked trace, JM(a) = (1/N_a) sum_{j : A_{j+1} = a} T_j^{i1} T_{j+1}^{i2}, the empirical estimate of E[(X_j)^{i1} (X_{j+1})^{i2}] conditioned on the middle event being of class a; the sum runs over the interior events, so the first and last event of the trace are excluded.
template<class T>
MtraceMeanResult< T > mtrace_mean (const std::vector< T > &Tv, long ntypes, const std::vector< int > &type)
 Per-type sample mean of a trace.
template<class T>
MtraceMergeResult< T > mtrace_merge (const std::vector< T > &t1, const std::vector< T > &t2)
 Superposes two single-class traces into one marked trace, labelling the events of the first stream 1 and those of the second 2.
template<class T>
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.
template<class T>
MtraceCrossMomentResult< T > mtrace_moment_simple (const std::vector< T > &Tv, const std::vector< int > &L, unsigned k)
template<class T>
std::vector< T > mtrace_pc (const std::vector< int > &A)
 Class probabilities of a marked trace, p_c = count_c / N.
template<class T>
Matrix< T > mtrace_sigma (const std::vector< int > &L)
 One-step class transition frequencies of a marked trace, sigma(i,j) = #{t : A_t = i, A_{t+1} = j} / (N-1).
template<class T>
Matrix< T > mtrace_sigma2 (const std::vector< int > &L)
 Two-step class transition frequencies of a marked trace, sigma(i,j,h) = #{t : A_t = i, A_{t+1} = j, A_{t+2} = h} / (N-2).
template<class T>
MtraceSplitResult< T > mtrace_split (const std::vector< T > &Tv, const std::vector< int > &L)
 Splits a marked trace into its per-class traces: for each class, the inter-arrival times BETWEEN CONSECUTIVE EVENTS OF THAT CLASS, with the first interval measured from the origin.
template<class T>
MtraceSummary< T > mtrace_summary (const std::vector< T > &Tv, const std::vector< int > &A, int max_lag=100)
 Descriptor set of a marked trace: the first five raw moments of the inter-arrival times, the autocorrelation function, the first two forward and backward moments, the first two class-pair cross moments, the class probabilities and the one-step class transition frequencies.
template<class T>
std::vector< T > mtrace_var (const std::vector< T > &tv, std::size_t ntypes, const std::vector< int > &types)
 Per-class variance of a marked trace.
template<class T>
std::vector< T > trace_acf (const std::vector< T > &S, const std::vector< int > &lags)
 Autocorrelation coefficients of a trace at the requested lags.
template<class T>
std::vector< T > trace_acf (const std::vector< T > &S)
 Lag-1 autocorrelation, the MATLAB and JAR default.
template<class T>
TraceBicovResult< T > trace_bicov (const std::vector< T > &S, const std::vector< int > &grid)
 Bicovariance of a trace on a lag grid.
template<class T>
TraceGammaResult< T > trace_gamma (const std::vector< T > &S, long limit=1000, const std::vector< T > &grid=std::vector< T >())
 Autocorrelation decay rate of a trace: the gamma of the geometric model rho(k) = rho0 * gamma^k, with rho0 = (1 - 1/scv)/2 fixed by the second moment and gamma fitted by least squares on the empirical acf.
template<class T>
TraceBinsResult trace_iat2bins (const std::vector< T > &S, const T &scale)
 Bins a trace on a fixed time grid: the number of arrivals falling in each interval ((i-1)*scale, i*scale], and the bin index of each arrival.
template<class T>
std::vector< long > trace_iat2counts (const std::vector< T > &S, const T &scale)
 Counting process of a trace: the number of arrivals in the window of length scale that starts at each arrival epoch.
template<class T>
trace_idc (const std::vector< T > &S)
 Index of dispersion for counts, estimated by its asymptotic equality with the index of dispersion for intervals at a large aggregation level.
template<class T>
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 + ... + S_{t+k-1})^2, the standard burstiness descriptor of Sriram and Whitt (JSAC 6, 1986).
template<class T>
trace_joint (const std::vector< T > &S, const std::vector< int > &lag, const std::vector< unsigned > &order)
 Joint moments of a trace, E[X_i^{k_1} X_{i+l_2}^{k_2} ...].
template<class T>
trace_mean (const std::vector< T > &S)
 (1/n) sum_i S(i).
template<class T>
TracePmfResult< T > trace_pmf (const std::vector< int > &X)
 Empirical probability mass function of a discrete trace (counts, batch sizes, queue-length samples).
template<class T>
trace_scv (const std::vector< T > &S, bool unbiased=true)
 Squared coefficient of variation of a trace, var/mean^2.
template<class T, class Gen>
std::vector< T > trace_shuffle (const std::vector< T > &S, Gen &gen)
 A uniformly random permutation of the samples, drawn with the given engine.
template<class T>
trace_skew (const std::vector< T > &S)
 Bias-corrected sample skewness (MATLAB's skewness(S,0), equivalently the G1 estimator).
template<class T>
TraceSummary< T > trace_summary (const std::vector< T > &S)
 Descriptive summary of a trace: moments, shape, order statistics, autocorrelation and burstiness.
template<class T>
trace_var (const std::vector< T > &S, bool unbiased=true)
 Sample variance of a trace.

Function Documentation

◆ autocov()

template<class T>
std::vector< T > line::trace::autocov ( const std::vector< T > & S)

Sample autocovariance sequence of a trace, lags 0 .

. n-2.

Returns
acv[0..n-2], acv[p] the lag-p sample autocovariance.

Definition at line 46 of file autocov.h.

References autocov(), line::InputError::InputError(), and trace_mean().

Referenced by autocov(), and trace_acf().

◆ mtrace_backward_moment()

template<class T>
Matrix< T > line::trace::mtrace_backward_moment ( const std::vector< T > & Tv,
const std::vector< int > & A,
const std::vector< unsigned > & orders,
bool norm = true )

Backward moments of a marked trace: the moments of the inter-arrival time that PRECEDES an event of each class, B(c,k) = (1/N) sum_{i: A_i = c} T_i^k, normalized by N/count_c when norm is set, so that M_k = sum_c B(c,k) p_c.

Parameters
Tvinter-arrival times
Aclass labels
ordersmoment orders
normnormalize by N/count_c (the MATLAB default)

Definition at line 59 of file mtrace_backward_moment.h.

References mtrace_backward_moment(), and mtrace_moment().

Referenced by line::mam::mamap22_fit_gamma_bs_trace(), line::mam::mamap2m_fit_gamma_fb_trace(), line::mam::mamap2m_fit_trace(), line::mam::maph2m_fit_trace(), mtrace_backward_moment(), and mtrace_summary().

◆ mtrace_bootstrap()

template<class T>
MtraceBootstrapResult< T > line::trace::mtrace_bootstrap ( const std::vector< T > & Tv,
const std::vector< int > & A,
pfqn::McRng & rng,
std::size_t resamples = 1000,
double alpha = 0.05,
std::size_t blockLen = 50 )

Block-bootstrap confidence intervals for the descriptors of a marked trace.

Parameters
Tvinter-arrival times
Aclass labels, one per arrival
rnggenerator, advanced by the call
resamplesnumber of bootstrap replicates; the reference default is 1000
alphatwo-sided level; 0.05 gives a 95% interval
blockLentarget block length; the reference uses 50

Definition at line 137 of file mtrace_bootstrap.h.

References line::trace::MtraceBootstrapResult< T >::blocks, line::trace::MtraceBootstrapResult< T >::estimate, line::InputError::InputError(), line::trace::MtraceBootstrapResult< T >::lower, line::pfqn::mc_uniform01(), mtrace_bootstrap(), line::sim::sim_normcdf(), line::sim::sim_norminv(), and line::trace::MtraceBootstrapResult< T >::upper.

Referenced by mtrace_bootstrap().

◆ mtrace_count()

template<class T>
MtraceCountResult< T > line::trace::mtrace_count ( const std::vector< T > & Tv,
const std::vector< int > & A,
const T & t )

Per-class count process of a marked trace on a fixed resolution: the number of events of each class in the successive windows of length t that start at the first arrival epoch.

Parameters
Tvinter-arrival times
Aclass labels
twindow length (the resolution)

Definition at line 65 of file mtrace_count.h.

References line::trace::MtraceCountResult< T >::counts, line::InputError::InputError(), line::trace::MtraceCountResult< T >::labels, and mtrace_count().

Referenced by mtrace_count().

◆ mtrace_cov()

template<class T>
std::vector< std::vector< Matrix< T > > > line::trace::mtrace_cov ( const std::vector< T > & Tv,
const std::vector< int > & A )

Class-pair covariance matrices of a marked trace.

Parameters
Tvinter-arrival times
Aclass labels, positive
Returns
cov[c1-1][c2-1], each a 2x2 matrix

Definition at line 48 of file mtrace_cov.h.

References line::InputError::InputError(), and mtrace_cov().

Referenced by mtrace_cov().

◆ mtrace_cross_moment()

template<class T>
MtraceCrossMomentResult< T > line::trace::mtrace_cross_moment ( const std::vector< T > & Tv,
const std::vector< int > & L,
unsigned k )

Class-pair cross moments of a marked trace: the k-th moment of the interval that separates an event of class i from the next event, of class j, MC(i,j) = mean{ T_t^k : A_{t-1} = i, A_t = j }.

Parameters
Tvinter-arrival times
Lclass labels
kmoment order

Definition at line 56 of file mtrace_cross_moment.h.

References line::trace::MtraceCrossMomentResult< T >::count, line::Matrix< T >::Matrix(), line::trace::MtraceCrossMomentResult< T >::mc, mtrace_cross_moment(), and line::num_pow_int().

Referenced by line::mam::mmap_mixture_fit_trace(), mtrace_cross_moment(), mtrace_moment_simple(), and mtrace_summary().

◆ mtrace_forward_moment()

template<class T>
Matrix< T > line::trace::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 each class, F(c,k) = (1/(N-1)) sum_{i<N: A_i = c} T_{i+1}^k, normalized by N/count_c when norm is set, so that M_k = sum_c F(c,k) p_c.

Parameters
Tvinter-arrival times
Aclass labels
ordersmoment orders
normnormalize by N/count_c (the MATLAB default)

Definition at line 53 of file mtrace_forward_moment.h.

References mtrace_forward_moment(), and mtrace_moment().

Referenced by line::mam::mamap22_fit_gamma_fs_trace(), line::mam::mamap2m_fit_gamma_fb_trace(), line::mam::mamap2m_fit_trace(), mtrace_forward_moment(), and mtrace_summary().

◆ mtrace_iat2counts()

template<class T>
MtraceCountsResult< T > line::trace::mtrace_iat2counts ( const std::vector< T > & Tv,
const std::vector< int > & A,
const T & scale )

Per-class counting processes of a marked trace: for each arrival, how many events of each class fall in the window of length scale that starts at that arrival.

Parameters
Tvinter-arrival times
Aclass labels
scalewindow length

Definition at line 69 of file mtrace_iat2counts.h.

References line::trace::MtraceCountsResult< T >::counts, line::InputError::InputError(), line::trace::MtraceCountsResult< T >::labels, and mtrace_iat2counts().

Referenced by line::mam::m3pp2m_fitc_trace(), line::mam::m3pp_superpos_fitc_trace(), and mtrace_iat2counts().

◆ mtrace_joint()

template<class T>
MtraceJointResult< T > line::trace::mtrace_joint ( const std::vector< T > & Tv,
const std::vector< int > & A,
unsigned i1,
unsigned i2 )

Class-dependent joint moments of a marked trace, JM(a) = (1/N_a) sum_{j : A_{j+1} = a} T_j^{i1} T_{j+1}^{i2}, the empirical estimate of E[(X_j)^{i1} (X_{j+1})^{i2}] conditioned on the middle event being of class a; the sum runs over the interior events, so the first and last event of the trace are excluded.

Parameters
Tvinter-event times
Aclass labels, positive
i1exponent of the first interval
i2exponent of the second interval

Definition at line 61 of file mtrace_joint.h.

References line::trace::MtraceJointResult< T >::count, line::InputError::InputError(), line::trace::MtraceJointResult< T >::jm, mtrace_joint(), and line::num_pow_int().

Referenced by mtrace_joint().

◆ mtrace_mean()

template<class T>
MtraceMeanResult< T > line::trace::mtrace_mean ( const std::vector< T > & Tv,
long ntypes,
const std::vector< int > & type )

Per-type sample mean of a trace.

Parameters
Tvthe trace
ntypesnumber of types
typetype of each sample, in 0..ntypes-1

Definition at line 50 of file mtrace_mean.h.

References line::trace::MtraceMeanResult< T >::count, line::InputError::InputError(), line::trace::MtraceMeanResult< T >::mean, and mtrace_mean().

Referenced by mtrace_mean().

◆ mtrace_merge()

template<class T>
MtraceMergeResult< T > line::trace::mtrace_merge ( const std::vector< T > & t1,
const std::vector< T > & t2 )

Superposes two single-class traces into one marked trace, labelling the events of the first stream 1 and those of the second 2.

Parameters
t1inter-arrival times of the first trace
t2inter-arrival times of the second trace

Definition at line 53 of file mtrace_merge.h.

References line::InputError::InputError(), line::trace::MtraceMergeResult< T >::labels, mtrace_merge(), and line::trace::MtraceMergeResult< T >::times.

Referenced by mtrace_merge().

◆ mtrace_moment()

template<class T>
Matrix< T > line::trace::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.

Parameters
Tvinter-arrival times
Aclass labels
ordersmoment orders
afterfalse for Horvath variables, true for Buchholz variables
normtrue to normalize by N/count_c
Returns
(C x |orders|) matrix, row c for the c-th smallest label

Definition at line 65 of file mtrace_moment.h.

References line::InputError::InputError(), mtrace_moment(), and line::num_pow_int().

Referenced by mtrace_backward_moment(), mtrace_forward_moment(), and mtrace_moment().

◆ mtrace_moment_simple()

template<class T>
MtraceCrossMomentResult< T > line::trace::mtrace_moment_simple ( const std::vector< T > & Tv,
const std::vector< int > & L,
unsigned k )
See also
mtrace_cross_moment

Definition at line 36 of file mtrace_moment_simple.h.

References mtrace_cross_moment(), and mtrace_moment_simple().

Referenced by mtrace_moment_simple().

◆ mtrace_pc()

template<class T>
std::vector< T > line::trace::mtrace_pc ( const std::vector< int > & A)

Class probabilities of a marked trace, p_c = count_c / N.

Templated port of matlab/lib/m3a/m3a/mtrace/mtrace_pc.m, cross-checked against jar/src/main/java/jline/api/trace/Mtrace_pc.java (identical).

Parameters
Aclass labels;
Returns
one probability per label of unique(A).

Definition at line 42 of file mtrace_pc.h.

References line::InputError::InputError(), and mtrace_pc().

Referenced by line::mam::mamap22_fit_gamma_bs_trace(), line::mam::mamap22_fit_gamma_fs_trace(), line::mam::mamap2m_fit_gamma_fb_trace(), line::mam::mamap2m_fit_trace(), line::mam::maph2m_fit_trace(), mtrace_pc(), and mtrace_summary().

◆ mtrace_sigma()

template<class T>
Matrix< T > line::trace::mtrace_sigma ( const std::vector< int > & L)

One-step class transition frequencies of a marked trace, sigma(i,j) = #{t : A_t = i, A_{t+1} = j} / (N-1).

Parameters
Lclass labels;
Returns
(C x C) matrix over the labels of unique(L).

Definition at line 42 of file mtrace_sigma.h.

References line::InputError::InputError(), and mtrace_sigma().

Referenced by line::mam::mamap22_fit_gamma_bs_trace(), line::mam::mamap22_fit_gamma_fs_trace(), line::mam::mamap2m_fit_trace(), mtrace_sigma(), and mtrace_summary().

◆ mtrace_sigma2()

template<class T>
Matrix< T > line::trace::mtrace_sigma2 ( const std::vector< int > & L)

Two-step class transition frequencies of a marked trace, sigma(i,j,h) = #{t : A_t = i, A_{t+1} = j, A_{t+2} = h} / (N-2).

Parameters
Lclass labels;
Returns
(C x C*C) matrix, entry (i, j*C+h).

Definition at line 43 of file mtrace_sigma2.h.

References line::InputError::InputError(), and mtrace_sigma2().

Referenced by line::mam::mmap_mixture_fit_trace(), and mtrace_sigma2().

◆ mtrace_split()

template<class T>
MtraceSplitResult< T > line::trace::mtrace_split ( const std::vector< T > & Tv,
const std::vector< int > & L )

Splits a marked trace into its per-class traces: for each class, the inter-arrival times BETWEEN CONSECUTIVE EVENTS OF THAT CLASS, with the first interval measured from the origin.

Parameters
Tvinter-arrival times of the marked process
Lclass labels

Definition at line 52 of file mtrace_split.h.

References line::trace::MtraceSplitResult< T >::labels, mtrace_split(), and line::trace::MtraceSplitResult< T >::traces.

Referenced by mtrace_split().

◆ mtrace_summary()

template<class T>
MtraceSummary< T > line::trace::mtrace_summary ( const std::vector< T > & Tv,
const std::vector< int > & A,
int max_lag = 100 )

Descriptor set of a marked trace: the first five raw moments of the inter-arrival times, the autocorrelation function, the first two forward and backward moments, the first two class-pair cross moments, the class probabilities and the one-step class transition frequencies.

Parameters
Tvinter-arrival times
Aclass labels
max_laglargest acf lag (100 in both references)

Definition at line 73 of file mtrace_summary.h.

References line::trace::MtraceSummary< T >::acf, line::trace::MtraceSummary< T >::B1, line::trace::MtraceSummary< T >::B2, line::trace::MtraceSummary< T >::C1, line::trace::MtraceSummary< T >::C2, line::trace::MtraceSummary< T >::F1, line::trace::MtraceSummary< T >::F2, line::trace::MtraceSummary< T >::M, mtrace_backward_moment(), mtrace_cross_moment(), mtrace_forward_moment(), mtrace_pc(), mtrace_sigma(), mtrace_summary(), line::num_pow_int(), line::trace::MtraceSummary< T >::Pab, line::trace::MtraceSummary< T >::Pc, and trace_acf().

Referenced by mtrace_summary().

◆ mtrace_var()

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.

Parameters
tvthe trace values
ntypesnumber of classes
types0-based class label of each value
Returns
(ntypes) per-class variance, NaN where a class has under two

Definition at line 47 of file mtrace_var.h.

References line::InputError::InputError(), and mtrace_var().

Referenced by mtrace_var().

◆ trace_acf() [1/2]

template<class T>
std::vector< T > line::trace::trace_acf ( const std::vector< T > & S)

Lag-1 autocorrelation, the MATLAB and JAR default.

Definition at line 76 of file trace_acf.h.

References trace_acf().

◆ trace_acf() [2/2]

template<class T>
std::vector< T > line::trace::trace_acf ( const std::vector< T > & S,
const std::vector< int > & lags )

Autocorrelation coefficients of a trace at the requested lags.

Parameters
Sthe trace
lagsthe lags to evaluate; entries outside (0, n-2] are dropped
Returns
one coefficient per surviving lag, in the order given

Definition at line 57 of file trace_acf.h.

References autocov(), line::NumericError::NumericError(), and trace_acf().

Referenced by mtrace_summary(), trace_acf(), trace_acf(), trace_gamma(), and trace_summary().

◆ trace_bicov()

template<class T>
TraceBicovResult< T > line::trace::trace_bicov ( const std::vector< T > & S,
const std::vector< int > & grid )

Bicovariance of a trace on a lag grid.

Parameters
Sthe trace
gridthe lag values swept in both positions

Definition at line 50 of file trace_bicov.h.

References line::trace::TraceBicovResult< T >::bicov, line::trace::TraceBicovResult< T >::lags, trace_bicov(), and trace_joint().

Referenced by trace_bicov().

◆ trace_gamma()

template<class T>
TraceGammaResult< T > line::trace::trace_gamma ( const std::vector< T > & S,
long limit = 1000,
const std::vector< T > & grid = std::vector<T>() )

Autocorrelation decay rate of a trace: the gamma of the geometric model rho(k) = rho0 * gamma^k, with rho0 = (1 - 1/scv)/2 fixed by the second moment and gamma fitted by least squares on the empirical acf.

Parameters
Sthe trace
limitlargest lag considered (the JAR default is 1000)
gridcandidate decay rates; the JAR grid 0.990..0.999 by default

Definition at line 73 of file trace_gamma.h.

References line::trace::TraceGammaResult< T >::gamma, line::InputError::InputError(), line::num_pow_int(), line::NumericError::NumericError(), line::trace::TraceGammaResult< T >::residuals, line::trace::TraceGammaResult< T >::rho0, trace_acf(), trace_gamma(), and trace_scv().

Referenced by line::mam::amap2_fit_gamma_trace(), line::mam::mamap22_fit_gamma_bs_trace(), line::mam::mamap22_fit_gamma_fs_trace(), line::mam::mamap2m_fit_gamma_fb_trace(), line::mam::mamap2m_fit_trace(), and trace_gamma().

◆ trace_iat2bins()

template<class T>
TraceBinsResult line::trace::trace_iat2bins ( const std::vector< T > & S,
const T & scale )

Bins a trace on a fixed time grid: the number of arrivals falling in each interval ((i-1)*scale, i*scale], and the bin index of each arrival.

Parameters
Sinter-arrival times
scalebin width

Definition at line 53 of file trace_iat2bins.h.

References line::trace::TraceBinsResult::counts, line::InputError::InputError(), line::trace::TraceBinsResult::membership, and trace_iat2bins().

Referenced by trace_iat2bins().

◆ trace_iat2counts()

template<class T>
std::vector< long > line::trace::trace_iat2counts ( const std::vector< T > & S,
const T & scale )

Counting process of a trace: the number of arrivals in the window of length scale that starts at each arrival epoch.

Parameters
Sinter-arrival times
scalewindow length
Returns
counts, one per arrival, truncated at the first censored window

Definition at line 51 of file trace_iat2counts.h.

References line::InputError::InputError(), and trace_iat2counts().

Referenced by trace_iat2counts().

◆ trace_idc()

template<class T>
T line::trace::trace_idc ( const std::vector< T > & S)

Index of dispersion for counts, estimated by its asymptotic equality with the index of dispersion for intervals at a large aggregation level.

Parameters
Sthe trace; the aggregation level is min(1000, ceil(n/30)).

Definition at line 44 of file trace_idc.h.

References line::trace::TraceIdiResult< T >::idi, trace_idc(), and trace_idi().

Referenced by trace_idc(), and trace_summary().

◆ trace_idi()

template<class T>
TraceIdiResult< T > line::trace::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 + ... + S_{t+k-1})^2, the standard burstiness descriptor of Sriram and Whitt (JSAC 6, 1986).

Parameters
k_setaggregation levels
aggregate_n0 for raw samples; n > 0 when S is already the sum of n inter-arrivals, which uses k/n windows (MATLAB's 'aggregate' option)
drop_trailing_zerotrue removes the spurious zero sample described above; false (default) reproduces the references
Sthe interarrival-time trace

Definition at line 71 of file trace_idi.h.

References line::trace::TraceIdiResult< T >::idi, line::InputError::InputError(), line::NumericError::NumericError(), line::trace::TraceIdiResult< T >::support, trace_idi(), trace_mean(), and trace_var().

Referenced by trace_idc(), and trace_idi().

◆ trace_joint()

template<class T>
T line::trace::trace_joint ( const std::vector< T > & S,
const std::vector< int > & lag,
const std::vector< unsigned > & order )

Joint moments of a trace, E[X_i^{k_1} X_{i+l_2}^{k_2} ...].

Parameters
Sthe trace
laglag increments; cumulated and shifted to start at 0
orderthe exponent of each factor, same length as lag

Definition at line 53 of file trace_joint.h.

References line::InputError::InputError(), line::num_pow_int(), and trace_joint().

Referenced by trace_bicov(), and trace_joint().

◆ trace_mean()

template<class T>
T line::trace::trace_mean ( const std::vector< T > & S)

(1/n) sum_i S(i).

Definition at line 31 of file trace_mean.h.

References trace_mean().

Referenced by autocov(), trace_idi(), trace_mean(), trace_scv(), trace_skew(), trace_summary(), and trace_var().

◆ trace_pmf()

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).

Parameters
Xthe discrete trace.

Definition at line 54 of file trace_pmf.h.

References line::InputError::InputError(), line::trace::TracePmfResult< T >::pmf, trace_pmf(), and line::trace::TracePmfResult< T >::values.

Referenced by trace_pmf().

◆ trace_scv()

template<class T>
T line::trace::trace_scv ( const std::vector< T > & S,
bool unbiased = true )

Squared coefficient of variation of a trace, var/mean^2.

Parameters
Sthe trace
unbiasedvariance denominator, see trace_var

Definition at line 39 of file trace_scv.h.

References line::NumericError::NumericError(), trace_mean(), trace_scv(), and trace_var().

Referenced by trace_gamma(), trace_scv(), and trace_summary().

◆ trace_shuffle()

template<class T, class Gen>
std::vector< T > line::trace::trace_shuffle ( const std::vector< T > & S,
Gen & gen )

A uniformly random permutation of the samples, drawn with the given engine.

Definition at line 36 of file trace_shuffle.h.

References line::InputError::InputError(), and trace_shuffle().

Referenced by trace_shuffle().

◆ trace_skew()

template<class T>
T line::trace::trace_skew ( const std::vector< T > & S)

Bias-corrected sample skewness (MATLAB's skewness(S,0), equivalently the G1 estimator).

Parameters
Sthe trace, at least 3 samples.

Definition at line 48 of file trace_skew.h.

References line::InputError::InputError(), line::NumericError::NumericError(), trace_mean(), and trace_skew().

Referenced by trace_skew(), and trace_summary().

◆ trace_summary()

◆ trace_var()

template<class T>
T line::trace::trace_var ( const std::vector< T > & S,
bool unbiased = true )

Sample variance of a trace.

Parameters
Sthe trace
unbiasedtrue for the n-1 denominator (MATLAB var), false for the n denominator (the JAR, and the lag-0 autocovariance)

Definition at line 45 of file trace_var.h.

References line::InputError::InputError(), trace_mean(), and trace_var().

Referenced by trace_idi(), trace_scv(), trace_summary(), and trace_var().