summaryrefslogtreecommitdiff
path: root/src/Cech_complex/benchmark/cech_complex_benchmark.cpp
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-29 19:49:30 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-29 19:49:30 +0000
commitcfe5c6b05435cb7d8cbd1d615e0c402f4a5e1674 (patch)
tree7e931f775abe016ec61cc9d2847328bbc51609ee /src/Cech_complex/benchmark/cech_complex_benchmark.cpp
parentaa12266a274c835adef5950a54ebdaa9fb68b89e (diff)
Clang format files
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cechcomplex_vincent@3488 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7d1da847f4c39a191afd5d8e56fe34ee79ade495
Diffstat (limited to 'src/Cech_complex/benchmark/cech_complex_benchmark.cpp')
-rw-r--r--src/Cech_complex/benchmark/cech_complex_benchmark.cpp58
1 files changed, 22 insertions, 36 deletions
diff --git a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp
index 2fa255ed..86314930 100644
--- a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp
+++ b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp
@@ -29,12 +29,11 @@
#include <gudhi/Simplex_tree.h>
#include <gudhi/Miniball.hpp>
-#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
+#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
#include <string>
#include <vector>
-
// Types definition
using Simplex_tree = Gudhi::Simplex_tree<>;
using Filtration_value = Simplex_tree::Filtration_value;
@@ -45,32 +44,31 @@ using Proximity_graph = Gudhi::Proximity_graph<Simplex_tree>;
using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
using Cech_complex = Gudhi::cech_complex::Cech_complex<Simplex_tree, Point_cloud>;
-
class Minimal_enclosing_ball_radius {
public:
// boost::range_value is not SFINAE-friendly so we cannot use it in the return type
- template< typename Point >
- typename std::iterator_traits<typename boost::range_iterator<Point>::type>::value_type
- operator()(const Point& p1, const Point& p2) const {
+ template <typename Point>
+ typename std::iterator_traits<typename boost::range_iterator<Point>::type>::value_type operator()(
+ const Point& p1, const Point& p2) const {
// Type def
using Point_cloud = std::vector<Point>;
using Point_iterator = typename Point_cloud::const_iterator;
using Coordinate_iterator = typename Point::const_iterator;
- using Min_sphere = typename Gudhi::Miniball::Miniball<Gudhi::Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>;
+ using Min_sphere =
+ typename Gudhi::Miniball::Miniball<Gudhi::Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>;
Point_cloud point_cloud;
point_cloud.push_back(p1);
point_cloud.push_back(p2);
- GUDHI_CHECK((p1.end()-p1.begin()) != (p2.end()-p2.begin()), "inconsistent point dimensions");
- Min_sphere min_sphere(p1.end()-p1.begin(), point_cloud.begin(),point_cloud.end());
+ GUDHI_CHECK((p1.end() - p1.begin()) != (p2.end() - p2.begin()), "inconsistent point dimensions");
+ Min_sphere min_sphere(p1.end() - p1.begin(), point_cloud.begin(), point_cloud.end());
return std::sqrt(min_sphere.squared_radius());
}
};
-
-int main(int argc, char * argv[]) {
+int main(int argc, char* argv[]) {
std::string off_file_points = "tore3D_1307.off";
Filtration_value threshold = 1e20;
@@ -79,42 +77,32 @@ int main(int argc, char * argv[]) {
Gudhi::Clock euclidean_clock("Gudhi::Euclidean_distance");
// Compute the proximity graph of the points
- Proximity_graph euclidean_prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(),
- threshold,
- Gudhi::Euclidean_distance());
+ Proximity_graph euclidean_prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(
+ off_reader.get_point_cloud(), threshold, Gudhi::Euclidean_distance());
std::cout << euclidean_clock << std::endl;
Gudhi::Clock miniball_clock("Minimal_enclosing_ball_radius");
// Compute the proximity graph of the points
- Proximity_graph miniball_prox_graph =
- Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(),
- threshold,
- Minimal_enclosing_ball_radius());
+ Proximity_graph miniball_prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(
+ off_reader.get_point_cloud(), threshold, Minimal_enclosing_ball_radius());
std::cout << miniball_clock << std::endl;
Gudhi::Clock common_miniball_clock("Gudhi::Minimal_enclosing_ball_radius()");
// Compute the proximity graph of the points
- Proximity_graph common_miniball_prox_graph =
- Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(),
- threshold,
- Gudhi::Minimal_enclosing_ball_radius());
+ Proximity_graph common_miniball_prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(
+ off_reader.get_point_cloud(), threshold, Gudhi::Minimal_enclosing_ball_radius());
std::cout << common_miniball_clock << std::endl;
-
boost::filesystem::path full_path(boost::filesystem::current_path());
std::cout << "Current path is : " << full_path << std::endl;
-
- std::cout << "File name;Radius;Rips time;Cech time; Ratio Rips/Cech time;Rips nb simplices;Cech nb simplices;" << std::endl;
- boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
- for ( boost::filesystem::directory_iterator itr( boost::filesystem::current_path() );
- itr != end_itr;
- ++itr )
- {
- if ( ! boost::filesystem::is_directory(itr->status()) )
- {
- if ( itr->path().extension() == ".off" ) // see below
+ std::cout << "File name;Radius;Rips time;Cech time; Ratio Rips/Cech time;Rips nb simplices;Cech nb simplices;"
+ << std::endl;
+ boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
+ for (boost::filesystem::directory_iterator itr(boost::filesystem::current_path()); itr != end_itr; ++itr) {
+ if (!boost::filesystem::is_directory(itr->status())) {
+ if (itr->path().extension() == ".off") // see below
{
Points_off_reader off_reader(itr->path().string());
Point p0 = off_reader.get_point_cloud()[0];
@@ -123,8 +111,7 @@ int main(int argc, char * argv[]) {
std::cout << itr->path().stem() << ";";
std::cout << radius << ";";
Gudhi::Clock rips_clock("Rips computation");
- Rips_complex rips_complex_from_points(off_reader.get_point_cloud(),
- radius,
+ Rips_complex rips_complex_from_points(off_reader.get_point_cloud(), radius,
Gudhi::Minimal_enclosing_ball_radius());
Simplex_tree rips_stree;
rips_complex_from_points.create_complex(rips_stree, p0.size() - 1);
@@ -153,6 +140,5 @@ int main(int argc, char * argv[]) {
}
}
-
return 0;
}