Skip to content

Commit 6184492

Browse files
authored
Merge pull request #444 from PyAutoLabs/feature/curvature-diag-doc-config-drift
docs: align curvature diagonal floor documentation
2 parents 5dedb5e + 7cdfb43 commit 6184492

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

autoarray/inversion/inversion/inversion_util.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,30 @@ def curvature_matrix_with_added_to_diag_from(
4646
It is common for the `curvature_matrix` computed to not be positive-definite, leading for the inversion
4747
via `np.linalg.solve` to fail and raise a `LinAlgError`.
4848
49-
In many circumstances, adding a small numerical value of `1.0e-8` to the diagonal of the `curvature_matrix`
49+
In many circumstances, adding a small numerical value to the diagonal of the `curvature_matrix`
5050
makes it positive definite, such that the inversion is performed without raising an error.
5151
52-
This function adds this numerical value to the diagonal of the curvature matrix.
52+
This function adds the caller-supplied `value` to the diagonal entries selected by
53+
`no_regularization_index_list`. The normal inversion path reads this value from
54+
`Settings.no_regularization_add_to_curvature_diag_value`; the packaged configuration defaults to
55+
`1.0e-3`, and workspaces may override it. The addition is absolute, so its effect depends on the scale of
56+
the curvature matrix.
5357
5458
Parameters
5559
----------
5660
curvature_matrix
5761
The curvature matrix which is being constructed in order to solve a linear system of equations.
62+
value
63+
The numerical value added to each selected diagonal entry.
64+
no_regularization_index_list
65+
The indices of parameters without regularization whose diagonal entries receive `value`.
66+
xp
67+
The array module to use (`numpy` by default; pass `jax.numpy` for JAX support).
68+
69+
Returns
70+
-------
71+
ndarray
72+
The curvature matrix with `value` added to the selected diagonal entries.
5873
"""
5974
if xp.__name__.startswith("jax"):
6075
return curvature_matrix.at[

autoarray/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ def __init__(
8484
no_regularization_add_to_curvature_diag_value
8585
If a linear func object does not have a corresponding regularization, this value is added to its
8686
diagonal entries of the curvature regularization matrix to ensure the matrix is positive-definite.
87+
The packaged configuration defaults to `1.0e-3`; workspaces may override it. The addition is absolute,
88+
so its effect depends on the scale of the curvature matrix.
8789
nnls_solver_tol
8890
Convergence tolerance (infinity-norm KKT residual) of the JAX positive-only (NNLS) interior-point
8991
solve. `None` (default) uses jaxnnls's own tolerance ``min(n * eps * 5e3, 1e-2)`` (~1.7e-9 at

0 commit comments

Comments
 (0)