Stan Math Library
4.9.0
Automatic Differentiation
|
Eigen::Matrix< var, Eigen::Dynamic, 1 > stan::math::solve_powell_tol | ( | const F & | f, |
const T & | x, | ||
const double | relative_tolerance, | ||
const double | function_tolerance, | ||
const int64_t | max_num_steps, | ||
std::ostream *const | msgs, | ||
const T_Args &... | args | ||
) |
Return the solution to the specified system of algebraic equations given an initial guess, and parameters and data, which get passed into the algebraic system.
Use Powell's dogleg solver.
The user can also specify the relative tolerance (xtol in Eigen's code), the function tolerance, and the maximum number of steps (maxfev in Eigen's code).
This overload handles var parameters.
The Jacobian (J_{xy}) (i.e., Jacobian of unknown (x) w.r.t. the parameter (y)) is calculated given the solution as follows. Since [ f(x, y) = 0, ] we have ((J_{pq}) being the Jacobian matrix (\tfrac {dq} {dq})) [
J_{fx} J_{xy} = J_{fy}. ] Let (eta) be the adjoint with respect to (x); then to calculate [ \eta J_{xy}, ] we solve [
F | type of equation system function |
T | type of elements in the x vector |
Args | types of additional parameters to the equation system functor |
[in] | f | Functor that evaluates the system of equations. |
[in] | x | Vector of starting values (initial guess). |
[in] | relative_tolerance | determines the convergence criteria for the solution. |
[in] | function_tolerance | determines whether roots are acceptable. |
[in] | max_num_steps | maximum number of function evaluations. |
[in,out] | msgs | the print stream for warning messages. |
[in] | args | Additional parameters to the equation system functor. |
<code>std::invalid_argument</code> | if x has size zero. |
<code>std::invalid_argument</code> | if x has non-finite elements. elements. |
<code>std::invalid_argument</code> | if relative_tolerance is strictly negative. |
<code>std::invalid_argument</code> | if function_tolerance is strictly negative. |
<code>std::invalid_argument</code> | if max_num_steps is not positive. |
<code>std::domain_error</code> | solver exceeds max_num_steps. |
<code>std::domain_error</code> | if the norm of the solution exceeds the function tolerance. |
Definition at line 325 of file solve_powell.hpp.