Skip to content
Merged

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,721 changes: 2,721 additions & 0 deletions results/notes/certified_solver_phase_c1_job350768.json

Large diffs are not rendered by default.

345 changes: 345 additions & 0 deletions results/notes/certified_solver_phase_c1_lane_rate_2026_09.md

Large diffs are not rendered by default.

674 changes: 665 additions & 9 deletions scripts/imaging/likelihood_breakdown/fixed_light_trace.py

Large diffs are not rendered by default.

663 changes: 663 additions & 0 deletions scripts/imaging/likelihood_breakdown/nautilus_batch_capture.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from __future__ import annotations

import contextlib
import inspect
import math
import os
import time
Expand Down Expand Up @@ -260,13 +261,21 @@ def policy_get(key: str, n: int):
record(score=score, reason=reason, accepted=accepted, elapsed_ns=elapsed_ns)
return result

# The library's #566 `solver` / `stats` and #572 `preconditioning` keywords are
# accepted (the inversion passes them by name) and forwarded only to a library
# that declares them.
_outer_params = inspect.signature(original_outer).parameters

def policy_outer(
data_vector,
curvature_reg_matrix,
settings=None,
xp=np,
fingerprint=None,
factor=None,
solver="pdip",
stats=None,
preconditioning="jacobi",
):
nonlocal last_memo_snapshot
use_policy = (
Expand Down Expand Up @@ -301,6 +310,15 @@ def policy_outer(
xp=xp,
fingerprint=fingerprint,
factor=factor,
**{
name: value
for name, value in (
("solver", solver),
("stats", stats),
("preconditioning", preconditioning),
)
if name in _outer_params
},
)
finally:
current.pop()
Expand Down
12 changes: 10 additions & 2 deletions scripts/misc/likelihood_breakdown/fixed_light_numpy_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,11 @@ def numpy_solver_injected(solver, *, label: str):
# injected kernel *is* the solve, so the library's `solver` choice does not reach
# it. The wrapper's keyword must be spelled `solver` (the library passes it by
# name), so the injected kernel is held as `injected`.
# PyAutoArray #572's `preconditioning` (the JAX PDIP scaling) is handled the same way.
original_forwarded = frozenset(
name for name in ("solver", "stats") if name in inspect.signature(original).parameters
name
for name in ("solver", "stats", "preconditioning")
if name in inspect.signature(original).parameters
)
injected = solver

Expand All @@ -633,13 +636,18 @@ def patched(
factor=None,
solver="pdip",
stats=None,
preconditioning="jacobi",
):
if xp.__name__.startswith("jax"):
counts["jax"] += 1
kwargs = {}
if original_takes_factor:
kwargs["factor"] = factor
for name, value in (("solver", solver), ("stats", stats)):
for name, value in (
("solver", solver),
("stats", stats),
("preconditioning", preconditioning),
):
if name in original_forwarded:
kwargs[name] = value
return original(
Expand Down
28 changes: 24 additions & 4 deletions scripts/misc/likelihood_breakdown/library_solver_injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def certified_reconstruction_from(
fingerprint=None,
factor=None,
report=None,
preconditioning="jacobi",
):
"""The certified active-set solve of ``(curvature_reg_matrix, data_vector)``.

Expand All @@ -218,6 +219,11 @@ def certified_reconstruction_from(
iterate is returned unconditionally, which is the shape a batched row must
use (see the module docstring).

``preconditioning`` is the library's PyAutoArray #571/#572 keyword, as the
library passed it. The active-set solve always runs on the Jacobi-scaled
system (as the library's own certified solver does); the keyword is only
forwarded to the PDIP fallback, so a fallback is the library's own call.

``report`` is an optional ``fn(pass_at_certification, certified)`` host
callback (see the module docstring). It changes nothing that is computed;
it is an ordered ``jax.debug.callback``, so it serialises the batch and is
Expand Down Expand Up @@ -253,7 +259,9 @@ def certified_reconstruction_from(

# Route (d)'s fallback is the library's PDIP by definition: pin it, so a
# library config selecting another positive-only solver cannot change it.
fallback_kwargs = _library_kwargs(original, solver="pdip", stats=None)
fallback_kwargs = _library_kwargs(
original, solver="pdip", stats=None, preconditioning=preconditioning
)

def _library_pdip():
return original(
Expand Down Expand Up @@ -305,8 +313,8 @@ def certified_solver_injected(

original = inversion_util.reconstruction_positive_only_from
counts = {"jax": 0, "numpy": 0}
# Read once: which of the #566 keywords the installed library accepts.
forwarded = frozenset(_library_kwargs(original, solver=None, stats=None))
# Read once: which of the #566 / #572 keywords the installed library accepts.
forwarded = frozenset(_library_kwargs(original, solver=None, stats=None, preconditioning=None))

def patched(
data_vector,
Expand All @@ -317,6 +325,7 @@ def patched(
factor=None,
solver="pdip",
stats=None,
preconditioning="jacobi",
):
if not xp.__name__.startswith("jax"):
counts["numpy"] += 1
Expand All @@ -327,7 +336,15 @@ def patched(
xp=xp,
fingerprint=fingerprint,
factor=factor,
**{k: v for k, v in (("solver", solver), ("stats", stats)) if k in forwarded},
**{
k: v
for k, v in (
("solver", solver),
("stats", stats),
("preconditioning", preconditioning),
)
if k in forwarded
},
)
counts["jax"] += 1
return certified_reconstruction_from(
Expand All @@ -342,6 +359,7 @@ def patched(
fingerprint=fingerprint,
factor=factor,
report=report,
preconditioning=preconditioning,
)

_assert_signature_covers(original, patched)
Expand Down Expand Up @@ -397,6 +415,7 @@ def observed(
factor=None,
solver="pdip",
stats=None,
preconditioning="jacobi",
):
is_jax = xp.__name__.startswith("jax")
local_stats = {} if stats is None else stats
Expand All @@ -409,6 +428,7 @@ def observed(
factor=factor,
solver=solver,
stats=local_stats,
**_library_kwargs(original, preconditioning=preconditioning),
)
if not is_jax:
seen["numpy"] += 1
Expand Down
Loading
Loading