Return indices instead of points

This commit is contained in:
Patrick Niklaus
2015-02-20 01:13:44 +01:00
parent f46b259384
commit 89460dd39c
2 changed files with 10 additions and 14 deletions
+3 -5
View File
@@ -74,8 +74,7 @@ namespace Matching
struct SubMatching
{
std::vector<PhantomNode> nodes;
unsigned begin_idx;
unsigned end_idx;
std::vector<unsigned> indices;
double length;
double confidence;
};
@@ -507,9 +506,6 @@ template <class DataFacadeT> class MapMatching final
continue;
}
matching.begin_idx = sub_matching_begin;
matching.end_idx = parent_timestamp_index;
// loop through the columns, and only compare the last entry
auto max_element_iter = std::max_element(model.viterbi[parent_timestamp_index].begin(),
model.viterbi[parent_timestamp_index].end());
@@ -534,11 +530,13 @@ template <class DataFacadeT> class MapMatching final
matching.length = 0.0f;
matching.nodes.resize(reconstructed_indices.size());
matching.indices.resize(reconstructed_indices.size());
for (auto i = 0u; i < reconstructed_indices.size(); ++i)
{
auto timestamp_index = reconstructed_indices[i].first;
auto location_index = reconstructed_indices[i].second;
matching.indices[i] = timestamp_index;
matching.nodes[i] = timestamp_list[timestamp_index][location_index].first;
matching.length += model.path_lengths[timestamp_index][location_index];