@@ -73,7 +73,7 @@ def __init__(
7373
7474 self .preloads = preloads or Preloads ()
7575
76- self .xp = xp
76+ self ._xp = xp
7777
7878
7979
@@ -285,7 +285,7 @@ def mapping_matrix(self) -> np.ndarray:
285285 If there are multiple linear objects, the mapping matrices are stacked such that their simultaneous linear
286286 equations are solved simultaneously. This property returns the stacked mapping matrix.
287287 """
288- return self .xp .hstack (
288+ return self ._xp .hstack (
289289 [linear_obj .mapping_matrix for linear_obj in self .linear_obj_list ]
290290 )
291291
@@ -304,7 +304,7 @@ def operated_mapping_matrix(self) -> np.ndarray:
304304 If there are multiple linear objects, the blurred mapping matrices are stacked such that their simultaneous
305305 linear equations are solved simultaneously.
306306 """
307- return self .xp .hstack (self .operated_mapping_matrix_list )
307+ return self ._xp .hstack (self .operated_mapping_matrix_list )
308308
309309 @property
310310 def data_vector (self ) -> np .ndarray :
@@ -331,7 +331,7 @@ def regularization_matrix(self) -> Optional[np.ndarray]:
331331 If the `settings.force_edge_pixels_to_zeros` is `True`, the edge pixels of each mapper in the inversion
332332 are regularized so high their value is forced to zero.
333333 """
334- if self .xp .__name__ .startswith ("jax" ):
334+ if self ._xp .__name__ .startswith ("jax" ):
335335 from jax .scipy .linalg import block_diag
336336 return block_diag (
337337 * [linear_obj .regularization_matrix for linear_obj in self .linear_obj_list ]
@@ -379,7 +379,7 @@ def curvature_reg_matrix(self) -> np.ndarray:
379379 if not self .has (cls = AbstractRegularization ):
380380 return self .curvature_matrix
381381
382- return self .xp .add (self .curvature_matrix , self .regularization_matrix )
382+ return self ._xp .add (self .curvature_matrix , self .regularization_matrix )
383383
384384 @property
385385 def curvature_reg_matrix_reduced (self ) -> Optional [np .ndarray ]:
@@ -448,15 +448,15 @@ def reconstruction(self) -> np.ndarray:
448448 data_vector = data_vector ,
449449 curvature_reg_matrix = curvature_reg_matrix ,
450450 settings = self .settings ,
451- xp = self .xp
451+ xp = self ._xp
452452 )
453453 )
454454
455455 # Allocate full solution array
456- reconstruction = self .xp .zeros (self .data_vector .shape [0 ])
456+ reconstruction = self ._xp .zeros (self .data_vector .shape [0 ])
457457
458458 # Scatter the partial solution back to the full shape
459- if self .xp .__name__ .startswith ("jax" ):
459+ if self ._xp .__name__ .startswith ("jax" ):
460460 reconstruction = reconstruction .at [ids_to_keep ].set (
461461 reconstruction_partial
462462 )
@@ -471,13 +471,13 @@ def reconstruction(self) -> np.ndarray:
471471 data_vector = self .data_vector ,
472472 curvature_reg_matrix = self .curvature_reg_matrix ,
473473 settings = self .settings ,
474- xp = self .xp
474+ xp = self ._xp
475475 )
476476
477477 return inversion_util .reconstruction_positive_negative_from (
478478 data_vector = self .data_vector ,
479479 curvature_reg_matrix = self .curvature_reg_matrix ,
480- xp = self .xp
480+ xp = self ._xp
481481 )
482482
483483 @property
@@ -638,9 +638,9 @@ def regularization_term(self) -> float:
638638 if not self .has (cls = AbstractRegularization ):
639639 return 0.0
640640
641- return self .xp .matmul (
641+ return self ._xp .matmul (
642642 self .reconstruction_reduced .T ,
643- self .xp .matmul (self .regularization_matrix_reduced , self .reconstruction_reduced ),
643+ self ._xp .matmul (self .regularization_matrix_reduced , self .reconstruction_reduced ),
644644 )
645645
646646 @property
@@ -653,8 +653,8 @@ def log_det_curvature_reg_matrix_term(self) -> float:
653653 if not self .has (cls = AbstractRegularization ):
654654 return 0.0
655655
656- return 2.0 * self .xp .sum (
657- self .xp .log (self .xp .diag (self .xp .linalg .cholesky (self .curvature_reg_matrix_reduced )))
656+ return 2.0 * self ._xp .sum (
657+ self ._xp .log (self ._xp .diag (self ._xp .linalg .cholesky (self .curvature_reg_matrix_reduced )))
658658 )
659659
660660 @property
@@ -674,8 +674,8 @@ def log_det_regularization_matrix_term(self) -> float:
674674 if not self .has (cls = AbstractRegularization ):
675675 return 0.0
676676
677- return 2.0 * self .xp .sum (
678- self .xp .log (self .xp .diag (self .xp .linalg .cholesky (self .regularization_matrix_reduced )))
677+ return 2.0 * self ._xp .sum (
678+ self ._xp .log (self ._xp .diag (self ._xp .linalg .cholesky (self .regularization_matrix_reduced )))
679679 )
680680
681681 @property
@@ -738,7 +738,7 @@ def regularization_weights_from(self, index: int) -> np.ndarray:
738738
739739 return np .zeros ((pixels ,))
740740
741- return regularization .regularization_weights_from (linear_obj = linear_obj , xp = self .xp )
741+ return regularization .regularization_weights_from (linear_obj = linear_obj , xp = self ._xp )
742742
743743 @property
744744 def regularization_weights_mapper_dict (self ) -> Dict [LinearObj , np .ndarray ]:
0 commit comments