Description:
In trunkls.jl, the residual norm is calculated using 2 * √f to set and check the stopping tolerance ϵF.
Because the least-squares objective is $f = \frac{1}{2} \Vert{}F(x)\Vert{}^2$, the expression 2 * √f mathematically evaluates to:
$$2 \sqrt{\frac{1}{2} \Vert{}F(x)\Vert{}^2} = \sqrt{2} \Vert{}F(x)\Vert{} \approx 1.414 \Vert{}F(x)\Vert{}$$
This unintentionally scales the residual norm by $\sqrt{2}$, making the stopping condition ~41% stricter than what is explicitly stated in the docstring (‖F(xᵏ)‖ ≤ Fatol + Frtol * ‖F(x⁰)‖).
Proposed Fix:
Change the 2 to be inside the square root: √(2 * f).
Alternatively, since rt (the residual vector) is already evaluated and available in the loop, use norm(rt) directly to avoid the square root operation altogether.
Description:
In
trunkls.jl, the residual norm is calculated using2 * √fto set and check the stopping toleranceϵF.Because the least-squares objective is$f = \frac{1}{2} \Vert{}F(x)\Vert{}^2$ , the expression
2 * √fmathematically evaluates to:This unintentionally scales the residual norm by$\sqrt{2}$ , making the stopping condition ~41% stricter than what is explicitly stated in the docstring (
‖F(xᵏ)‖ ≤ Fatol + Frtol * ‖F(x⁰)‖).Proposed Fix:
Change the 2 to be inside the square root:
√(2 * f).Alternatively, since
rt(the residual vector) is already evaluated and available in the loop, usenorm(rt)directly to avoid the square root operation altogether.