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

Binomial transform with alternating signs. More...

#include <vector>
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
#include "line/util/population.h"
Include dependency graph for moment_binotrans.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::moment

Functions

template<class T>
std::vector< T > line::moment::moment_binotrans (const std::vector< T > &x)
 y_i = sum_k (-1)^(i-k) C(i,k) x_k.

Detailed Description

Binomial transform with alternating signs.

Templated port of matlab/src/api/moment/moment_binotrans.m.

Applied to a moment sequence m_i = E[X^i] it returns the moments of the unit DOWNSHIFT, y_i = E[(X-1)^i]. It is NOT an involution – an easy thing to assume from the alternating signs, and wrong: its inverse is moment_binotransinv, the unsigned transform.

Every operation is integer or rational, so the exact instantiation returns the transform with no rounding at all. That matters more here than almost anywhere else in the API: the alternating binomial sums of the moment conversions cancel catastrophically in double arithmetic once the order grows.

Definition in file moment_binotrans.h.