100 "map_pntbisect weights the terms by a Poisson law");
101 const std::size_t n = m.
order();
102 if (n == 0 || m.
D1.rows() != n)
throw InputError(
"map_pntbisect: D0 and D1 disagree");
106 for (std::size_t i = 0; i < n; ++i)
109 std::vector<Matrix<T>> P(na + 1,
Matrix<T>(n, n, zero));
110 if (!(tau > 0.0) || !(tv > 0.0)) {
111 for (std::size_t i = 0; i < n; ++i) P[0](i, i) = one;
117 for (std::size_t i = 0; i < n; ++i)
118 for (std::size_t j = 0; j < n; ++j) {
119 K(i, j) = T(m.
D0(i, j) / taut + (i == j ? one : zero));
120 K1(i, j) = T(m.
D1(i, j) / taut);
123 const std::size_t N = detail::pnt_truncation(tau, tv);
125 std::vector<Matrix<T>> V(na + 1,
Matrix<T>(n, n, zero));
126 for (std::size_t i = 0; i < n; ++i) V[0](i, i) = one;
127 for (std::size_t a = 0; a <= na; ++a) {
129 for (std::size_t i = 0; i < n; ++i)
130 for (std::size_t j = 0; j < n; ++j) P[a](i, j) = T(P[a](i, j) + w * V[a](i, j));
132 for (std::size_t k = 1; k <= N; ++k) {
133 const std::vector<Matrix<T>> Vprev = V;
134 for (std::size_t a = 0; a <= na; ++a) {
136 for (std::size_t i = 0; i < n; ++i)
137 for (std::size_t j = 0; j < n; ++j) {
139 for (std::size_t q = 0; q < n; ++q) acc += Vprev[a](i, q) * K(q, j);
141 for (std::size_t q = 0; q < n; ++q) acc += Vprev[a - 1](i, q) * K1(q, j);
147 for (std::size_t a = 0; a <= na; ++a)
148 for (std::size_t i = 0; i < n; ++i)
149 for (std::size_t j = 0; j < n; ++j) P[a](i, j) = T(P[a](i, j) + w * V[a](i, j));
165std::vector<Matrix<T>>
map_pnt(
const Map<T>& m, std::size_t na,
const T& t,
long M = -1) {
167 "map_pnt weights the terms by a Poisson law");
172 if (!(mean > 0.0) || !(tv > 0.0))
return map_pntbisect(m, na, t);
173 steps =
static_cast<long>(std::ceil(std::log2(tv * 100.0 / mean)));
178 std::vector<Matrix<T>> P =
map_pntbisect(m, na, T(t / half));
179 const std::size_t n = m.
order();
181 for (
long s = 0; s < steps; ++s) {
182 const std::vector<Matrix<T>> Pold = P;
183 for (std::size_t a = 0; a <= na; ++a) {
185 for (std::size_t j = 0; j <= a; ++j)
186 for (std::size_t i = 0; i < n; ++i)
187 for (std::size_t c = 0; c < n; ++c) {
189 for (std::size_t q = 0; q < n; ++q)
190 v += Pold[j](i, q) * Pold[a - j](q, c);
191 acc(i, c) = T(acc(i, c) + v);
223 "map_pntquad integrates the forward equations");
224 const std::size_t K = m.
order();
225 if (K == 0 || m.
D1.rows() != K)
throw InputError(
"map_pntquad: D0 and D1 disagree");
228 const std::size_t blk = K * K, dim = (na + 1) * blk;
229 std::vector<T> y0(dim, zero);
230 for (std::size_t i = 0; i < K; ++i) y0[i * K + i] = one;
232 auto rhs = [&](
const T&,
const std::vector<T>& y) {
233 std::vector<T> dy(dim, zero);
234 for (std::size_t n = 0; n <= na; ++n)
235 for (std::size_t i = 0; i < K; ++i)
236 for (std::size_t j = 0; j < K; ++j) {
238 for (std::size_t q = 0; q < K; ++q) acc += y[n * blk + i * K + q] * m.
D0(q, j);
240 for (std::size_t q = 0; q < K; ++q)
241 acc += y[(n - 1) * blk + i * K + q] * m.
D1(q, j);
242 dy[n * blk + i * K + j] = acc;
248 std::vector<Matrix<T>> P(na + 1,
Matrix<T>(K, K, zero));
249 for (std::size_t n = 0; n <= na; ++n)
250 for (std::size_t i = 0; i < K; ++i)
251 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.