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

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

#include <algorithm>
#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_joint.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::trace

Functions

template<class 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} ...].

Detailed Description

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

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

The lag argument is a vector of INCREMENTS: MATLAB forms lag = sort(cumsum(lag)) and then shifts it so that its first entry is 0, so trace_bicov's [1,i,j] means the triple (X_t, X_{t+i}, X_{t+i+j}).

REFERENCE DEFECT (JAR): Trace_var.trace_joint sorts the lag vector but never takes the cumulative sum, and then indexes it with adjustedLag[min(j, adjustedLag.length-1)], which also silently reuses the last lag when order is longer than lag. It therefore computes a different joint moment from MATLAB for every lag vector that is not already cumulative – including the [1,i,j] grid that Trace_var.trace_bicov feeds it, so the JAR bicovariance is wrong wherever i or j differs from 1. MATLAB is the reference and is what this port implements; a lag and order of different lengths is rejected instead of being padded.

ARITHMETIC: products of integer powers of the samples and one division, exact in Rational.

Definition in file trace_joint.h.