LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
aph_convseq.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_APH_CONVSEQ_H
6
#define LINE_API_MAM_APH_CONVSEQ_H
7
8
/**
9
* @file
10
* @ingroup api_mam
11
* Convolution of a sequence of matrix-exponential laws.
12
*
13
* Port of `matlab/lib/kpctoolbox/aph/aph_convseq.m`: fold `aph_simplify` with
14
* the sequence pattern over the list, left to right. The reference takes a flat
15
* cell array of alternating alpha and T entries and special-cases a list of one
16
* pair by returning it unchanged; here the list is a vector of pairs, so the
17
* one-element case falls out of the fold and needs no arm of its own.
18
*
19
* The composite order is the SUM of the orders, so a long activity sequence of
20
* high-order fits produces a large generator. That is the reference's cost too
21
* -- neither it nor this reduces the representation -- and it is why the LN
22
* caller fits each term to a low-order APH before convolving.
23
*/
24
25
#include <cstddef>
26
#include <vector>
27
28
#include "
line/api/mam/aph_simplify.h
"
29
#include "
line/num/number.h
"
30
#include "
line/util/error.h
"
31
32
namespace
line
{
33
namespace
mam
{
34
35
/** Convolve the sequence, i.e. the law of the sum of independent terms. */
36
template
<
class
T>
37
AphPair<T>
aph_convseq
(
const
std::vector<
AphPair<T>
>& seq) {
38
if
(seq.empty())
throw
InputError
(
"aph_convseq: the sequence is empty"
);
39
const
T one =
num_traits<T>::from_int
(1);
40
AphPair<T>
acc = seq[0];
41
for
(std::size_t i = 1; i < seq.size(); ++i)
42
acc =
aph_simplify
(acc, seq[i], one, one,
AphPattern::Sequence
);
43
return
acc;
44
}
45
46
}
// namespace mam
47
}
// namespace line
48
49
#endif
// LINE_API_MAM_APH_CONVSEQ_H
aph_simplify.h
Composition of two matrix-exponential distributions given in (alpha, T) form.
line::InputError::InputError
InputError(const std::string &what)
Definition
error.h:39
error.h
The exception types the port throws.
line::mam
Definition
amap2_adjust_gamma.h:78
line::mam::aph_convseq
AphPair< T > aph_convseq(const std::vector< AphPair< T > > &seq)
Convolve the sequence, i.e.
Definition
aph_convseq.h:37
line::mam::aph_simplify
AphPair< T > aph_simplify(const AphPair< T > &d1, const AphPair< T > &d2, const T &p1, const T &p2, AphPattern pattern)
Compose two matrix-exponential laws, as aph_simplify.m does.
Definition
aph_simplify.h:89
line::mam::AphPattern::Sequence
@ Sequence
Definition
aph_simplify.h:54
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
line::mam::AphPair
A matrix-exponential law in (alpha, S) form: initial vector and subgenerator.
Definition
aph_simplify.h:46
line::num_traits
Definition
number.h:111
include
line
api
mam
aph_convseq.h
Generated by
1.18.0