RandLib 2.0.0
Probability distributions, fitting, and heavy-tail tools for C++20
Loading...
Searching...
No Matches
roots.hpp File Reference
#include <randlib/math/constants.hpp>
#include <algorithm>
#include <cmath>
#include <concepts>
#include <functional>
#include <limits>
#include <stdexcept>
#include <tuple>
#include <type_traits>
#include <utility>
Include dependency graph for roots.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  randlib
 
namespace  randlib::math
 Beta-related functions.
 
namespace  randlib::math::detail
 

Functions

template<std::floating_point Real>
bool randlib::math::detail::bracketResolved (Real a, Real b)
 |b - a| no longer resolvable at the relative precision of Real
 
template<std::floating_point Real>
Real randlib::math::detail::safeDivide (Real numerator, Real denominator, Real fallback)
 
template<std::floating_point Real>
Real randlib::math::detail::secantStep (Real a, Real b, Real fa, Real fb)
 
template<std::floating_point Real>
Real randlib::math::detail::newtonQuadraticStep (Real a, Real b, Real d, Real fa, Real fb, Real fd, int steps)
 
template<std::floating_point Real>
Real randlib::math::detail::inverseCubicStep (Real a, Real b, Real d, Real e, Real fa, Real fb, Real fd, Real fe)
 
template<std::floating_point Real, class F >
std::pair< Real, Real > randlib::math::toms748 (const F &f, Real a, Real b, Real fa, Real fb, int maxIterations=200)
 Bracketing root finder of Alefeld, Potra and Shi (ACM TOMS algorithm 748): inverse cubic and Newton-quadratic interpolation steps, a double-length secant step and bisection whenever the bracket does not shrink by half; it converges like Brent's method at worst and faster on smooth functions.
 
template<std::floating_point Real = double, class F >
Real randlib::math::findRoot (const F &f, std::type_identity_t< Real > a, std::type_identity_t< Real > b, int maxIterations=200)
 
template<typename RealType >
bool randlib::math::findRootNewtonFirstOrder (const std::function< DoublePair(RealType)> &funPtr, RealType &root, long double funTol=1e-10, long double stepTol=1e-6)
 Newton's root-finding procedure, using first derivative.
 
template<typename RealType >
bool randlib::math::findRootNewtonSecondOrder (const std::function< DoubleTriplet(RealType)> &funPtr, RealType &root, long double funTol=1e-10, long double stepTol=1e-6)
 Newton's root-finding procedure, using first and second derivatives.
 
bool randlib::math::findRootNewtonFirstOrder2d (const std::function< DoublePair(DoublePair)> &funPtr, const std::function< std::tuple< DoublePair, DoublePair >(DoublePair)> &gradPtr, DoublePair &root, long double funTol=1e-10, long double stepTol=1e-6)
 Newton's root-finding procedure for 2 functions of 2 parameters, using Jacobian matrix.