nudge_eig

nudge_eig(mat, cond=1e-09, min_eig=1e-12)[source]

Nudge eigenvalues with absolute value smaller than max(cond * max(eigenvalue), min_eig) to that value.

Can be used to avoid singularities in solving matrix equations. Input should have dimension of similar to (nfreqs, nports, nports).

Parameters:
  • mat (np.ndarray) – Matrices to nudge.

  • cond (float, optional) – Minimum eigenvalue ratio compared to the maximum eigenvalue. Default value is 1e-9.

  • min_eig (float, optional) – Minimum eigenvalue. Default value is 1e-12.

Returns:

res – Nudged matrices.

Return type:

np.ndarray