LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
moment_raw_from_factorial.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012-2026, QORE Lab, Imperial College London
3
* All rights reserved.
4
*/
5
#ifndef LINE_API_MOMENT_MOMENT_RAW_FROM_FACTORIAL_H
6
#define LINE_API_MOMENT_MOMENT_RAW_FROM_FACTORIAL_H
7
8
/**
9
* @file
10
* @ingroup api_moment
11
* Raw moments from factorial moments, via the Stirling table of the second kind.
12
*
13
* Templated port of matlab/src/api/moment/moment_raw_from_factorial.m. Every operation is integer
14
* or rational, so the exact instantiation returns the transform with no
15
* rounding at all. That matters more here than almost anywhere else in the API:
16
* the alternating binomial sums of the moment conversions cancel
17
* catastrophically in double arithmetic once the order grows.
18
*/
19
20
#include <vector>
21
22
#include "
line/num/number.h
"
23
#include "
line/util/error.h
"
24
#include "
line/util/matrix.h
"
25
#include "
line/util/population.h
"
26
#include "
line/api/moment/moment_apply.h
"
27
#include "
line/api/moment/moment_stirling2.h
"
28
29
namespace
line
{
30
namespace
moment
{
31
32
/** m = S * f. */
33
template
<
class
T>
34
std::vector<T>
moment_raw_from_factorial
(
const
std::vector<T>& f) {
35
return
apply_table
(
moment_stirling2<T>
(
static_cast<
int
>
(f.size()) - 1), f);
36
}
37
38
}
// namespace moment
39
}
// namespace line
40
41
#endif
error.h
The exception types the port throws.
matrix.h
Dense matrix and non-owning view.
moment_apply.h
Shared helper applying a triangular moment-transform table.
moment_stirling2.h
Stirling numbers of the second kind.
line::moment
Definition
moment_apply.h:28
line::moment::apply_table
std::vector< T > apply_table(const Matrix< T > &A, const std::vector< T > &v)
Apply a lower-triangular transform table to a moment vector.
Definition
moment_apply.h:32
line::moment::moment_raw_from_factorial
std::vector< T > moment_raw_from_factorial(const std::vector< T > &f)
m = S * f.
Definition
moment_raw_from_factorial.h:34
line::moment::moment_stirling2
Matrix< T > moment_stirling2(int n)
S(i,j) = j S(i-1,j) + S(i-1,j-1), S(0,0) = 1.
Definition
moment_stirling2.h:31
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
population.h
Population-vector enumeration and combinatorics.
include
line
api
moment
moment_raw_from_factorial.h
Generated by
1.18.0