From 850fd47d077fff50402a6d26f48be75c0d99ff6b Mon Sep 17 00:00:00 2001 From: "Victor A. Paludetto Magri" <50467563+victorapm@users.noreply.github.com> Date: Wed, 22 Jun 2022 17:47:09 -0700 Subject: [PATCH] Fix chebyshev smoother for singular problems (#657) See PR's description for additional info --- src/parcsr_ls/par_cheby.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/parcsr_ls/par_cheby.c b/src/parcsr_ls/par_cheby.c index f1b236da8..dc62c17f7 100644 --- a/src/parcsr_ls/par_cheby.c +++ b/src/parcsr_ls/par_cheby.c @@ -68,7 +68,7 @@ hypre_ParCSRRelax_Cheby_Setup(hypre_ParCSRMatrix *A, /* matrix to relax hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); HYPRE_Real theta, delta; HYPRE_Real den; - HYPRE_Real upper_bound = 0.0, lower_bound = 0.0; + HYPRE_Real upper_bound, lower_bound; HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A_diag); HYPRE_Real *coefs = NULL; HYPRE_Int cheby_order; @@ -89,18 +89,18 @@ hypre_ParCSRRelax_Cheby_Setup(hypre_ParCSRMatrix *A, /* matrix to relax /* we are using the order of p(A) */ cheby_order = order - 1; - if (min_eig >= 0.0) + if (max_eig <= 0.0) + { + upper_bound = min_eig * 1.1; + lower_bound = max_eig - (max_eig - upper_bound) * fraction; + } + else { /* make sure we are large enough - Adams et al. 2003 */ upper_bound = max_eig * 1.1; /* lower_bound = max_eig/fraction; */ lower_bound = (upper_bound - min_eig) * fraction + min_eig; } - else if (max_eig <= 0.0) - { - upper_bound = min_eig * 1.1; - lower_bound = max_eig - (max_eig - upper_bound) * fraction; - } /* theta and delta */ theta = (upper_bound + lower_bound) / 2;