From e381566494d91395d32e9333a68c07f92d2b8d08 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Mon, 9 Feb 2015 10:14:26 +0100 Subject: [PATCH] Eliminate branch --- routing_algorithms/map_matching.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/routing_algorithms/map_matching.hpp b/routing_algorithms/map_matching.hpp index 049017e80..ffade6fd8 100644 --- a/routing_algorithms/map_matching.hpp +++ b/routing_algorithms/map_matching.hpp @@ -341,13 +341,9 @@ template class MapMatching final for (auto s_prime = 0u; s_prime < current_viterbi.size(); ++s_prime) { - double new_value = prev_viterbi[s]; - if (current_viterbi[s_prime] > new_value) - continue; - // how likely is candidate s_prime at time t to be emitted? const double emission_pr = log_emission_probability(timestamp_list[t][s_prime].second); - new_value += emission_pr; + double new_value = prev_viterbi[s] + emission_pr; if (current_viterbi[s_prime] > new_value) continue;