13#ifndef OPTIMIST_ROOTFINDER_HH
14#define OPTIMIST_ROOTFINDER_HH
42 template <
typename T,
typename DerivedSolver>
72 constexpr std::string
name()
const {
73 return static_cast<const DerivedSolver *
>(
this)->name_impl();
135 template <
typename JacobianLambda>
140 std::forward<JacobianLambda>(jacobian),
153 template <
typename HessianLambda>
158 std::forward<HessianLambda>(hessian),
173 template <
typename FunctionLambda>
175#define CMD "Optimist::RootFinder::solve(...): "
177 static_assert(DerivedSolver::RequiresFunction,
178 CMD "the solver requires a function.");
179 return static_cast<DerivedSolver *
>(
this)->solve_impl(
180 std::forward<FunctionLambda>(function),
197 template <
typename FunctionLambda,
typename JacobianLambda>
198 bool solve(FunctionLambda &&function,
199 JacobianLambda &&jacobian,
202#define CMD "Optimist::RootFinder::solve(...): "
204 static_assert(DerivedSolver::RequiresFunction,
205 CMD "the solver requires a function.");
206 static_assert(DerivedSolver::RequiresFirstDerivative,
207 CMD "the solver requires the first derivative.");
208 return static_cast<DerivedSolver *
>(
this)->solve_impl(
209 std::forward<FunctionLambda>(function),
210 std::forward<JacobianLambda>(jacobian),
230 template <
typename FunctionLambda,
231 typename JacobianLambda,
232 typename HessianLambda>
233 bool solve(FunctionLambda &&function,
234 JacobianLambda &&jacobian,
235 HessianLambda &&hessian,
238#define CMD "Optimist::RootFinder::solve(...): "
240 static_assert(DerivedSolver::RequiresFunction,
241 CMD "the solver requires the function.");
242 static_assert(DerivedSolver::RequiresFirstDerivative,
243 CMD "the solver requires the first derivative.");
244 static_assert(DerivedSolver::RequiresSecondDerivative,
245 CMD "the solver requires the second derivative.");
246 return static_cast<DerivedSolver *
>(
this)->solve_impl(
247 std::forward<FunctionLambda>(function),
248 std::forward<JacobianLambda>(jacobian),
249 std::forward<HessianLambda>(hessian),
#define OPTIMIST_BASIC_CONSTANTS(Scalar)
Definition Optimist.hh:70
Class container for the multi-dimensional root finder.
Definition RootFinder.hh:45
void max_hessian_evaluations(const Integer t_hessian_evaluations)
Definition RootFinder.hh:122
Integer max_jacobian_evaluations() const
Definition RootFinder.hh:88
bool evaluate_hessian(HessianLambda &&hessian, const Input &x, SecondDerivative &out)
Definition RootFinder.hh:154
bool solve(FunctionLambda &&function, JacobianLambda &&jacobian, HessianLambda &&hessian, const Input &x_ini, Output &x_sol)
Definition RootFinder.hh:233
T Input
Definition RootFinder.hh:54
bool solve(FunctionLambda &&function, const Input &x_ini, Output &x_sol)
Definition RootFinder.hh:174
Integer max_hessian_evaluations() const
Definition RootFinder.hh:113
Integer hessian_evaluations() const
Definition RootFinder.hh:105
T Output
Definition RootFinder.hh:55
static constexpr bool IsRootFinder
Definition RootFinder.hh:49
typename TypeTrait< T >::Scalar Scalar
Definition RootFinder.hh:53
Integer jacobian_evaluations() const
Definition RootFinder.hh:80
constexpr std::string name() const
Definition RootFinder.hh:72
RootFinder()
Definition RootFinder.hh:66
static constexpr bool IsOptimizer
Definition RootFinder.hh:50
bool evaluate_jacobian(JacobianLambda &&jacobian, const Input &x, FirstDerivative &out)
Definition RootFinder.hh:136
void max_jacobian_evaluations(const Integer t_jacobian_evaluations)
Definition RootFinder.hh:97
bool solve(FunctionLambda &&function, JacobianLambda &&jacobian, const Input &x_ini, Output &x_sol)
Definition RootFinder.hh:198
Integer first_derivative_evaluations() const
Definition SolverBase.hh:379
std::conditional_t< InputTrait::IsEigen||OutputTrait::IsEigen, std::conditional_t< InputTrait::IsSparse||OutputTrait::IsSparse, Eigen::SparseMatrix< Scalar >, Eigen::Matrix< Scalar, OutputTrait::Dimension, InputTrait::Dimension > >, Scalar > FirstDerivative
Definition SolverBase.hh:80
bool evaluate_first_derivative(FirstDerivativeLambda &&function, const T &x, FirstDerivative &out)
Definition SolverBase.hh:1061
bool evaluate_second_derivative(SecondDerivativeLambda &&function, const T &x, SecondDerivative &out)
Definition SolverBase.hh:1082
Integer max_first_derivative_evaluations() const
Definition SolverBase.hh:387
std::conditional_t< InputTrait::IsEigen||OutputTrait::IsEigen, std::conditional_t< InputTrait::IsSparse||OutputTrait::IsSparse, std::vector< Eigen::SparseMatrix< Scalar > >, std::vector< Eigen::Matrix< Scalar, OutputTrait::Dimension, InputTrait::Dimension > > >, Scalar > SecondDerivative
Definition SolverBase.hh:88
SolverBase()
Definition SolverBase.hh:142
Namespace for the Optimist library.
Definition Optimist.hh:90
OPTIMIST_DEFAULT_INTEGER_TYPE Integer
The Integer type as used for the API.
Definition Optimist.hh:98
Definition Optimist.hh:114