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;
79 std::vector<std::map<std::string, std::string> >
equilibria;
87inline std::string fluid_sym_backend_missing() {
89 "fluid_jacobian: solving f(x) = 0 in closed form needs a symbolic backend, and none is "
90 "available. Start one with\n docker run -d -p 8080:8080 ") +
93 " environment variable at a running service, or set the backend to its URL. The Jacobian "
94 "alone needs no backend: ask for it without the equilibria";
128 if (
opt.timeout_s > 0) {
133 std::vector<std::string> want;
134 want.push_back(
"jacobian");
135 if (
opt.equilibria) want.push_back(
"equilibria");
141 const std::vector<std::string> constraints =
144 engine->fluidODEs(d.
rhs, d.
vars, want, constraints, std::string(
"nonnegative"));
148 "' answered without the jacobian it was asked for");
151 detail::sym_state_index(odes.
jacobian.size()) +
" rows for a " +
152 detail::sym_state_index(sys.
nstates) +
" state system");
153 for (std::size_t i = 0; i < odes.
jacobian.size(); ++i)
156 detail::sym_state_index(i + 1) +
" has " +
157 detail::sym_state_index(odes.
jacobian[i].size()) +
158 " columns, expected " + detail::sym_state_index(sys.
nstates));
160 out.
engine = engine->name();
161 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...
std::vector< std::string > fluid_conservation_constraints(const FluidSymSystem &sys)
The invariants of sys as expressions g(x) = 0 over the drift's x1 ... xn.
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.
Conservation laws of a layered queueing network, enumerated from its structure.
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
Nonnegative solutions of f(x) = 0 together with the conserved invariants (fluid_conservation_constrai...
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.