87 "map_pntbisect weights the terms by a Poisson law");
88 const std::size_t n = m.
order();
89 if (n == 0 || m.
D1.rows() != n)
throw InputError(
"map_pntbisect: D0 and D1 disagree");
93 for (std::size_t i = 0; i < n; ++i)
96 std::vector<Matrix<T>> P(na + 1,
Matrix<T>(n, n, zero));
97 if (!(tau > 0.0) || !(tv > 0.0)) {
98 for (std::size_t i = 0; i < n; ++i) P[0](i, i) = one;
104 for (std::size_t i = 0; i < n; ++i)
105 for (std::size_t j = 0; j < n; ++j) {
106 K(i, j) = T(m.
D0(i, j) / taut + (i == j ? one : zero));
107 K1(i, j) = T(m.
D1(i, j) / taut);
110 const std::size_t N = detail::pnt_truncation(tau, tv);
112 std::vector<Matrix<T>> V(na + 1,
Matrix<T>(n, n, zero));
113 for (std::size_t i = 0; i < n; ++i) V[0](i, i) = one;
114 for (std::size_t a = 0; a <= na; ++a) {
116 for (std::size_t i = 0; i < n; ++i)
117 for (std::size_t j = 0; j < n; ++j) P[a](i, j) = T(P[a](i, j) + w * V[a](i, j));
119 for (std::size_t k = 1; k <= N; ++k) {
120 const std::vector<Matrix<T>> Vprev = V;
121 for (std::size_t a = 0; a <= na; ++a) {
123 for (std::size_t i = 0; i < n; ++i)
124 for (std::size_t j = 0; j < n; ++j) {
126 for (std::size_t q = 0; q < n; ++q) acc += Vprev[a](i, q) * K(q, j);
128 for (std::size_t q = 0; q < n; ++q) acc += Vprev[a - 1](i, q) * K1(q, j);
134 for (std::size_t a = 0; a <= na; ++a)
135 for (std::size_t i = 0; i < n; ++i)
136 for (std::size_t j = 0; j < n; ++j) P[a](i, j) = T(P[a](i, j) + w * V[a](i, j));
152std::vector<Matrix<T>>
map_pnt(
const Map<T>& m, std::size_t na,
const T& t,
long M = -1) {
154 "map_pnt weights the terms by a Poisson law");
159 if (!(mean > 0.0) || !(tv > 0.0))
return map_pntbisect(m, na, t);
160 steps =
static_cast<long>(std::ceil(std::log2(tv * 100.0 / mean)));
165 std::vector<Matrix<T>> P =
map_pntbisect(m, na, T(t / half));
166 const std::size_t n = m.
order();
168 for (
long s = 0; s < steps; ++s) {
169 const std::vector<Matrix<T>> Pold = P;
170 for (std::size_t a = 0; a <= na; ++a) {
172 for (std::size_t j = 0; j <= a; ++j)
173 for (std::size_t i = 0; i < n; ++i)
174 for (std::size_t c = 0; c < n; ++c) {
176 for (std::size_t q = 0; q < n; ++q)
177 v += Pold[j](i, q) * Pold[a - j](q, c);
178 acc(i, c) = T(acc(i, c) + v);
210 "map_pntquad integrates the forward equations");
211 const std::size_t K = m.
order();
212 if (K == 0 || m.
D1.rows() != K)
throw InputError(
"map_pntquad: D0 and D1 disagree");
215 const std::size_t blk = K * K, dim = (na + 1) * blk;
216 std::vector<T> y0(dim, zero);
217 for (std::size_t i = 0; i < K; ++i) y0[i * K + i] = one;
219 auto rhs = [&](
const T&,
const std::vector<T>& y) {
220 std::vector<T> dy(dim, zero);
221 for (std::size_t n = 0; n <= na; ++n)
222 for (std::size_t i = 0; i < K; ++i)
223 for (std::size_t j = 0; j < K; ++j) {
225 for (std::size_t q = 0; q < K; ++q) acc += y[n * blk + i * K + q] * m.
D0(q, j);
227 for (std::size_t q = 0; q < K; ++q)
228 acc += y[(n - 1) * blk + i * K + q] * m.
D1(q, j);
229 dy[n * blk + i * K + j] = acc;
235 std::vector<Matrix<T>> P(na + 1,
Matrix<T>(K, K, zero));
236 for (std::size_t n = 0; n <= na; ++n)
237 for (std::size_t i = 0; i < K; ++i)
238 for (std::size_t j = 0; j < K; ++j) P[n](i, j) = yt[n * blk + i * K + j];
std::vector< Matrix< T > > map_pntquad(const Map< T > &m, std::size_t na, const T &t)
The same counting probabilities by NUMERICAL INTEGRATION, map_pntquad.
Matrix< T > map_pntiter(const Map< T > &m, std::size_t na, const T &t, long M=-1)
The reference's entry point: only the highest count is returned.
std::vector< T > ode_rosenbrock4_endpoint(const F &f, const T &t0, const T &t1, const std::vector< T > &y0)
Integrate with the default options and return only the state at t1.