From 0f223ca2690e7427f8738c9f198ea6ce69750896 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Tue, 28 Sep 2021 17:39:05 +0200 Subject: [PATCH] Fix log transformation of weights --- .../impl/aggregator/newmatch_interface.cpp | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/amgprec/impl/aggregator/newmatch_interface.cpp b/amgprec/impl/aggregator/newmatch_interface.cpp index 7d620577..a4f716c3 100644 --- a/amgprec/impl/aggregator/newmatch_interface.cpp +++ b/amgprec/impl/aggregator/newmatch_interface.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "psb_base_cbind.h" #include "MatchingAlgorithms.h" @@ -23,7 +24,7 @@ psb_i_t dnew_Match_If(psb_i_t ipar, psb_i_t matching, psb_d_t lambda, psb_i_t mate[]) { psb_i_t info; - psb_i_t i,j; + psb_i_t i,j,k; psb_i_t ftcoarse=1; psb_i_t cr_it=0, cr_relax_type=0; psb_d_t cr_relax_weight=0.0; @@ -52,9 +53,9 @@ psb_i_t dnew_Match_If(psb_i_t ipar, psb_i_t matching, psb_d_t lambda, nt = 1; } - maxweight = eps; - minweight = 1e300; + minabs = 1e300; // fprintf(stderr,"Sanity check: %d %d \n",nr,nc); + k=0; for (i=1; i eps) { - weight = 1.0 - (2*1.0*aij*wii*wjj)/(aii*(wii*wii) + ajj*(wjj*wjj)); + weight = abs(1.0 - (2*1.0*aij*wii*wjj)/(aii*(wii*wii) + ajj*(wjj*wjj))); } else { weight = eps; } @@ -76,12 +77,21 @@ psb_i_t dnew_Match_If(psb_i_t ipar, psb_i_t matching, psb_d_t lambda, s.push_back(u); t.push_back(v); weights.push_back(weight); - if (weight>maxweight) maxweight=weight; - if (weightmaxweight) maxweight=weights[i]; + if (weights[i]