From 5eb4d62c333331288a3f5737ae0010fe3b767025 Mon Sep 17 00:00:00 2001 From: fnovais11 Date: Thu, 21 Nov 2024 21:44:30 -0500 Subject: [PATCH 1/2] fixes for engenvalue, matrix operations and delta --- src/openmc_cad_adapter/gqs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openmc_cad_adapter/gqs.py b/src/openmc_cad_adapter/gqs.py index b2ddf60..30c54d7 100644 --- a/src/openmc_cad_adapter/gqs.py +++ b/src/openmc_cad_adapter/gqs.py @@ -47,7 +47,7 @@ def characterize_general_quadratic( surface ): #s surface eigen_results = np.linalg.eig(Aa) signs = np.array([ 0, 0, 0 ]) for i in range( 0, 3 ): - if eigen_results.eigenvalues[ i ] > -1 * gq_tol: + if eigen_results[0][i] > -1 * gq_tol: signs[i] = 1 else: signs[i] = -1 @@ -58,7 +58,7 @@ def characterize_general_quadratic( surface ): #s surface Aai = np.linalg.pinv( Aa ) - C = Aai * B + C = np.dot(Aai, B) dx = C[0] dy = C[1] @@ -69,7 +69,7 @@ def characterize_general_quadratic( surface ): #s surface K_ = K_[0] if rank_Aa == 2 and rank_Ac == 3 and S == 1: - delta = -1 if K_ * signs[0] else 1 + delta = -1 if K_ * signs[0] < 0 else 1 D = -1 if K_ * signs[0] else 1 From 5b35df0a712d66503cc119502b524eaf67c7d4d1 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 21 Nov 2024 21:52:03 -0600 Subject: [PATCH 2/2] Provide names for eigenvalues and eigenvectors at call of eig --- src/openmc_cad_adapter/gqs.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/openmc_cad_adapter/gqs.py b/src/openmc_cad_adapter/gqs.py index 30c54d7..380341a 100644 --- a/src/openmc_cad_adapter/gqs.py +++ b/src/openmc_cad_adapter/gqs.py @@ -44,10 +44,10 @@ def characterize_general_quadratic( surface ): #s surface else: delta = -1 if det_Ac < 0 else 1 - eigen_results = np.linalg.eig(Aa) - signs = np.array([ 0, 0, 0 ]) - for i in range( 0, 3 ): - if eigen_results[0][i] > -1 * gq_tol: + eigenvalues, eigenvectors = np.linalg.eig(Aa) + signs = np.array([0, 0, 0]) + for i in range(0, 3): + if eigenvalues[i] > -1 * gq_tol: signs[i] = 1 else: signs[i] = -1 @@ -113,8 +113,7 @@ def find_type( rAa, rAc, delta, S, D ): #set the translation translation = C - rotation_matrix = eigen_results.eigenvectors - eigenvalues = eigen_results.eigenvalues + rotation_matrix = eigenvectors for i in range( 0, 3 ): if abs(eigenvalues[i]) < gq_tol: