Stan Math Library
5.0.0
Automatic Differentiation
|
Eigen::VectorXd stan::math::kinsol_solve | ( | const F1 & | f, |
const Eigen::VectorXd & | x, | ||
const double | scaling_step_tol, | ||
const double | function_tolerance, | ||
const int64_t | max_num_steps, | ||
const bool | custom_jacobian, | ||
const int | steps_eval_jacobian, | ||
const int | global_line_search, | ||
std::ostream *const | msgs, | ||
const Args &... | args | ||
) |
Return the solution to the specified algebraic system, given an initial guess.
Invokes the Kinsol solver from Sundials.
F | type of equation system function. |
T | type of initial guess vector. |
[in] | f | Functor that evaluated the system of equations. |
[in] | x | Vector of starting values. |
[in] | y | Parameter vector for the equation system. The function is overloaded to treat y as a vector of doubles or of a a template type T. |
[in] | dat | Continuous data vector for the equation system. |
[in] | dat_int | Integer data vector for the equation system. |
[in,out] | msgs | The print stream for warning messages. |
[in] | scaling_step_tol | Scaled-step stopping tolerance. If a Newton step is smaller than the scaling step tolerance, the code breaks, assuming the solver is no longer making significant progress (i.e. is stuck) |
[in] | function_tolerance | determines whether roots are acceptable. |
[in] | max_num_steps | Maximum number of function evaluations. |
[in] | custom_jacobian | If 0, use Kinsol's default to compute the jacobian for the Newton step, namely Quotient Difference (finite difference). If 1, use reverse-mode AD, unless the user specifies their own method. |
[in] | J_f | A functor that computes the Jacobian for the Newton step. Defaults to reverse-mode AD. |
[in] | steps_eval_jacobian | Maximum number of steps before the Jacobian gets recomputed. Note that Kinsol's default is 10. If equal to 1, the algorithm computes exact Newton steps. |
[in] | global_line_search | does the solver use a global line search? If equal to KIN_NONE, no, if KIN_LINESEARCH, yes. |
[in,out] | msgs | the print stream for warning messages |
args | Extra arguments passed unmodified through to DAE right hand side |
<code>std::invalid_argument</code> | if Kinsol returns a negative flag when setting up the solver. |
<code>std::domain_error</code> | if Kinsol fails to solve equation in max_num_steps iterations. |
<code>std::runtime_error</code> | if Kinsol returns a negative flag that is not due to hitting max_num_steps. |
Definition at line 61 of file kinsol_solve.hpp.