Commit 3b05f43
Make _has_converged numerically safe for sparse coefficients
Dividing the iterate change by |s_old| produced NaN/inf wherever a coefficient
was zero (the common case under sparsity), so jnp.all(... <= tol) was never true
and FISTA always ran to max_iter. Guard the denominator with
maximum(|s_old|, 1e-10) so a 0 -> 0 entry reads as converged and 0 -> nonzero as
a real change, letting early stopping actually fire. Outputs stay within
atol=1e-6 of the references at the pinned jax (full suite passes), so no
reference regeneration is needed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent a33d8ce commit 3b05f43
1 file changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
153 | 155 | | |
154 | 156 | | |
155 | | - | |
| 157 | + | |
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
| |||
0 commit comments