1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//! # tpt-sci-ode
//!
//! ODE/DAE solving substrate for the `tpt-science` pillar.
//!
//! This crate implements its own ODE integrators **from scratch** — no
//! [`diffsol`](https://crates.io/crates/diffsol), `nalgebra`, or `faer` in the
//! shipped dependency graph — so the whole crate is TPT-owned code under
//! `MIT OR Apache-2.0`. It carries its own dual-licensed dense linear algebra
//! (`DMat` + LU with partial pivoting, in `linalg`) for the implicit-method
//! linear solves, and depends on `tpt-math-numeric` only for the `Scalar`
//! numeric trait.
//!
//! Four methods are provided (see [`Method`]):
//! * [`Method::Tsit45`] — explicit Runge–Kutta 5(4), non-stiff.
//! * [`Method::TrBdf2`] — 2-stage SDIRK (TR-BDF2), A-stable, stiff.
//! * [`Method::Esdirk34`] — 4-stage ESDIRK order 3(4), A-/L-stable, stiff.
//! * [`Method::Bdf`] — variable-order (1–5) backward differentiation, stiff.
//!
//! All use a shared adaptive-step driver with Hermite dense output, so
//! [`OdeProblem::solve_dense`] returns exact states at the requested times.
//! For systems with at least 64 states, the implicit methods build their
//! Newton matrices through the in-crate sparse CSR/LU path ([`sparse`]),
//! never materialising a dense Jacobian.
//! `diffsol` is retained only as an optional, dev-only verification oracle
//! (feature `verify-diffsol`, excluded from license scanning).
//!
//! ## Example
//!
//! ```rust
//! use tpt_sci_ode::{OdeProblem, Method};
//!
//! // dy/dt = -y, y(0) = 1 -> y(1) = e^-1
//! let prob = OdeProblem::new(
//! |_t, y, dydt| { dydt[0] = -y[0]; },
//! vec![1.0],
//! 0.0,
//! ).unwrap();
//! let y = prob.solve(Method::Tsit45, 1.0).unwrap();
//! assert!((y[0] - std::f64::consts::E.recip()).abs() < 1e-5);
//! ```
/// Named, time-indexed output with CSV export.
pub use OdeError;
pub use ;
pub use ;
pub use ;
pub use Method;
pub use Trajectory;
/// A callable right-hand side for the ODE solvers.
///
/// This is implemented automatically for any `Fn(f64, &[f64], &mut [f64])`
/// closure (the common way to define a problem, e.g. `|t, y, dydt| { .. }`),
/// and explicitly for `JitRhs` (feature `cranelift-jit`) so a Cranelift
/// JIT-compiled right-hand side can be used interchangeably with a plain
/// closure.
///
/// [`OdeProblem`] and the integrators store the RHS behind an `Rc<dyn
/// RhsCallable>`, so both representations share the exact same solving
/// pipeline.
// Re-export the numeric scalar trait from the tpt-math substrate that this
// crate depends on, so downstream science crates share one scalar vocabulary.
pub use Scalar;