@@ -56,16 +56,9 @@ def curvature_matrix_with_added_to_diag_from(
5656 curvature_matrix
5757 The curvature matrix which is being constructed in order to solve a linear system of equations.
5858 """
59- try :
60- return curvature_matrix .at [
61- no_regularization_index_list , no_regularization_index_list
62- ].add (value )
63- except AttributeError :
64- return curvature_matrix_with_added_to_diag_from_numba (
65- curvature_matrix = curvature_matrix ,
66- value = value ,
67- no_regularization_index_list = no_regularization_index_list ,
68- )
59+ return curvature_matrix .at [
60+ no_regularization_index_list , no_regularization_index_list
61+ ].add (value )
6962
7063
7164@numba_util .jit ()
@@ -218,8 +211,6 @@ def mapped_reconstructed_data_via_w_tilde_from(
218211def reconstruction_positive_negative_from (
219212 data_vector : np .ndarray ,
220213 curvature_reg_matrix : np .ndarray ,
221- mapper_param_range_list ,
222- force_check_reconstruction : bool = False ,
223214):
224215 """
225216 Solve the linear system [F + reg_coeff*H] S = D -> S = [F + reg_coeff*H]^-1 D given by equation (12)
@@ -262,7 +253,6 @@ def reconstruction_positive_negative_from(
262253def reconstruction_positive_only_from (
263254 data_vector : np .ndarray ,
264255 curvature_reg_matrix : np .ndarray ,
265- settings : SettingsInversion = SettingsInversion (),
266256):
267257 """
268258 Solve the linear system Eq.(2) (in terms of minimizing the quadratic value) of
@@ -308,21 +298,7 @@ def reconstruction_positive_only_from(
308298 """
309299 import jaxnnls
310300
311- try :
312- reconstruction = jaxnnls .solve_nnls_primal (curvature_reg_matrix , data_vector )
313- except (RuntimeError , np .linalg .LinAlgError , ValueError ) as e :
314- raise exc .InversionException () from e
315-
316- def handle_nan (reconstruction ):
317- return jnp .zeros_like (reconstruction )
318-
319- def handle_valid (reconstruction ):
320- return reconstruction
321-
322- has_nan = jnp .isnan (reconstruction ).any ()
323- reconstruction = lax .cond (has_nan , handle_nan , handle_valid , reconstruction )
324-
325- return reconstruction
301+ return jaxnnls .solve_nnls_primal (curvature_reg_matrix , data_vector )
326302
327303
328304def preconditioner_matrix_via_mapping_matrix_from (
0 commit comments