34 for (ret.iterations = 0; ret.iterations < params.
max_iter; ++ret.iterations) {
35 if (std::abs(y0) <= params.
atol) {
49 double x2 = x1 - y1 * ((x1 - x0) / (y1 - y0));
51 if (x2 <= params.
min) {
52 ret.root = params.
min;
55 }
else if (x2 >= params.
max) {
56 ret.root = params.
max;
SecantReturn secantMethod(const Function &func, double x0, double x1, const SecantParams ¶ms=SecantParams{})
Interface class representing a function with an arbitrary number of parameters.
double max
If the gradient moves the next iteration above this limit, clip the result.
std::size_t max_iter
Maximum number of iterations.
double min
If the gradient moves the next iteration below this limit, clip the result.