LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
moment_upfactorial_from_negbinomial.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_UPFACTORIAL_FROM_NEGBINOMIAL_H
6
#define LINE_API_MOMENT_MOMENT_UPFACTORIAL_FROM_NEGBINOMIAL_H
7
8
/**
9
* @file
10
* @ingroup api_moment
11
* Rising-factorial moments from negative-binomial moments.
12
*
13
* Templated port of matlab/src/api/moment/moment_upfactorial_from_negbinomial.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
27
namespace
line
{
28
namespace
moment
{
29
30
/** fp_i = i! bm_i. */
31
template
<
class
T>
32
std::vector<T>
moment_upfactorial_from_negbinomial
(
const
std::vector<T>& bm) {
33
std::vector<T> fp(bm.size());
34
for
(std::size_t i = 0; i < bm.size(); ++i)
35
fp[i] =
num_factorial<T>
(
static_cast<
unsigned
>
(i)) * bm[i];
36
return
fp;
37
}
38
39
}
// namespace moment
40
}
// namespace line
41
42
#endif
error.h
The exception types the port throws.
matrix.h
Dense matrix and non-owning view.
line::moment
Definition
moment_apply.h:28
line::moment::moment_upfactorial_from_negbinomial
std::vector< T > moment_upfactorial_from_negbinomial(const std::vector< T > &bm)
fp_i = i!
Definition
moment_upfactorial_from_negbinomial.h:32
line
Definition
aoi_dist2ph.h:52
line::num_factorial
T num_factorial(unsigned n)
Factorial as a value of T.
Definition
number.h:184
number.h
Number-type abstraction for the templated API port.
population.h
Population-vector enumeration and combinatorics.
include
line
api
moment
moment_upfactorial_from_negbinomial.h
Generated by
1.18.0