LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
mmapph1fcfs.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_MMAPPH1FCFS_H
6#define LINE_API_MAM_MMAPPH1FCFS_H
7
8/**
9 * @file
10 * @ingroup api_mam
11 * The MMAP[K]/PH[K]/1 FCFS queue: per-class mean number in system and per-class
12 * queue-length distribution.
13 *
14 * This is the workhorse `solver_mam_basic.m` calls at every FCFS station, where
15 * MATLAB reaches BUTools' `MMAPPH1FCFS`. The algorithm is He's age process for
16 * the SM[K]/PH[K]/1/FCFS queue (Qiming He, "Analysis of a continuous time
17 * SM[K]/PH[K]/1/FCFS queue: age process, sojourn times, and queue lengths",
18 * Journal of Systems Science and Complexity 25(1), 133-155, 2012), which is the
19 * algorithm BUTools implements and which is what makes the two agree.
20 *
21 * WHY THE AGE PROCESS AND NOT A QBD. A level-independent QBD over (number in
22 * system, arrival phase, in-service phase) is NOT Markovian here: under FCFS
23 * with class-dependent service, the law of the next service depends on the
24 * class of the job at the head of the queue, so the phase would have to carry
25 * the whole waiting sequence of classes. `qsys_mapmap1.h` gets away with a QBD
26 * precisely because it has one class. He's construction sidesteps this by
27 * tracking the AGE of the job in service against the arrival process, which
28 * closes as a fluid queue whose first-return matrix Psi is exactly what
29 * `mfq_fundamental` computes.
30 *
31 * THE PIECES, and where each comes from in this port:
32 * Psi -- the fluid first-return matrix of the age process, ADDA doubling
33 * (`mfq_solve.h`), the same routine BUTools reaches through
34 * FluidFundamentalMatrices(..., 'P').
35 * T -- kron(I_N, Sa) + Psi iVec, the age generator.
36 * pi0 -- the age density at zero, a linear functional of the arrival
37 * stationary vector `theta` (`ctmc_solve`) and the per-class
38 * equilibrium service vectors `beta` (also `ctmc_solve`).
39 * the queue-length recursion -- a chain of Sylvester equations
40 * T X + X kron(D0+Da-Dk, I_Ns) + C = 0 that all share their left and
41 * right coefficient matrices, so `SylvesterFactor` factors them
42 * once and reuses the factorization (`util/sylvester.h`): by real
43 * Schur at double, by the Kronecker operator otherwise.
44 *
45 * ARITHMETIC. `mfq_fundamental` runs a tolerance-terminated doubling iteration
46 * and is gated on `num_traits<T>::has_transcendental`, so this function is
47 * {Double, Real} and refuses by name under exact/Rational. Everything else in
48 * it -- the Kronecker assembly, the linear solves, the Sylvester chain -- is
49 * field arithmetic and would be exact; the Riccati root is what is not.
50 *
51 * MEASURED AGAINST MATLAB'S BUTools MMAPPH1FCFS: see cpp/tests/test_mam.cpp,
52 * which pins both entry points on a two-class MMAP/PH/1 fixture.
53 */
54
55#include <cstddef>
56#include <vector>
57
61#include "line/num/number.h"
62#include "line/util/error.h"
63#include "line/util/linalg.h"
64#include "line/util/matrix.h"
65#include "line/util/sylvester.h"
66
67namespace line {
68namespace mam {
69
70/** One class's phase-type service law, He's (sigma_k, S_k). */
71template <class T>
72struct PhService {
73 std::vector<T> sigma; ///< initial probability row vector
74 Matrix<T> S; ///< transient generator
75};
76
77namespace mmapph1_detail {
78
79/**
80 * Everything the two entry points share: the age generator T, its density at
81 * zero pi0, the per-class block layout of the stacked service generator, and
82 * the aggregate load rho.
83 */
84template <class T>
85struct AgeProcess {
86 Matrix<T> T_; ///< age generator, (N*Ns) x (N*Ns)
87 std::vector<T> pi0; ///< age density at zero, length N*Ns
88 Matrix<T> D0, Da; ///< arrival D0 and the summed arrival matrix
89 std::vector<Matrix<T>> Dk; ///< per-class arrival matrices
90 std::vector<std::size_t> Nsk; ///< per-class service order
91 std::size_t N = 0, Ns = 0; ///< arrival order, total service order
92 T rho = num_traits<T>::from_int(0);
93};
94
95/** Block-diagonal stacking of the per-class service generators. */
96template <class T>
97Matrix<T> blkdiag(const std::vector<PhService<T>>& svc, std::size_t Ns) {
98 const T zero = num_traits<T>::from_int(0);
99 Matrix<T> Sa(Ns, Ns, zero);
100 std::size_t off = 0;
101 for (const PhService<T>& s : svc) {
102 for (std::size_t i = 0; i < s.S.rows(); ++i)
103 for (std::size_t j = 0; j < s.S.cols(); ++j) Sa(off + i, off + j) = s.S(i, j);
104 off += s.S.rows();
105 }
106 return Sa;
107}
108
109/**
110 * Equilibrium (stationary) vector of the PH renewal chain, MATLAB's
111 * `CTMCSolve(S - sum(S,2) sigma)`.
112 *
113 * THE SIGN IS THE WHOLE FUNCTION. `sum(S,2)` is the ROW SUM of a subgenerator,
114 * so it is the NEGATIVE exit rate, and the generator of the renewal chain is
115 * `S - rowsum sigma` = `S + exitrate sigma`. Adding the row sum instead builds a
116 * matrix that is not a generator at all: on an Erlang-2 it gives
117 * [[-6 6],[-6 -6]], whose "stationary" vector makes the mean service rate
118 * non-positive downstream, and every Sylvester system built on it is singular.
119 */
120template <class T>
121std::vector<T> ph_equilibrium(const PhService<T>& s) {
122 const T zero = num_traits<T>::from_int(0);
123 const std::size_t n = s.S.rows();
124 Matrix<T> G(n, n, zero);
125 for (std::size_t i = 0; i < n; ++i) {
126 T rowsum = zero;
127 for (std::size_t j = 0; j < n; ++j) rowsum += s.S(i, j);
128 for (std::size_t j = 0; j < n; ++j) G(i, j) = s.S(i, j) - rowsum * s.sigma[j];
129 }
130 return mc::ctmc_solve(G);
131}
132
133/** Build the shared age process. */
134template <class T>
135AgeProcess<T> build(const Mmap<T>& arrival, const std::vector<PhService<T>>& svc) {
136 static_assert(num_traits<T>::has_transcendental,
137 "mmapph1fcfs runs the ADDA doubling iteration of mfq_fundamental");
138 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
139 const std::size_t K = svc.size();
140 if (arrival.classes() != K)
141 throw InputError("mmapph1fcfs: the arrival MMAP and the service list disagree on the "
142 "number of classes");
143 AgeProcess<T> a;
144 a.N = arrival.order();
145 a.D0 = arrival.D0;
146 a.Dk = arrival.Dc;
147 a.Da = Matrix<T>(a.N, a.N, zero);
148 for (std::size_t k = 0; k < K; ++k)
149 for (std::size_t i = 0; i < a.N; ++i)
150 for (std::size_t j = 0; j < a.N; ++j) a.Da(i, j) += a.Dk[k](i, j);
151
152 Matrix<T> Q(a.N, a.N, zero);
153 for (std::size_t i = 0; i < a.N; ++i)
154 for (std::size_t j = 0; j < a.N; ++j) Q(i, j) = a.D0(i, j) + a.Da(i, j);
155 const std::vector<T> theta = mc::ctmc_solve(Q);
156
157 a.Nsk.resize(K);
158 a.Ns = 0;
159 for (std::size_t k = 0; k < K; ++k) {
160 a.Nsk[k] = svc[k].S.rows();
161 a.Ns += a.Nsk[k];
162 }
163 std::vector<T> lambda(K, zero), mu(K, zero);
164 std::vector<std::vector<T>> beta(K);
165 a.rho = zero;
166 for (std::size_t k = 0; k < K; ++k) {
167 const std::vector<T> td = vecmul(theta, a.Dk[k]);
168 for (const T& v : td) lambda[k] += v;
169 beta[k] = ph_equilibrium(svc[k]);
170 for (std::size_t i = 0; i < a.Nsk[k]; ++i)
171 for (std::size_t j = 0; j < a.Nsk[k]; ++j) mu[k] -= beta[k][i] * svc[k].S(i, j);
172 if (!(mu[k] > zero)) throw NumericError(ErrorKind{"Degenerate"}, "mmapph1fcfs: a service law has zero rate");
173 a.rho += lambda[k] / mu[k];
174 }
175
176 const Matrix<T> Sa = blkdiag(svc, a.Ns);
177 const Matrix<T> Ia = eye<T>(a.N);
178 const Matrix<T> Is = eye<T>(a.Ns);
179
180 // sa{q}, ba{q} and sv{q} place class q's vectors in its own block of the
181 // stacked service space and leave the other blocks at zero.
182 std::vector<std::vector<T>> sa(K, std::vector<T>(a.Ns, zero));
183 std::vector<std::vector<T>> ba(K, std::vector<T>(a.Ns, zero));
184 std::size_t off = 0;
185 for (std::size_t k = 0; k < K; ++k) {
186 for (std::size_t i = 0; i < a.Nsk[k]; ++i) {
187 sa[k][off + i] = svc[k].sigma[i];
188 ba[k][off + i] = beta[k][i];
189 }
190 off += a.Nsk[k];
191 }
192
193 // Fpp = kron(Ia,Sa), Fpm = kron(Ia,-Sa e), Fmp = iVec, Fmm = D0.
194 const Matrix<T> Fpp = kron(Ia, Sa);
195 Matrix<T> sexit(a.Ns, 1, zero);
196 for (std::size_t i = 0; i < a.Ns; ++i) {
197 T s = zero;
198 for (std::size_t j = 0; j < a.Ns; ++j) s += Sa(i, j);
199 sexit(i, 0) = -s;
200 }
201 const Matrix<T> Fpm = kron(Ia, sexit);
202 Matrix<T> iVec(a.N, a.N * a.Ns, zero);
203 for (std::size_t k = 0; k < K; ++k) {
204 Matrix<T> row(1, a.Ns, zero);
205 for (std::size_t i = 0; i < a.Ns; ++i) row(0, i) = sa[k][i];
206 const Matrix<T> blk = kron(a.Dk[k], row);
207 for (std::size_t i = 0; i < iVec.rows(); ++i)
208 for (std::size_t j = 0; j < iVec.cols(); ++j) iVec(i, j) += blk(i, j);
209 }
210
211 const FluidFundamental<T> ff =
212 mfq_fundamental(Fpp, Fpm, iVec, a.D0, T(num_traits<T>::from_double(1e-14)), 150u,
214 const Matrix<T> Y0 = ff.Psi;
215
216 a.T_ = matmul(Y0, iVec);
217 for (std::size_t i = 0; i < a.T_.rows(); ++i)
218 for (std::size_t j = 0; j < a.T_.cols(); ++j) a.T_(i, j) += Fpp(i, j);
219
220 a.pi0.assign(a.N * a.Ns, zero);
221 for (std::size_t k = 0; k < K; ++k) {
222 const std::vector<T> tD = vecmul(theta, a.Dk[k]);
223 for (std::size_t i = 0; i < a.N; ++i)
224 for (std::size_t j = 0; j < a.Ns; ++j)
225 a.pi0[i * a.Ns + j] += tD[i] * T(ba[k][j] / mu[k]);
226 }
227 const std::vector<T> tmp = vecmul(a.pi0, a.T_);
228 for (std::size_t i = 0; i < a.pi0.size(); ++i) a.pi0[i] = -tmp[i];
229 (void)one;
230 return a;
231}
232
233/** The (Ns x 1) indicator of class k's block, or its complement. */
234template <class T>
235Matrix<T> class_indicator(const AgeProcess<T>& a, std::size_t k, bool complement) {
236 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
237 Matrix<T> jm(a.Ns, 1, complement ? one : zero);
238 std::size_t off = 0;
239 for (std::size_t q = 0; q < k; ++q) off += a.Nsk[q];
240 for (std::size_t i = 0; i < a.Nsk[k]; ++i) jm(off + i, 0) = complement ? zero : one;
241 return jm;
242}
243
244/** kron(ones(N,1), v) for an (Ns x 1) column, i.e. the vector pi0 contracts against. */
245template <class T>
246std::vector<T> lift(const AgeProcess<T>& a, const Matrix<T>& jm) {
247 std::vector<T> out(a.N * a.Ns);
248 for (std::size_t i = 0; i < a.N; ++i)
249 for (std::size_t j = 0; j < a.Ns; ++j) out[i * a.Ns + j] = jm(j, 0);
250 return out;
251}
252
253/** pi0 M v for a matrix M and a column v. */
254template <class T>
255T contract(const std::vector<T>& pi0, const Matrix<T>& M, const std::vector<T>& v) {
256 const std::vector<T> row = vecmul(pi0, M);
257 T s = num_traits<T>::from_int(0);
258 for (std::size_t i = 0; i < row.size(); ++i) s += row[i] * v[i];
259 return s;
260}
261
262/** The (Ns x 1) exit-rate column -S_k e placed in class k's block, He's sv{k}. */
263template <class T>
264Matrix<T> class_exit(const AgeProcess<T>& a, const std::vector<PhService<T>>& svc, std::size_t k) {
265 const T zero = num_traits<T>::from_int(0);
266 Matrix<T> sv(a.Ns, 1, zero);
267 std::size_t off = 0;
268 for (std::size_t q = 0; q < k; ++q) off += a.Nsk[q];
269 for (std::size_t i = 0; i < a.Nsk[k]; ++i) {
270 T s = zero;
271 for (std::size_t j = 0; j < a.Nsk[k]; ++j) s += svc[k].S(i, j);
272 sv(off + i, 0) = -s;
273 }
274 return sv;
275}
276
277} // namespace mmapph1_detail
278
279/** A phase-type law (alpha, A) as BUTools' `'stDistrPH'` returns it. */
280template <class T>
281struct StDistrPh {
282 std::vector<T> alpha;
284};
285
286/**
287 * Per-class SOJOURN TIME as a continuous phase-type law, BUTools' `'stDistrPH'`.
288 *
289 * The age process is already the sojourn-time engine: `T` generates it and
290 * `pi0` starts it, so the sojourn time of a class-k job is the absorption time
291 * of `T` with the class-k exit column as its closing vector. What this routine
292 * does beyond that is the SIMILARITY TRANSFORM BUTools applies, which turns the
293 * matrix-exponential pair into a genuine PH pair: it drops the states carrying
294 * no probability (`vv > precision`), rescales by `delta = diag(vv(nz))`, and
295 * TRANSPOSES the generator. Without the transpose the pair still has the right
296 * transform but is not a subgenerator, and `map_cdf` on it returns values
297 * outside [0,1].
298 *
299 * The result feeds `solver_mam_passage_time`, which reads it as the MAP
300 * `{A, (-A e) alpha}` and evaluates the response-time CDF on a grid.
301 */
302template <class T>
303std::vector<StDistrPh<T>> mmapph1fcfs_stdistr_ph(const Mmap<T>& arrival,
304 const std::vector<PhService<T>>& svc,
305 double precision = 1e-14) {
306 using namespace mmapph1_detail;
307 const T zero = num_traits<T>::from_int(0);
308 const AgeProcess<T> a = build(arrival, svc);
309 const std::size_t K = svc.size(), n = a.N * a.Ns;
310
311 Matrix<T> negT(n, n, zero);
312 for (std::size_t i = 0; i < n; ++i)
313 for (std::size_t j = 0; j < n; ++j) negT(i, j) = -a.T_(i, j);
314 const Matrix<T> iT = inverse(negT);
315 const std::vector<T> vv = vecmul(a.pi0, iT);
316
317 // The support of the age density: states outside it contribute nothing and
318 // would make delta singular.
319 std::vector<std::size_t> nz;
320 for (std::size_t i = 0; i < n; ++i)
321 if (num_traits<T>::to_double(vv[i]) > precision) nz.push_back(i);
322 if (nz.empty())
323 throw NumericError(ErrorKind{"Degenerate"}, "mmapph1fcfs_stdistr_ph: the age density has empty support");
324
325 std::vector<StDistrPh<T>> out(K);
326 for (std::size_t k = 0; k < K; ++k) {
327 const std::vector<T> clo = mulvec(iT, lift(a, class_exit(a, svc, k)));
328 T norm = zero;
329 for (std::size_t i = 0; i < n; ++i) norm += a.pi0[i] * clo[i];
330 if (!(num_traits<T>::to_double(norm) > 0.0))
331 throw NumericError(ErrorKind{"Degenerate"}, "mmapph1fcfs_stdistr_ph: class " + std::to_string(k + 1) +
332 " carries no sojourn-time mass");
333 // cl = -T clo / (pi0 clo)
334 const std::vector<T> Tclo = mulvec(a.T_, clo);
335 std::vector<T> cl(n);
336 for (std::size_t i = 0; i < n; ++i) cl[i] = T(-Tclo[i] / norm);
337
338 out[k].alpha.assign(nz.size(), zero);
339 for (std::size_t i = 0; i < nz.size(); ++i) out[k].alpha[i] = T(cl[nz[i]] * vv[nz[i]]);
340 out[k].A = Matrix<T>(nz.size(), nz.size(), zero);
341 for (std::size_t i = 0; i < nz.size(); ++i)
342 for (std::size_t j = 0; j < nz.size(); ++j)
343 // inv(delta) T(nz,nz)' delta, the transpose included
344 out[k].A(i, j) = T(a.T_(nz[j], nz[i]) * vv[nz[j]] / vv[nz[i]]);
345 }
346 return out;
347}
348
349/**
350 * Per-class mean number of customers in the system, BUTools' `'ncMoms', 1`.
351 *
352 * @param arrival the MMAP (D0, D1, D1^(1)..D1^(K)) of the arrival stream
353 * @param svc the per-class phase-type service laws, K of them
354 */
355template <class T>
356std::vector<T> mmapph1fcfs_ncmean(const Mmap<T>& arrival, const std::vector<PhService<T>>& svc) {
357 using namespace mmapph1_detail;
358 const T zero = num_traits<T>::from_int(0);
359 const AgeProcess<T> a = build(arrival, svc);
360 const std::size_t K = svc.size();
361 const Matrix<T> Is = eye<T>(a.Ns);
362 Matrix<T> QA(a.N, a.N, zero);
363 for (std::size_t i = 0; i < a.N; ++i)
364 for (std::size_t j = 0; j < a.N; ++j) QA(i, j) = a.D0(i, j) + a.Da(i, j);
365 const SylvesterFactor<T> F(a.T_, kron(QA, Is));
366 const Matrix<T> EL1 = F.solve_lyap(eye<T>(a.N * a.Ns));
367
368 std::vector<T> out(K, zero);
369 for (std::size_t k = 0; k < K; ++k) {
370 // n = 1 of the moment recursion: Btag is EL1 alone, and the moment is
371 // pi0 EL2 e + pi0 Btag kron(e, jm).
372 const Matrix<T> EL2 = F.solve_lyap(matmul(EL1, kron(a.Dk[k], Is)));
373 const std::vector<T> row = vecmul(a.pi0, EL2);
374 T s = zero;
375 for (const T& v : row) s += v;
376 const Matrix<T> jm = class_indicator(a, k, false);
377 out[k] = T(s + contract(a.pi0, EL1, lift(a, jm)));
378 }
379 return out;
380}
381
382/**
383 * Per-class queue-length distribution, BUTools' `'ncDistr', n`: P(N_k = 0..n-1).
384 *
385 * @param levels the number of probabilities per class, n
386 * @param arrival the marked arrival process
387 * @param svc per-class phase-type service processes
388 */
389template <class T>
390std::vector<std::vector<T>> mmapph1fcfs_ncdistr(const Mmap<T>& arrival,
391 const std::vector<PhService<T>>& svc,
392 std::size_t levels) {
393 using namespace mmapph1_detail;
394 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
395 if (levels == 0) throw InputError("mmapph1fcfs_ncdistr: at least one level is required");
396 const AgeProcess<T> a = build(arrival, svc);
397 const std::size_t K = svc.size();
398 const Matrix<T> Is = eye<T>(a.Ns);
399 const Matrix<T> I = eye<T>(a.N * a.Ns);
400
401 std::vector<std::vector<T>> out(K, std::vector<T>(levels, zero));
402 for (std::size_t k = 0; k < K; ++k) {
403 // The coefficient of the recursion excludes class k's own arrivals: a
404 // class-k arrival advances the level, every other arrival does not.
405 Matrix<T> B(a.N, a.N, zero);
406 for (std::size_t i = 0; i < a.N; ++i)
407 for (std::size_t j = 0; j < a.N; ++j)
408 B(i, j) = a.D0(i, j) + a.Da(i, j) - a.Dk[k](i, j);
409 const SylvesterFactor<T> F(a.T_, kron(B, Is));
410 const Matrix<T> Dkl = kron(a.Dk[k], Is);
411 const std::vector<T> ejm = lift(a, class_indicator(a, k, false));
412 const std::vector<T> ejmc = lift(a, class_indicator(a, k, true));
413
414 Matrix<T> LmCurr = F.solve_lyap(I);
415 out[k][0] = T(one - a.rho + contract(a.pi0, LmCurr, ejmc));
416 for (std::size_t i = 1; i < levels; ++i) {
417 const Matrix<T> LmPrev = LmCurr;
418 LmCurr = F.solve_lyap(matmul(LmPrev, Dkl));
419 out[k][i] = T(contract(a.pi0, LmCurr, ejmc) + contract(a.pi0, LmPrev, ejm));
420 }
421 }
422 return out;
423}
424
425} // namespace mam
426} // namespace line
427
428#endif // LINE_API_MAM_MMAPPH1FCFS_H
InputError(const std::string &what)
Definition error.h:105
NumericError(const std::string &what)
Definition error.h:112
The Kronecker operator of a FIXED (A,B) pair, factorized once.
Definition sylvester.h:177
Matrix< T > solve_lyap(const Matrix< T > &C) const
Solve A X + X B + C = 0, MATLAB's lyap(A,B,C).
Definition sylvester.h:220
Steady-state distribution of a continuous-time Markov chain.
The exception types the port throws.
Dense linear algebra over the templated number type: products, identity, inverse, and powers.
Dense matrix and non-owning view.
Core of the Markovian fluid queue: the fundamental matrices Psi, K, U and the matrix-exponential stat...
Marked MAP (MMAP) algebra: per-class rates, class probabilities, superposition, normalization and sca...
std::vector< T > mmapph1fcfs_ncmean(const Mmap< T > &arrival, const std::vector< PhService< T > > &svc)
Per-class mean number of customers in the system, BUTools' 'ncMoms', 1.
Matrix< T > kron(const Matrix< T > &A, const Matrix< T > &B)
Kronecker product.
Definition mmap_lambda.h:57
FluidFundamental< T > mfq_fundamental(const Matrix< T > &Fpp, const Matrix< T > &Fpm, const Matrix< T > &Fmp, const Matrix< T > &Fmm, const T &precision, unsigned maxNumIt, RiccatiMethod method)
Psi, K and U of a fluid queue whose drifts have been normalized to +-1.
Definition mfq_solve.h:196
std::vector< std::vector< T > > mmapph1fcfs_ncdistr(const Mmap< T > &arrival, const std::vector< PhService< T > > &svc, std::size_t levels)
Per-class queue-length distribution, BUTools' 'ncDistr', n: P(N_k = 0..n-1).
std::vector< StDistrPh< T > > mmapph1fcfs_stdistr_ph(const Mmap< T > &arrival, const std::vector< PhService< T > > &svc, double precision=1e-14)
Per-class SOJOURN TIME as a continuous phase-type law, BUTools' 'stDistrPH'.
std::vector< T > ctmc_solve(const Matrix< T > &Qin, const std::string &linsolver=std::string())
Steady-state distribution of a continuous-time Markov chain.
Definition ctmc_solve.h:133
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:51
std::vector< T > vecmul(const std::vector< T > &v, const Matrix< T > &A)
Row vector times matrix, v A.
Definition linalg.h:50
Matrix< T > inverse(const Matrix< T > &A)
Inverse by LU with one factorization and n back substitutions.
Definition linalg.h:72
Matrix< T > matmul(const Matrix< T > &A, const Matrix< T > &B)
Matrix product A B.
Definition linalg.h:36
std::vector< T > mulvec(const Matrix< T > &A, const std::vector< T > &v)
Matrix times column vector, A v.
Definition linalg.h:62
Matrix< T > eye(std::size_t n)
Identity of order n.
Definition linalg.h:28
Number-type abstraction for the templated API port.
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
Definition error.h:37
An MMAP: the underlying MAP plus the per-class arrival matrices.
Definition mmap_lambda.h:45
One class's phase-type service law, He's (sigma_k, S_k).
Definition mmapph1fcfs.h:72
Matrix< T > S
transient generator
Definition mmapph1fcfs.h:74
std::vector< T > sigma
initial probability row vector
Definition mmapph1fcfs.h:73
A phase-type law (alpha, A) as BUTools' 'stDistrPH' returns it.
std::vector< T > alpha
The Sylvester equation A X + X B = C, and MATLAB's lyap(A,B,C).