LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
cache_rmf_lna.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_CACHE_CACHE_RMF_LNA_H
6
#define LINE_API_CACHE_CACHE_RMF_LNA_H
7
8
/**
9
* @file
10
* @ingroup api_cache
11
* Stationary covariance of a RANDOM(m) cache occupancy, under the LNA.
12
*
13
* Port of `cache_rmf_lna` in python/line_solver/api/cache/rmf.py, itself a twin
14
* of the MATLAB local `rmf_lna_covariance`. It solves the Lyapunov equation
15
*
16
* F'(x) W + W F'(x)' + Q(x) = 0
17
*
18
* with exactly the `jacobian` and `noise_matrix` that `cache_miss_rmf.h`
19
* already uses for the 1/N mean correction, so the mean and the covariance
20
* linearise about the IDENTICAL drift. Reusing those two rather than restating
21
* them is deliberate: the reference's `rmf_jacobian` differentiates the PAIRWISE
22
* drift, which agrees with the aggregated `rmf_drift` on the conserved manifold
23
* but not off it (see the note on `jacobian` there), and a second transcription
24
* would silently pick the other one.
25
*
26
* THE SUBSPACE IS THE POINT, AND THE REASON THE SOLVE IS POSSIBLE AT ALL. The
27
* Jacobian is singular twice over, because a RANDOM(m) cache conserves two
28
* things: every item is in exactly one list (`sum_k x[i,k] = 1`) and every list
29
* holds exactly its capacity (`sum_i x[i,k] = m[k]`). Every jump is a SWAP,
30
* `(e_i - e_j) tensor (e_{k+1} - e_k)`, so the fluctuation lives on the tensor
31
* product of the zero-sum ITEM space with the zero-sum LIST space -- the
32
* double-centred subspace, of dimension `(n-1) * h`. Restricting to an
33
* orthonormal basis of it is EXACT, not a regularization, and it is what makes
34
* the covariance of a deterministic total come out as zero rather than as
35
* whatever a pseudo-inverse would have produced.
36
*
37
* A fixed point that is not exponentially stable ON THAT SUBSPACE has no
38
* stationary covariance, and is refused rather than answered.
39
*
40
* ARITHMETIC: double. The eigenvalue test and the Lyapunov solve are both
41
* floating point.
42
*/
43
44
#include <algorithm>
45
#include <cmath>
46
#include <cstddef>
47
#include <limits>
48
#include <vector>
49
50
#include "
line/api/cache/cache_miss_rmf.h
"
51
#include "
line/util/eig.h
"
52
#include "
line/util/error.h
"
53
#include "
line/util/matrix.h
"
54
#include "
line/util/sylvester.h
"
55
56
namespace
line
{
57
namespace
cache
{
58
59
/**
60
* @brief Stationary covariance of a RANDOM(m) cache occupancy, under the LNA.
61
*
62
* The computation lives in `rmf_detail::lna_covariance` (cache_miss_rmf.h),
63
* where `cache_miss_rmf` also reads it for its `Wcov` output; this entry point
64
* keeps the standalone name.
65
*
66
* @param x the fluid fixed point, flattened item-major (`i + k*n`)
67
* @param p per-item popularities
68
* @param m per-list capacities
69
* @param n number of items
70
* @param h number of cache lists
71
* @return (dim x dim) stationary covariance, symmetric
72
*/
73
inline
Matrix<double>
cache_rmf_lna
(
const
std::vector<double>& x,
const
std::vector<double>& p,
74
const
std::vector<double>& m, std::size_t n, std::size_t h,
75
std::size_t dim) {
76
return
rmf_detail::lna_covariance(x, p, m, n, h, dim);
77
}
78
79
}
// namespace cache
80
}
// namespace line
81
82
#endif
// LINE_API_CACHE_CACHE_RMF_LNA_H
cache_miss_rmf.h
Refined mean field (RMF) miss rates of a multi-list RANDOM(m) cache.
line::Matrix
Definition
matrix.h:56
eig.h
Eigenvalues and singular values, backed by LAPACK.
error.h
The exception types the port throws.
matrix.h
Dense matrix and non-owning view.
line::cache
Definition
cache_cost.h:42
line::cache::cache_rmf_lna
Matrix< double > cache_rmf_lna(const std::vector< double > &x, const std::vector< double > &p, const std::vector< double > &m, std::size_t n, std::size_t h, std::size_t dim)
Stationary covariance of a RANDOM(m) cache occupancy, under the LNA.
Definition
cache_rmf_lna.h:73
line
Conservation laws of a layered queueing network, enumerated from its structure.
Definition
aoi_dist2ph.h:51
sylvester.h
The Sylvester equation A X + X B = C, and MATLAB's lyap(A,B,C).
include
line
api
cache
cache_rmf_lna.h
Generated by
1.18.0