Add namespace around all files
This commit is contained in:
@@ -6,6 +6,13 @@
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
namespace map_matching
|
||||
{
|
||||
|
||||
struct NormalDistribution
|
||||
{
|
||||
NormalDistribution(const double mean, const double standard_deviation)
|
||||
@@ -88,4 +95,8 @@ class BayesClassifier
|
||||
double negative_apriori_probability;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BAYES_CLASSIFIER_HPP
|
||||
|
||||
@@ -12,14 +12,15 @@
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace matching
|
||||
namespace engine
|
||||
{
|
||||
namespace map_matching
|
||||
{
|
||||
|
||||
static const double log_2_pi = std::log(2. * M_PI);
|
||||
static const double IMPOSSIBLE_LOG_PROB = -std::numeric_limits<double>::infinity();
|
||||
static const double MINIMAL_LOG_PROB = std::numeric_limits<double>::lowest();
|
||||
static const std::size_t INVALID_STATE = std::numeric_limits<std::size_t>::max();
|
||||
} // namespace matching
|
||||
} // namespace osrm
|
||||
|
||||
// closures to precompute log -> only simple floating point operations
|
||||
struct EmissionLogProbability
|
||||
@@ -33,7 +34,7 @@ struct EmissionLogProbability
|
||||
|
||||
double operator()(const double distance) const
|
||||
{
|
||||
return -0.5 * (osrm::matching::log_2_pi + (distance / sigma_z) * (distance / sigma_z)) -
|
||||
return -0.5 * (log_2_pi + (distance / sigma_z) * (distance / sigma_z)) -
|
||||
log_sigma_z;
|
||||
}
|
||||
};
|
||||
@@ -70,7 +71,7 @@ template <class CandidateLists> struct HiddenMarkovModel
|
||||
suspicious.resize(candidates_list.size());
|
||||
pruned.resize(candidates_list.size());
|
||||
breakage.resize(candidates_list.size());
|
||||
for (const auto i : osrm::irange<std::size_t>(0u, candidates_list.size()))
|
||||
for (const auto i : util::irange<std::size_t>(0u, candidates_list.size()))
|
||||
{
|
||||
const auto &num_candidates = candidates_list[i].size();
|
||||
// add empty vectors
|
||||
@@ -92,9 +93,9 @@ template <class CandidateLists> struct HiddenMarkovModel
|
||||
BOOST_ASSERT(viterbi.size() == parents.size() && parents.size() == path_lengths.size() &&
|
||||
path_lengths.size() == pruned.size() && pruned.size() == breakage.size());
|
||||
|
||||
for (const auto t : osrm::irange(initial_timestamp, viterbi.size()))
|
||||
for (const auto t : util::irange(initial_timestamp, viterbi.size()))
|
||||
{
|
||||
std::fill(viterbi[t].begin(), viterbi[t].end(), osrm::matching::IMPOSSIBLE_LOG_PROB);
|
||||
std::fill(viterbi[t].begin(), viterbi[t].end(), IMPOSSIBLE_LOG_PROB);
|
||||
std::fill(parents[t].begin(), parents[t].end(), std::make_pair(0u, 0u));
|
||||
std::fill(path_lengths[t].begin(), path_lengths[t].end(), 0);
|
||||
std::fill(suspicious[t].begin(), suspicious[t].end(), true);
|
||||
@@ -110,13 +111,13 @@ template <class CandidateLists> struct HiddenMarkovModel
|
||||
{
|
||||
BOOST_ASSERT(initial_timestamp < num_points);
|
||||
|
||||
for (const auto s : osrm::irange<std::size_t>(0u, viterbi[initial_timestamp].size()))
|
||||
for (const auto s : util::irange<std::size_t>(0u, viterbi[initial_timestamp].size()))
|
||||
{
|
||||
viterbi[initial_timestamp][s] =
|
||||
emission_log_probability(candidates_list[initial_timestamp][s].distance);
|
||||
parents[initial_timestamp][s] = std::make_pair(initial_timestamp, s);
|
||||
pruned[initial_timestamp][s] =
|
||||
viterbi[initial_timestamp][s] < osrm::matching::MINIMAL_LOG_PROB;
|
||||
viterbi[initial_timestamp][s] < MINIMAL_LOG_PROB;
|
||||
suspicious[initial_timestamp][s] = false;
|
||||
|
||||
breakage[initial_timestamp] =
|
||||
@@ -128,7 +129,7 @@ template <class CandidateLists> struct HiddenMarkovModel
|
||||
|
||||
if (initial_timestamp >= num_points)
|
||||
{
|
||||
return osrm::matching::INVALID_STATE;
|
||||
return INVALID_STATE;
|
||||
}
|
||||
|
||||
BOOST_ASSERT(initial_timestamp > 0);
|
||||
@@ -140,4 +141,8 @@ template <class CandidateLists> struct HiddenMarkovModel
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HIDDEN_MARKOV_MODEL
|
||||
|
||||
Reference in New Issue
Block a user