5#ifndef LINE_SOLVERS_FLUID_FLUID_JACOBIAN_H
6#define LINE_SOLVERS_FLUID_FLUID_JACOBIAN_H
67 std::vector<std::string>
vars;
68 std::vector<std::string>
rhs;
69 std::vector<std::vector<std::string> >
J;
78 std::vector<std::map<std::string, std::string> >
equilibria;
86inline std::string fluid_sym_backend_missing() {
88 "fluid_jacobian: solving f(x) = 0 in closed form needs a symbolic backend, and none is "
89 "available. Start one with\n docker run -d -p 8080:8080 ") +
92 " environment variable at a running service, or set the backend to its URL. The Jacobian "
93 "alone needs no backend: ask for it without the equilibria";
127 if (
opt.timeout_s > 0) {
132 std::vector<std::string> want;
133 want.push_back(
"jacobian");
134 if (
opt.equilibria) want.push_back(
"equilibria");
139 "' answered without the jacobian it was asked for");
142 detail::sym_state_index(odes.
jacobian.size()) +
" rows for a " +
143 detail::sym_state_index(sys.
nstates) +
" state system");
144 for (std::size_t i = 0; i < odes.
jacobian.size(); ++i)
147 detail::sym_state_index(i + 1) +
" has " +
148 detail::sym_state_index(odes.
jacobian[i].size()) +
149 " columns, expected " + detail::sym_state_index(sys.
nstates));
151 out.
engine = engine->name();
152 if (
opt.equilibria) {
Client of the line-sage-rest service.
SageRestEngine & setTimeoutSeconds(int seconds)
Sets the per-request timeout.
The symbolic backend is unreachable, or rejected the request.
The exception types the port throws.
A symbolic description of the fluid ODE system: a port of solver_fluid_symodes.m, which is what @@Sol...
FluidSymbolicDrift fluid_symbolic_drift(const FluidSymSystem &sys)
Port of @@SolverFLD/getSymbolicDrift: the right-hand side of the mean-field ODE system as expression ...
FluidSymbolicJacobian fluid_symbolic_jacobian(const FluidSymSystem &sys)
Port of @@SolverFLD/getJacobian: d f_i / d x_j of the mean-field drift, as expression strings.
FluidJacobian fluid_jacobian(const FluidSymSystem &sys, const FluidSymbolicOptions &opt=FluidSymbolicOptions())
Jacobian, drift and equilibria of the mean-field vector field.
const char *const SYM_URL_ENV
Environment variable naming a service to use.
std::shared_ptr< SymEngine > sym_resolve(const std::string &requested="auto")
Resolves an engine.
const char *const SYM_DOCKER_IMAGE
Image serving the symbolic REST API.
SymEngine backed by the line-sage-rest service.
The four outputs of @@SolverFLD/getJacobian.
std::string engine
sage or local, whichever produced J
std::vector< std::string > rhs
the drift, one expression per variable
std::vector< std::vector< std::string > > J
J[i][j] = d f_i / d x_j.
bool has_equilibria
the backend answered the equilibria request
std::vector< std::map< std::string, std::string > > equilibria
Solutions of f(x) = 0, each a variable -> expression map.
std::vector< std::string > vars
state variable names
The symbolic system, in whichever of the two forms the method implies.
The drift as expression strings, one per state variable, plus their names.
std::vector< std::string > vars
std::vector< std::string > rhs
What @@SolverFLD/getJacobian returns: d f_i / d x_j as expression strings.
std::vector< std::vector< std::string > > J
J[i][j] = d f_i / d x_j.
Backend selection, mirroring options.config.symbolic and its timeout.
bool equilibria
The reference's nargout >= 4: ask the backend to solve f(x) = 0.
int timeout_s
options.config.symbolic_timeout, seconds; the reference defaults to 300.
std::string backend
auto to search, a URL, an image name, or none to stay local.
Symbolic analysis of a fluid vector field.
std::vector< std::map< std::string, std::string > > equilibria
variable -> expression
std::vector< std::vector< std::string > > jacobian
d f_i / d x_j
Computer algebra operations LINE needs, as seen by this port.
Resolves the symbolic backend to use, and owns the container that serves it.