Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ solve_powell_tol() [1/2]

template<typename F , typename T , typename... Args, require_eigen_vector_t< T > * = nullptr, require_all_st_arithmetic< Args... > * = nullptr>
Eigen::VectorXd 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 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 non-autodiff parameters.

Template Parameters
Ftype of equation system function
Ttype of elements in the x vector
Argstypes of additional parameters to the equation system functor
Parameters
[in]fFunctor that evaluates the system of equations.
[in]xVector of starting values (initial guess).
[in]relative_tolerancedetermines the convergence criteria for the solution.
[in]function_tolerancedetermines whether roots are acceptable.
[in]max_num_stepsmaximum number of function evaluations.
[in,out]msgsthe print stream for warning messages.
[in]argsadditional parameters to the equation system functor.
Returns
theta Vector of solutions to the system of equations.
Precondition
f returns finite values when passed any value of x and the given args.
Exceptions
<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 128 of file solve_powell.hpp.