class
SushiDSP::dk::DampedNewtonSolver
template <std::size_t N>Runs a damped multivariate Newton iteration on the nonlinear port of a DK circuit.
- Declared in
include/SushiDSP/math/dk/DampedNewtonSolver.hpp
The system object exposes void residual_and_jacobian(const std::array<double, N>& v, std::array<double, N>& r, std::array<std::array<double, N>, N>& jacobian) and fills both from one evaluation. solve() allocates nothing, takes no lock and throws nothing (include/SushiDSP/README.md).
Template parameters
NDimension of the nonlinear port.
Public member functions
template <typename System>
bool solve(System &&system, std::array< double, N > &v)Iterates from the supplied starting point until the residual vanishes.
Parameters
vIn: the starting iterate. Out: the converged iterate on success, and on failure the lowest-residual finite iterate visited, never worse than the one passed in.
Returns
True on convergence: a residual below the absolute tolerance, or a norm-reducing step that no longer moves the iterate. False when the budget ran out, the Jacobian stayed singular, or the system produced a non-finite value. Only after true was the system last evaluated at the returned v (include/SushiDSP/README.md).
void set_maximum_iterations(std::uint32_t iterations)Sets the iteration budget of a single solve() call.
Parameters
iterationsMaximum Newton iterations; values below one are clamped to one.
void set_maximum_halvings(std::uint32_t halvings)Sets how many times the step may be halved while looking for a norm reduction.
Parameters
halvingsMaximum halvings per iteration.
void set_relative_tolerance(double tolerance)Sets the step-size convergence tolerance, relative to the iterate magnitude.
Parameters
toleranceRelative tolerance.
std::uint64_t non_converged_count() constNumber of solve() calls that failed to converge since the last reset.
Returns
The non-convergence count.
std::uint32_t maximum_iterations_seen() constLargest iteration count any single solve() call needed since the last reset.
Returns
The worst-case iteration count.
void reset_statistics()Clears the call, non-convergence, and worst-case iteration counters.

