summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-01-25 14:06:24 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-01-25 14:06:24 +0000
commitcafbe7d63d0e16e27721864a1ffa1a67d8f0374f (patch)
treed082d4c483e23e0388878b8726b690dfd50a2018
parentd8f04fab98dcb46ba7b300048311bf9e8b0ab3d2 (diff)
Code review : fix camel case for types and use of std::log instead of log
Add CGAL dependency for Nerve_GIC (link to bottleneck) Add persistence representation in bibtex git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3155 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 8a45497b3d1f34a5c4a1c7856113c6b7680a12a2
-rw-r--r--biblio/how_to_cite_gudhi.bib11
-rw-r--r--src/Nerve_GIC/example/CMakeLists.txt44
-rw-r--r--src/Nerve_GIC/include/gudhi/GIC.h28
-rw-r--r--src/Nerve_GIC/test/CMakeLists.txt19
-rw-r--r--src/Nerve_GIC/test/test_GIC.cpp4
5 files changed, 61 insertions, 45 deletions
diff --git a/biblio/how_to_cite_gudhi.bib b/biblio/how_to_cite_gudhi.bib
index 28014ade..5994124a 100644
--- a/biblio/how_to_cite_gudhi.bib
+++ b/biblio/how_to_cite_gudhi.bib
@@ -128,6 +128,15 @@
, title = "Cover complex"
, publisher = "{GUDHI Editorial Board}"
, booktitle = "{GUDHI} User and Reference Manual"
-, url = "http://gudhi.gforge.inria.fr/doc/latest/group__bottleneck__distance.html"
+, url = "http://gudhi.gforge.inria.fr/doc/latest/group__cover__complex.html"
+, year = 2017
+}
+
+@incollection{gudhi:PersistenceRepresentations
+, author = "Pawel Dlotko"
+, title = "Persistence representations"
+, publisher = "{GUDHI Editorial Board}"
+, booktitle = "{GUDHI} User and Reference Manual"
+, url = "http://gudhi.gforge.inria.fr/doc/latest/group___persistence__representations.html"
, year = 2017
}
diff --git a/src/Nerve_GIC/example/CMakeLists.txt b/src/Nerve_GIC/example/CMakeLists.txt
index 461b6db2..73728dc0 100644
--- a/src/Nerve_GIC/example/CMakeLists.txt
+++ b/src/Nerve_GIC/example/CMakeLists.txt
@@ -1,29 +1,33 @@
cmake_minimum_required(VERSION 2.6)
project(Nerve_GIC_examples)
-add_executable ( Nerve Nerve.cpp )
-add_executable ( CoordGIC CoordGIC.cpp )
-add_executable ( FuncGIC FuncGIC.cpp )
-add_executable ( VoronoiGIC VoronoiGIC.cpp )
+if (NOT CGAL_VERSION VERSION_LESS 4.8.1)
-if (TBB_FOUND)
- target_link_libraries(Nerve ${TBB_LIBRARIES})
- target_link_libraries(CoordGIC ${TBB_LIBRARIES})
- target_link_libraries(FuncGIC ${TBB_LIBRARIES})
- target_link_libraries(VoronoiGIC ${TBB_LIBRARIES})
-endif()
+ add_executable ( Nerve Nerve.cpp )
+ add_executable ( CoordGIC CoordGIC.cpp )
+ add_executable ( FuncGIC FuncGIC.cpp )
+ add_executable ( VoronoiGIC VoronoiGIC.cpp )
-file(COPY KeplerMapperVisuFromTxtFile.py km.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+ if (TBB_FOUND)
+ target_link_libraries(Nerve ${TBB_LIBRARIES})
+ target_link_libraries(CoordGIC ${TBB_LIBRARIES})
+ target_link_libraries(FuncGIC ${TBB_LIBRARIES})
+ target_link_libraries(VoronoiGIC ${TBB_LIBRARIES})
+ endif()
-add_test(NAME Nerve_GIC_example_nerve COMMAND $<TARGET_FILE:Nerve>
- "${CMAKE_SOURCE_DIR}/data/points/human.off" "2" "10" "0.3")
+ file(COPY KeplerMapperVisuFromTxtFile.py km.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-add_test(NAME Nerve_GIC_example_VoronoiGIC COMMAND $<TARGET_FILE:VoronoiGIC>
- "${CMAKE_SOURCE_DIR}/data/points/human.off" "100")
+ add_test(NAME Nerve_GIC_example_nerve COMMAND $<TARGET_FILE:Nerve>
+ "${CMAKE_SOURCE_DIR}/data/points/human.off" "2" "10" "0.3")
-add_test(NAME Nerve_GIC_example_CoordGIC COMMAND $<TARGET_FILE:CoordGIC>
- "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "0")
+ add_test(NAME Nerve_GIC_example_VoronoiGIC COMMAND $<TARGET_FILE:VoronoiGIC>
+ "${CMAKE_SOURCE_DIR}/data/points/human.off" "100")
-add_test(NAME Nerve_GIC_example_FuncGIC COMMAND $<TARGET_FILE:FuncGIC>
- "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat.off"
- "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat_PCA1")
+ add_test(NAME Nerve_GIC_example_CoordGIC COMMAND $<TARGET_FILE:CoordGIC>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "0")
+
+ add_test(NAME Nerve_GIC_example_FuncGIC COMMAND $<TARGET_FILE:FuncGIC>
+ "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat.off"
+ "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat_PCA1")
+
+endif (NOT CGAL_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Nerve_GIC/include/gudhi/GIC.h b/src/Nerve_GIC/include/gudhi/GIC.h
index 2fd61f14..27030723 100644
--- a/src/Nerve_GIC/include/gudhi/GIC.h
+++ b/src/Nerve_GIC/include/gudhi/GIC.h
@@ -58,13 +58,13 @@ namespace cover_complex {
using Simplex_tree = Gudhi::Simplex_tree<>;
using Filtration_value = Simplex_tree::Filtration_value;
using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
-using PersistenceDiagram = std::vector<std::pair<double, double> >;
+using Persistence_diagram = std::vector<std::pair<double, double> >;
using Graph = boost::subgraph<
boost::adjacency_list<boost::setS, boost::vecS, boost::undirectedS, boost::no_property,
boost::property<boost::edge_index_t, int, boost::property<boost::edge_weight_t, double> > > >;
-using vertex_t = boost::graph_traits<Graph>::vertex_descriptor;
-using IndexMap = boost::property_map<Graph, boost::vertex_index_t>::type;
-using WeightMap = boost::property_map<Graph, boost::edge_weight_t>::type;
+using Vertex_t = boost::graph_traits<Graph>::vertex_descriptor;
+using Index_map = boost::property_map<Graph, boost::vertex_index_t>::type;
+using Weight_map = boost::property_map<Graph, boost::edge_weight_t>::type;
/**
* \class Cover_complex
@@ -105,12 +105,12 @@ class Cover_complex {
Graph one_skeleton_OFF; // one-skeleton given by the input OFF file (if it exists).
Graph one_skeleton; // one-skeleton used to compute the connected components.
- std::vector<vertex_t> vertices; // vertices of one_skeleton.
+ std::vector<Vertex_t> vertices; // vertices of one_skeleton.
std::vector<std::vector<int> > simplices; // simplices of output simplicial complex.
std::vector<int> voronoi_subsamples; // Voronoi germs (in case of Voronoi cover).
- PersistenceDiagram PD;
+ Persistence_diagram PD;
std::vector<double> distribution;
std::map<int, std::vector<int> >
@@ -359,8 +359,8 @@ class Cover_complex {
public:
void set_graph_weights() {
- IndexMap index = boost::get(boost::vertex_index, one_skeleton);
- WeightMap weight = boost::get(boost::edge_weight, one_skeleton);
+ Index_map index = boost::get(boost::vertex_index, one_skeleton);
+ Weight_map weight = boost::get(boost::edge_weight, one_skeleton);
boost::graph_traits<Graph>::edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = boost::edges(one_skeleton); ei != ei_end; ++ei)
boost::put(weight, *ei,
@@ -420,7 +420,7 @@ class Cover_complex {
*/
template <typename Distance>
double set_graph_from_automatic_rips(Distance distance, int N = 100) {
- int m = floor(n / exp((1 + rate_power) * log(log(n) / log(rate_constant))));
+ int m = floor(n / std::exp((1 + rate_power) * std::log(std::log(n) / std::log(rate_constant))));
m = std::min(m, n - 1);
std::vector<int> samples(m);
double delta = 0;
@@ -521,7 +521,7 @@ class Cover_complex {
}
double reso = 0;
- IndexMap index = boost::get(boost::vertex_index, one_skeleton);
+ Index_map index = boost::get(boost::vertex_index, one_skeleton);
if (type == "GIC") {
boost::graph_traits<Graph>::edge_iterator ei, ei_end;
@@ -660,7 +660,7 @@ class Cover_complex {
int id = 0;
int pos = 0;
- IndexMap index = boost::get(boost::vertex_index, one_skeleton); // int maxc = -1;
+ Index_map index = boost::get(boost::vertex_index, one_skeleton); // int maxc = -1;
std::map<int, std::vector<int> > preimages;
std::map<int, double> funcstd;
@@ -799,8 +799,8 @@ class Cover_complex {
SampleWithoutReplacement(n, m, voronoi_subsamples);
if (distances.size() == 0) compute_pairwise_distances(distance);
set_graph_weights();
- WeightMap weight = boost::get(boost::edge_weight, one_skeleton);
- IndexMap index = boost::get(boost::vertex_index, one_skeleton);
+ Weight_map weight = boost::get(boost::edge_weight, one_skeleton);
+ Index_map index = boost::get(boost::vertex_index, one_skeleton);
std::vector<double> mindist(n);
for (int j = 0; j < n; j++) mindist[j] = std::numeric_limits<double>::max();
@@ -1220,7 +1220,7 @@ class Cover_complex {
}
if (type == "GIC") {
- IndexMap index = boost::get(boost::vertex_index, one_skeleton);
+ Index_map index = boost::get(boost::vertex_index, one_skeleton);
if (functional_cover) {
// Computes the simplices in the GIC by looking at all the edges of the graph and adding the
diff --git a/src/Nerve_GIC/test/CMakeLists.txt b/src/Nerve_GIC/test/CMakeLists.txt
index 03fe47ca..c35cdff7 100644
--- a/src/Nerve_GIC/test/CMakeLists.txt
+++ b/src/Nerve_GIC/test/CMakeLists.txt
@@ -1,14 +1,17 @@
cmake_minimum_required(VERSION 2.6)
project(Graph_induced_complex_tests)
-include(GUDHI_test_coverage)
+if (NOT CGAL_VERSION VERSION_LESS 4.8.1)
+ include(GUDHI_test_coverage)
-add_executable ( Nerve_GIC_test_unit test_GIC.cpp )
-target_link_libraries(Nerve_GIC_test_unit ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
-if (TBB_FOUND)
- target_link_libraries(Nerve_GIC_test_unit ${TBB_LIBRARIES})
-endif()
+ add_executable ( Nerve_GIC_test_unit test_GIC.cpp )
+ target_link_libraries(Nerve_GIC_test_unit ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+ if (TBB_FOUND)
+ target_link_libraries(Nerve_GIC_test_unit ${TBB_LIBRARIES})
+ endif()
-file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+ file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-gudhi_add_coverage_test(Nerve_GIC_test_unit)
+ gudhi_add_coverage_test(Nerve_GIC_test_unit)
+
+endif (NOT CGAL_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Nerve_GIC/test/test_GIC.cpp b/src/Nerve_GIC/test/test_GIC.cpp
index a8b1e7f7..d633753c 100644
--- a/src/Nerve_GIC/test/test_GIC.cpp
+++ b/src/Nerve_GIC/test/test_GIC.cpp
@@ -24,11 +24,11 @@
#define BOOST_TEST_MODULE "graph_induced_complex"
#include <boost/test/unit_test.hpp>
-#include <cmath> // float comparison
+
#include <limits>
#include <string>
#include <vector>
-#include <algorithm> // std::max
+
#include <gudhi/GIC.h>
#include <gudhi/distance_functions.h>
#include <gudhi/reader_utils.h>