Skip to content

Commit

Permalink
Apply matrix trimming after preconditioning
Browse files Browse the repository at this point in the history
  • Loading branch information
weiliangjin2021 committed Sep 26, 2024
1 parent 7abff0e commit eec46bd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tidy3d/plugins/mode/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,6 @@ def any_pec(eps_vec, threshold=0.9 * np.abs(pec_val)):
mat_dtype = cls.matrix_data_type(eps, mu, der_mats, mat_precision, is_tensorial=False)
mat = cls.type_conversion(mat, mat_dtype)

# Trim small values in single precision case
if mat_precision == "single":
cls.trim_small_values(mat, tol=fp_eps)

# Casting starting vector to target data type
vec_init = cls.type_conversion(vec_init, mat_dtype)

Expand Down Expand Up @@ -549,6 +545,10 @@ def conditional_inverted_vec(eps_vec, threshold=1):
generalized_M = precon_left @ generalized_M
mat = precon_left @ mat

# Trim small values in single precision case
if mat_precision == "single":
cls.trim_small_values(mat, tol=fp_eps)

if analyze_conditioning:
aca = mat.conjugate().T * mat
aac = mat * mat.conjugate().T
Expand Down

0 comments on commit eec46bd

Please sign in to comment.