Contents

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

JointFunction

Any callable Evaluation(float) returning f(x) and f'(x) together; a template so that no call allocates (include/SushiDSP/README.md).

Parameters

initial_guess

Starting point; the previous sample's solution is the intended one.

minimum_x

Lower bound the iterate is clamped to after every step. Unbounded by default; an exponential residual needs it finite.

maximum_x

Upper 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

Residual

Any callable float(float).

Derivative

Any callable float(float).

Parameters

minimum_x

Lower clamp on the iterate.

maximum_x

Upper clamp on the iterate.

Returns

The converged root estimate.