Skip to content

Commit e339b35

Browse files
use flat_hash_map
1 parent 44b759d commit e339b35

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ namespace geode
6262

6363
ObjectSet< Type > initialize_object_set_with_sampling(
6464
RandomEngine& engine,
65-
const std::unordered_map< uuid, index_t >& group_targets ) const
65+
const absl::flat_hash_map< uuid, index_t >& group_targets ) const
6666
{
6767
ObjectSet< Type > config;
6868
for( const auto& [subset_id, target] : group_targets )

include/geode/stochastic/spatial/object_set.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#pragma once
2525

26-
#include <vector>
26+
#include <absl/container/flat_hash_map.h>
2727

2828
#include <geode/basic/uuid.hpp>
2929
#include <geode/geometry/basic_objects/segment.hpp>
@@ -83,7 +83,7 @@ namespace geode
8383
std::vector< Type >& get_subset( const uuid& subset_id );
8484

8585
private:
86-
std::unordered_map< uuid, std::vector< Type > > groups_;
86+
absl::flat_hash_map< uuid, std::vector< Type > > groups_;
8787
ObjectNeighborhood< Type::dim > neighborhood_;
8888
};
8989
} // namespace geode

tests/stochastic/sampling/mcmc/test-metropolis-hasting-sampler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ namespace
7676
{
7777
geode::RandomEngine engine;
7878

79-
std::unordered_map< geode::uuid, geode::index_t > targets = {
79+
absl::flat_hash_map< geode::uuid, geode::index_t > targets = {
8080
{ subset_id, 20 }
8181
};
8282
geode::ObjectSet< geode::Point2D > state =

tests/stochastic/sampling/mcmc/test-mh-poisson-statistics-and-convergence.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace
3535
// ------------------------------------------------------------
3636
void test_convergence_one_subsete(
3737
geode::MetropolisHastings< geode::Point2D >& mh,
38-
const std::unordered_map< geode::uuid, geode::index_t >& group_targets,
38+
const absl::flat_hash_map< geode::uuid, geode::index_t >& group_targets,
3939
geode::RandomEngine& engine,
4040
const geode::GibbsEnergy< geode::Point2D >& energy )
4141
{
@@ -103,7 +103,7 @@ namespace
103103
std::make_unique< geode::IntensityTerm< geode::Point2D > >(
104104
"intensity", poisson_density, subset_id ) );
105105

106-
std::unordered_map< geode::uuid, geode::index_t > targets = {
106+
absl::flat_hash_map< geode::uuid, geode::index_t > targets = {
107107
{ subset_id,
108108
static_cast< geode::index_t >( poisson_density * area ) }
109109
};

tests/stochastic/sampling/mcmc/test-mh-strauss-statistics-and-convergence.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ namespace
7878
energy, std::move( kernel1 ) );
7979
geode::RandomEngine engine;
8080
engine.set_seed( "@mh-test@" );
81-
std::unordered_map< geode::uuid, geode::index_t > targets = {
81+
absl::flat_hash_map< geode::uuid, geode::index_t > targets = {
8282
{ subset_id, 0 }
8383
};
8484
geode::ObjectSet< geode::Point2D > state =

0 commit comments

Comments
 (0)