class
SushiDSP::NewtonRaphsonSolver
Generic Newton-Raphson root finder for a scalar nonlinear equation f(x) = 0.
- Declared in
include/SushiDSP/math/NewtonRaphsonSolver.hpp
Contains
Static public member functions
template <typename JointFunction>
static float solve_joint(JointFunction &&function, float initial_guess, std::uint32_t max_iterations=4, float minimum_x=-std::numeric_limits< float >::infinity(), float maximum_x=std::numeric_limits< float >::infinity())Finds x such that the residual is approximately zero, starting from initial_guess.
Template parameters
JointFunctionAny callable Evaluation(float) returning f(x) and f'(x) together; a template so that no call allocates (include/SushiDSP/README.md).
Parameters
initial_guessStarting point; the previous sample's solution is the intended one.
minimum_xLower bound the iterate is clamped to after every step. Unbounded by default; an exponential residual needs it finite.
maximum_xUpper bound the iterate is clamped to after every step.
Returns
The converged root estimate. Always finite when the bounds are finite.
template <typename Residual, typename Derivative>
static float solve(Residual &&function, Derivative &&derivative, float initial_guess, std::uint32_t max_iterations=4, float minimum_x=-std::numeric_limits< float >::infinity(), float maximum_x=std::numeric_limits< float >::infinity())Finds the root from a residual and a derivative supplied as separate callables, under the contract and arithmetic of solve_joint().
Template parameters
ResidualAny callable float(float).
DerivativeAny callable float(float).
Parameters
minimum_xLower clamp on the iterate.
maximum_xUpper clamp on the iterate.
Returns
The converged root estimate.

