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

Linearized index of a per-class population vector, for Limited Joint Dependence (LJD) tables. More...

#include <cstddef>
#include <vector>
#include "line/util/error.h"
Include dependency graph for ljd_linearize.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::fes

Functions

std::size_t line::fes::ljd_linearize (const std::vector< int > &nvec, const std::vector< int > &cutoffs)
 Linearized index of a per-class population vector, for Limited Joint Dependence (LJD) tables.
std::vector< int > line::fes::ljd_delinearize (std::size_t idx, const std::vector< int > &cutoffs)
 Inverse of ljd_linearize: the population vector behind an index.

Detailed Description

Linearized index of a per-class population vector, for Limited Joint Dependence (LJD) tables.

Port of matlab/src/api/ljd/ljd_linearize.m,

idx = 1 + n1 + n2 (N1+1) + n3 (N1+1)(N2+1) + ...

with every n_k clamped to its cutoff N_k. The result is 1-BASED, exactly as in MATLAB, because the FES scaling tables it addresses are transcribed from MATLAB indices; the callers in this port subtract one when they index a std::vector. It is otherwise the mixed-radix index of line/util/population.h (pop_index over plane_sizes), with the clamp added.

The header lives under api/fes because the FES functions are its only consumers in this port; when the ljd domain itself is ported it should move to api/ljd unchanged.

Definition in file ljd_linearize.h.