117 const std::vector<double>& m, std::size_t n, std::size_t h,
119 if (x.size() != dim)
throw InputError(
"cache_rmf_lna: the fixed point has the wrong length");
121 const Matrix<double> Fp = rmf_detail::jacobian<double>(x, p, m, n, h);
122 Matrix<double> Q = rmf_detail::noise_matrix<double>(x, p, m, n, h);
125 for (std::size_t i = 0; i < Q.
rows(); ++i)
126 for (std::size_t j = 0; j < i; ++j) {
127 const double v = 0.5 * (Q(i, j) + Q(j, i));
139 "cache_rmf_lna: the centred basis does not span the state dimension; n, h and dim "
142 const std::size_t d = V.
cols();
144 for (std::size_t a = 0; a < d; ++a)
145 for (std::size_t b = 0; b < d; ++b) {
146 double sa = 0.0, sq = 0.0;
147 for (std::size_t i = 0; i < dim; ++i)
148 for (std::size_t j = 0; j < dim; ++j) {
149 sa += V(i, a) * Fp(i, j) * V(j, b);
150 sq += V(i, a) * Q(i, j) * V(j, b);
155 for (std::size_t i = 0; i < d; ++i)
156 for (std::size_t j = 0; j < i; ++j) {
157 const double v = 0.5 * (Qr(i, j) + Qr(j, i));
164 const std::vector<std::complex<double>> ev =
eig_values(Ar);
165 double worst = -std::numeric_limits<double>::infinity();
166 for (std::size_t i = 0; i < ev.size(); ++i) worst = std::max(worst, ev[i].real());
167 if (worst >= -std::sqrt(2.220446049250313e-16))
169 "cache_rmf_lna: the cache fluid fixed point is not exponentially stable on the "
170 "reachable subspace, so the occupancy process has no stationary covariance");
174 for (std::size_t i = 0; i < d; ++i)
175 for (std::size_t j = 0; j < d; ++j) ArT(i, j) = Ar(j, i);
177 for (std::size_t i = 0; i < d; ++i)
178 for (std::size_t j = 0; j < i; ++j) {
179 const double v = 0.5 * (Wr(i, j) + Wr(j, i));
185 for (std::size_t i = 0; i < dim; ++i)
186 for (std::size_t j = 0; j < dim; ++j) {
188 for (std::size_t a = 0; a < d; ++a)
189 for (std::size_t b = 0; b < d; ++b) s += V(i, a) * Wr(a, b) * V(j, b);
192 for (std::size_t i = 0; i < dim; ++i)
193 for (std::size_t j = 0; j < i; ++j) {
194 const double v = 0.5 * (W(i, j) + W(j, i));
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.
Matrix< T > lyap_solve(const Matrix< T > &A, const Matrix< T > &B, const Matrix< T > &C)
MATLAB lyap(A,B,C) solves A X + X B + C = 0, i.e.