LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
mamap_marked_poisson.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_MAM_MAMAP_MARKED_POISSON_H
6#define LINE_API_MAM_MAMAP_MARKED_POISSON_H
7
8/**
9 * @file
10 * @ingroup api_mam
11 * The marked Poisson process every MAMAP fitter falls back to.
12 *
13 * Its own header only to break an include cycle: `mamap2m_fit.h` dispatches to
14 * the sigma fitters in `mamap22_fit_fs.h` and `mamap22_fit_bs.h`, and those in
15 * turn need this fallback. Keeping it here lets the dispatcher include the
16 * fitters without the fitters including the dispatcher.
17 *
18 * A one-phase process carries no autocorrelation and no moment beyond the mean,
19 * so this is what a fitter returns when the AMAP(2) has collapsed: the class
20 * probabilities are the only descriptors left to honour.
21 */
22
23#include <cstddef>
24#include <vector>
25
27#include "line/num/number.h"
28#include "line/util/matrix.h"
29
30namespace line {
31namespace mam {
32namespace mamapdetail {
33
34/** A marked Poisson process of the given mean and class law. */
35template <class T>
36Mmap<T> marked_poisson(const T& mean, const std::vector<T>& p) {
37 const T one = num_traits<T>::from_int(1);
38 Mmap<T> m;
39 m.D0 = Matrix<T>(1, 1, T(-one / mean));
40 m.D1 = Matrix<T>(1, 1, T(one / mean));
41 m.Dc.assign(p.size(), Matrix<T>(1, 1, num_traits<T>::from_int(0)));
42 for (std::size_t c = 0; c < p.size(); ++c) m.Dc[c](0, 0) = T(m.D1(0, 0) * p[c]);
43 return m;
44}
45
46} // namespace mamapdetail
47} // namespace mam
48} // namespace line
49
50#endif // LINE_API_MAM_MAMAP_MARKED_POISSON_H
Dense matrix and non-owning view.
Marked MAP (MMAP) algebra: per-class rates, class probabilities, superposition, normalization and sca...
Number-type abstraction for the templated API port.