You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation for newton_raphson_iterate says:
uintmax_t& max_iter
An optional maximum number of iterations to perform.
On exit, this is updated to the actual number of iterations performed.
There are two issues relating to max_iter:
max_iter is copied to a variable count. After each Newton iteration, one is subtracted from count. Because of the do {...} while (count && ...) structure of the Newton iteration, if max_iter = 0, rollover occurs, making max_iter functionally infinite.
If 0 < max_iter, running out of iterations exits the Newton loop as if the tolerance was met.
These two observations are demonstrated in the code below.
The documentation for
newton_raphson_iterate
says:There are two issues relating to
max_iter
:max_iter
is copied to a variablecount
. After each Newton iteration, one is subtracted fromcount
. Because of thedo {...} while (count && ...)
structure of the Newton iteration, ifmax_iter = 0
, rollover occurs, makingmax_iter
functionally infinite.0 < max_iter
, running out of iterations exits the Newton loop as if the tolerance was met.These two observations are demonstrated in the code below.
The text was updated successfully, but these errors were encountered: