LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
lsoda.h File Reference

LSODA: the LINE-facing wrapper over the vendored solver in third_party/lsoda.hpp. More...

#include <array>
#include <cmath>
#include <cstddef>
#include <functional>
#include <string>
#include <vector>
#include "line/util/error.h"
#include "lsoda.hpp"
Include dependency graph for lsoda.h:

Go to the source code of this file.

Classes

struct  line::LsodaOptions
 Integration controls. More...
struct  line::LsodaSolution
 Result of an integration, mirroring OdeSolution in ode.h. More...
class  line::LsodaStepper
 One internal step at a time: ODEPACK's itask = 2. More...

Namespaces

namespace  line

Typedefs

using line::LsodaRhs = std::function<void(double t, const double* y, double* dydt)>
 The right-hand side dy/dt = f(t, y).

Functions

LsodaSolution line::lsoda_integrate_stepwise (const LsodaRhs &f, const std::vector< double > &y0, const std::vector< double > &t_eval, const LsodaOptions &opt)
 Integrate dy/dt = f(t, y) from t_eval.front() through every later entry of t_eval, returning the state at each.
LsodaSolution line::lsoda_integrate (const LsodaRhs &f, const std::vector< double > &y0, const std::vector< double > &t_eval, const LsodaOptions &opt=LsodaOptions())
std::vector< double > line::lsoda_final (const LsodaRhs &f, const std::vector< double > &y0, double t0, double t1, const LsodaOptions &opt=LsodaOptions())
 Convenience form: integrate from t0 to t1 and report only the end state.

Detailed Description

LSODA: the LINE-facing wrapper over the vendored solver in third_party/lsoda.hpp.

WHY LSODA AND NOT THE ROSENBROCK IN ode.h. Both integrate a stiff system, but the fluid solver has to AGREE WITH THE OTHER CODEBASES, not merely be accurate. MATLAB drives ode15s/ode23t, the JAR drives jline.solvers.fluid.LSODAExt over imperial-qore/lsoda-java, and native Python drives line_solver/lib/lsoda.py; the latter two are ports of the same Heng Li lsoda.c that the vendored C++ descends from. Running the same algorithm with the same coefficients is what makes the fluid results line up across languages; a different stiff integrator would be defensible numerically and would still disagree in the last digits everywhere. ode.h stays the integrator for everything that has no cross-codebase counterpart to match.

DOUBLE ONLY, BY CONSTRUCTION. LSODA selects its own order and step from floating-point error estimates and the machine epsilon of double is baked into its coefficients, so there is no meaningful Real<N> or Rational instantiation of it. Callers templated on T must refuse by name for any other backend rather than silently narrowing to doublesolver_fluid does exactly that.

Definition in file lsoda.h.