From 0d29a871050191fcc6edc223ea7f69c0161eb685 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Mon, 7 Oct 2024 21:49:55 +0000 Subject: [PATCH] Per #2882, update the aggregated seeps computation to use better-initialized vectors. --- src/libcode/vx_statistics/compute_stats.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/libcode/vx_statistics/compute_stats.cc b/src/libcode/vx_statistics/compute_stats.cc index 18abde5e4d..99b02d7d56 100644 --- a/src/libcode/vx_statistics/compute_stats.cc +++ b/src/libcode/vx_statistics/compute_stats.cc @@ -1461,10 +1461,6 @@ void compute_aggregated_seeps(const PairDataPoint *pd, SeepsAggScore *seeps_agg) seeps_mprs.push_back(seeps_mpr); } if (count > 0) { - vector density_vector; - double pvf[SEEPS_MATRIX_SIZE]; - double svf[SEEPS_MATRIX_SIZE]; - double score_sum_wgt, weight_sum, weight[count]; mlog << Debug(9) << method_name << "Categories c_odfl, c_odfh, c_olfd, c_olfh, c_ohfd, c_ohfl => " @@ -1483,19 +1479,21 @@ void compute_aggregated_seeps(const PairDataPoint *pd, SeepsAggScore *seeps_agg) << seeps_agg->mean_obs << " " << seeps_agg->score << "\n"; - score_sum_wgt = 0.; - for (int i=0; i pvf(SEEPS_MATRIX_SIZE, 0.0); + vector svf(SEEPS_MATRIX_SIZE, 0.0); + vector density_vector; compute_seeps_density_vector(pd, seeps_agg, density_vector); int density_cnt = density_vector.size(); if(density_cnt > count) density_cnt = count; //IDL: w = 1/d - weight_sum = 0.; - for (int i=0; i weight(count, 0.0); for (int i=0; i " @@ -1503,7 +1501,7 @@ void compute_aggregated_seeps(const PairDataPoint *pd, SeepsAggScore *seeps_agg) << weight[i] << " " << weight_sum << "\n"; } } - if (!is_eq(weight_sum, 0)) { + if (!is_eq(weight_sum, 0.0)) { //IDL: w = w/sum(w) for (int i=0; i