aspcore.matrices.regularize_matrix_with_condition_number

aspcore.matrices.regularize_matrix_with_condition_number(mat, max_cond=10000000000.0)

Adds a scaled identity matrix to the matrix so that the condition number is at most max_cond

Parameters:
  • mat (ndarray of shape (a, a) or (num_mats, a, a)) – Matrix to be regularized, if ndim > 2, then the array is interpreted as an array of multiple matrices

  • max_cond (float, optional) – maximum condition number allowed

Returns:

mat_reg – Regularized matrix

Return type:

ndarray of shape (a, a) or (num_mats, a, a)