summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--biblio/how_to_cite_gudhi.bib9
-rw-r--r--src/Doxyfile6
-rw-r--r--src/Rips_complex/doc/Intro_rips_complex.h52
-rw-r--r--src/Rips_complex/example/CMakeLists.txt23
-rw-r--r--src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp68
-rw-r--r--src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp2
-rw-r--r--src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp72
-rw-r--r--src/Rips_complex/example/full_skeleton_rips_distance_for_doc.txt32
-rw-r--r--src/Rips_complex/example/one_skeleton_rips_distance_for_doc.txt17
-rw-r--r--src/Rips_complex/include/gudhi/Rips_complex.h13
-rw-r--r--src/common/doc/main_page.h3
-rw-r--r--src/common/include/gudhi/distance_functions.h11
-rw-r--r--src/common/include/gudhi/graph_simplicial_complex.h2
-rw-r--r--src/common/include/gudhi/reader_utils.h84
-rw-r--r--src/common/test/test_distance_matrix_reader.cpp16
15 files changed, 347 insertions, 63 deletions
diff --git a/biblio/how_to_cite_gudhi.bib b/biblio/how_to_cite_gudhi.bib
index 03c05728..77b6e284 100644
--- a/biblio/how_to_cite_gudhi.bib
+++ b/biblio/how_to_cite_gudhi.bib
@@ -94,4 +94,13 @@
, booktitle = "{GUDHI} User and Reference Manual"
, url = "http://gudhi.gforge.inria.fr/doc/latest/group__tangential__complex.html"
, year = 2016
+}
+
+@incollection{gudhi:RipsComplex
+, author = "Cl\'ement Maria, Pawel Dlotko, Vincent Rouvreau"
+, title = "Rips complex"
+, publisher = "{GUDHI Editorial Board}"
+, booktitle = "{GUDHI} User and Reference Manual"
+, url = "http://gudhi.gforge.inria.fr/doc/latest/group__rips__complex.html"
+, year = 2016
} \ No newline at end of file
diff --git a/src/Doxyfile b/src/Doxyfile
index e7c1a0e1..cf79755f 100644
--- a/src/Doxyfile
+++ b/src/Doxyfile
@@ -500,7 +500,7 @@ HIDE_SCOPE_NAMES = NO
# the files that are included by a file in the documentation of that file.
# The default value is: YES.
-SHOW_INCLUDE_FILES = YES
+SHOW_INCLUDE_FILES = NO
# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
# grouped member an include statement to the documentation, telling the reader
@@ -2151,7 +2151,7 @@ TEMPLATE_RELATIONS = YES
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
-INCLUDE_GRAPH = YES
+INCLUDE_GRAPH = NO
# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
# set to YES then doxygen will generate a graph for each documented file showing
@@ -2160,7 +2160,7 @@ INCLUDE_GRAPH = YES
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
-INCLUDED_BY_GRAPH = YES
+INCLUDED_BY_GRAPH = NO
# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
# dependency graph for every global function or class method.
diff --git a/src/Rips_complex/doc/Intro_rips_complex.h b/src/Rips_complex/doc/Intro_rips_complex.h
index a71946b5..d01b14bb 100644
--- a/src/Rips_complex/doc/Intro_rips_complex.h
+++ b/src/Rips_complex/doc/Intro_rips_complex.h
@@ -2,7 +2,7 @@
* (Geometric Understanding in Higher Dimensions) is a generic C++
* library for computational topology.
*
- * Author(s): Clément Maria, Vincent Rouvreau
+ * Author(s): Clément Maria, Pawel Dlotko, Vincent Rouvreau
*
* Copyright (C) 2016 INRIA
*
@@ -29,7 +29,7 @@ namespace rips_complex {
/** \defgroup rips_complex Rips complex
*
- * \author Clément Maria, Vincent Rouvreau
+ * \author Clément Maria, Pawel Dlotko, Vincent Rouvreau
*
* @{
*
@@ -54,7 +54,9 @@ namespace rips_complex {
* value set with \f$max(filtration(4,5), filtration(4,6), filtration(5,6))\f$.
* And so on for simplex (0,1,2,3).
*
- * \section ripspointsexample Example from points
+ * \section ripspointsdistance Point cloud and distance function
+ *
+ * \subsection ripspointscloudexample Example from a point cloud and a distance function
*
* This example builds the one skeleton graph from the given points, threshold value, and distance function.
* Then it creates a `Simplex_tree` with it.
@@ -73,7 +75,7 @@ namespace rips_complex {
*
* \include Rips_complex/one_skeleton_rips_points_for_doc.txt
*
- * \section ripsoffexample Example from OFF file
+ * \subsection ripsoffexample Example from OFF file
*
* This example builds the one skeleton graph from the given points in an OFF file, threshold value, and distance
* function.
@@ -93,6 +95,48 @@ namespace rips_complex {
*
* \include Rips_complex/full_skeleton_rips_points_for_doc.txt
*
+ *
+ *
+ * \section ripsdistancematrix Distance matrix
+ *
+ * \subsection ripsdistancematrixexample Example from a distance matrix
+ *
+ * This example builds the one skeleton graph from the given distance matrix and threshold value.
+ * Then it creates a `Simplex_tree` with it.
+ *
+ * Then, it is asked to display information about the simplicial complex.
+ *
+ * \include Rips_complex/example_one_skeleton_rips_from_distance_matrix.cpp
+ *
+ * When launching (rips maximal distance between 2 points is 1.0, is expanded until dimension 1 - one skeleton graph
+ * with other words):
+ *
+ * \code $> ./oneskeletonripsdistance 1.0
+ * \endcode
+ *
+ * the program output is:
+ *
+ * \include Rips_complex/one_skeleton_rips_distance_for_doc.txt
+ *
+ * \subsection ripscsvdistanceexample Example from a distance matrix read in a csv file
+ *
+ * This example builds the one skeleton graph from the given distance matrix read in a csv file and threshold value.
+ * Then it creates a `Simplex_tree` with it.
+ *
+ *
+ * Then, it is asked to display information about the rips complex.
+ *
+ * \include Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp
+ *
+ * When launching:
+ *
+ * \code $> ./ripscsvdistancereader ../../data/distance_matrix/full_square_distance_matrix.csv 1.0 3
+ * \endcode
+ *
+ * the program output is:
+ *
+ * \include Rips_complex/full_skeleton_rips_distance_for_doc.txt
+ *
* \copyright GNU General Public License v3.
* \verbatim Contact: gudhi-users@lists.gforge.inria.fr \endverbatim
*/
diff --git a/src/Rips_complex/example/CMakeLists.txt b/src/Rips_complex/example/CMakeLists.txt
index 3962b15e..9ba9d941 100644
--- a/src/Rips_complex/example/CMakeLists.txt
+++ b/src/Rips_complex/example/CMakeLists.txt
@@ -1,27 +1,50 @@
cmake_minimum_required(VERSION 2.6)
project(Rips_complex_examples)
+# Point cloud
add_executable ( ripsoffreader example_rips_complex_from_off_file.cpp )
target_link_libraries(ripsoffreader ${Boost_SYSTEM_LIBRARY})
add_executable ( oneskeletonripspoints example_one_skeleton_rips_from_points.cpp )
target_link_libraries(oneskeletonripspoints ${Boost_SYSTEM_LIBRARY})
+# Distance matrix
+add_executable ( oneskeletonripsdistance example_one_skeleton_rips_from_distance_matrix.cpp )
+target_link_libraries(oneskeletonripsdistance ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( ripscsvdistancereader example_rips_complex_from_csv_distance_matrix_file.cpp )
+target_link_libraries(ripscsvdistancereader ${Boost_SYSTEM_LIBRARY})
+
if (TBB_FOUND)
target_link_libraries(ripsoffreader ${TBB_LIBRARIES})
target_link_libraries(oneskeletonripspoints ${TBB_LIBRARIES})
+ target_link_libraries(oneskeletonripsdistance ${TBB_LIBRARIES})
+ target_link_libraries(ripscsvdistancereader ${TBB_LIBRARIES})
endif()
add_test(oneskeletonripspoints ${CMAKE_CURRENT_BINARY_DIR}/oneskeletonripspoints 12.0)
+
+add_test(oneskeletonripsdistance ${CMAKE_CURRENT_BINARY_DIR}/oneskeletonripspoints 1.0)
+
# Do not forget to copy test files in current binary dir
file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
add_test(ripsoffreader_doc_12_1 ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader alphacomplexdoc.off 12.0 1 ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_1.txt)
add_test(ripsoffreader_doc_12_3 ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader alphacomplexdoc.off 12.0 3 ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_3.txt)
+
+file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+add_test(ripscsvdistancereader_doc_1_1 ${CMAKE_CURRENT_BINARY_DIR}/ripscsvdistancereader full_square_distance_matrix.csv 1.0 1 ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_1_1.txt)
+add_test(ripscsvdistancereader_doc_1_3 ${CMAKE_CURRENT_BINARY_DIR}/ripscsvdistancereader full_square_distance_matrix.csv 1.0 3 ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_1_3.txt)
+
+
if (DIFF_PATH)
# Do not forget to copy test results files in current binary dir
file(COPY "one_skeleton_rips_points_for_doc.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY "full_skeleton_rips_points_for_doc.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+ file(COPY "one_skeleton_rips_distance_for_doc.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+ file(COPY "full_skeleton_rips_distance_for_doc.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
add_test(ripsoffreader_doc_12_1_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_1.txt ${CMAKE_CURRENT_BINARY_DIR}/one_skeleton_rips_points_for_doc.txt)
add_test(ripsoffreader_doc_12_3_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_3.txt ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_points_for_doc.txt)
+ add_test(ripscsvreader_doc_1_1_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_1_1.txt ${CMAKE_CURRENT_BINARY_DIR}/one_skeleton_rips_distance_for_doc.txt)
+ add_test(ripscsvreader_doc_1_3_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_1_3.txt ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_distance_for_doc.txt)
endif()
diff --git a/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp b/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp
new file mode 100644
index 00000000..54fa3aa1
--- /dev/null
+++ b/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp
@@ -0,0 +1,68 @@
+#include <gudhi/Rips_complex.h>
+// to construct a simplex_tree from rips complex
+#include <gudhi/Simplex_tree.h>
+#include <gudhi/distance_functions.h>
+
+#include <iostream>
+#include <string>
+#include <limits> // for std::numeric_limits
+
+void usage(int nbArgs, char * const progName) {
+ std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n";
+ std::cerr << "Usage: " << progName << " threshold\n";
+ std::cerr << " i.e.: " << progName << " 12.0\n";
+ exit(-1); // ----- >>
+}
+
+int main(int argc, char **argv) {
+ if (argc != 2) usage(argc, argv[0]);
+
+ double threshold = atof(argv[1]);
+
+ // Type definitions
+ using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
+ using Filtration_value = Simplex_tree::Filtration_value;
+ using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
+ using Distance_matrix = std::vector<std::vector<Filtration_value>>;
+
+ // User defined distance matrix is:
+ // | 0 0.94 0.77 0.99 0.11 |
+ // | 0.94 0 0.26 0.99 0.39 |
+ // | 0.77 0.26 0 0.28 0.97 |
+ // | 0.99 0.99 0.28 0 0.30 |
+ // | 0.11 0.39 0.97 0.30 0 |
+
+ Distance_matrix distances;
+ distances.push_back({});
+ distances.push_back({0.94});
+ distances.push_back({0.77, 0.26});
+ distances.push_back({0.99, 0.99, 0.28});
+ distances.push_back({0.11, 0.39, 0.97, 0.30});
+
+ // ----------------------------------------------------------------------------
+ // Init of a rips complex from points
+ // ----------------------------------------------------------------------------
+ Rips_complex rips_complex_from_points(distances, threshold);
+
+ Simplex_tree simplex;
+ if (rips_complex_from_points.create_complex(simplex, 1)) {
+ // ----------------------------------------------------------------------------
+ // Display information about the one skeleton rips complex
+ // ----------------------------------------------------------------------------
+ std::cout << "Rips complex is of dimension " << simplex.dimension() <<
+ " - " << simplex.num_simplices() << " simplices - " <<
+ simplex.num_vertices() << " vertices." << std::endl;
+
+ std::cout << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" <<
+ std::endl;
+ for (auto f_simplex : simplex.filtration_simplex_range()) {
+ std::cout << " ( ";
+ for (auto vertex : simplex.simplex_vertex_range(f_simplex)) {
+ std::cout << vertex << " ";
+ }
+ std::cout << ") -> " << "[" << simplex.filtration(f_simplex) << "] ";
+ std::cout << std::endl;
+ }
+ }
+ return 0;
+}
diff --git a/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp b/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp
index 2e63d9a6..26517876 100644
--- a/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp
+++ b/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp
@@ -1,6 +1,4 @@
#include <gudhi/Rips_complex.h>
-// to construct Rips_complex from a OFF file of points
-#include <gudhi/Points_off_io.h>
// to construct a simplex_tree from rips complex
#include <gudhi/Simplex_tree.h>
#include <gudhi/distance_functions.h>
diff --git a/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp b/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp
new file mode 100644
index 00000000..cfada84a
--- /dev/null
+++ b/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp
@@ -0,0 +1,72 @@
+#include <gudhi/Rips_complex.h>
+// to construct Rips_complex from a OFF file of points
+#include <gudhi/reader_utils.h>
+// to construct a simplex_tree from rips complex
+#include <gudhi/Simplex_tree.h>
+#include <gudhi/distance_functions.h>
+
+#include <iostream>
+#include <string>
+
+void usage(int nbArgs, char * const progName) {
+ std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n";
+ std::cerr << "Usage: " << progName << " filename.csv threshold dim_max [ouput_file.txt]\n";
+ std::cerr << " i.e.: " << progName << " ../../data/distance_matrix/full_square_distance_matrix.csv 1.0 3\n";
+ exit(-1); // ----- >>
+}
+
+int main(int argc, char **argv) {
+ if ((argc != 4) && (argc != 5)) usage(argc, (argv[0] - 1));
+
+ std::string csv_file_name(argv[1]);
+ double threshold = atof(argv[2]);
+ int dim_max = atoi(argv[3]);
+
+ // Type definitions
+ using Simplex_tree = Gudhi::Simplex_tree<>;
+ using Filtration_value = Simplex_tree::Filtration_value;
+ using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
+ using Distance_matrix = std::vector<std::vector<Filtration_value>>;
+
+ // ----------------------------------------------------------------------------
+ // Init of a rips complex from a distance matrix in a csv file
+ // Default separator is ';'
+ // ----------------------------------------------------------------------------
+ Distance_matrix distances = read_lower_triangular_matrix_from_csv_file<Filtration_value>(csv_file_name);
+ Rips_complex rips_complex_from_file(distances, threshold);
+
+ std::streambuf* streambufffer;
+ std::ofstream ouput_file_stream;
+
+ if (argc == 5) {
+ ouput_file_stream.open(std::string(argv[4]));
+ streambufffer = ouput_file_stream.rdbuf();
+ } else {
+ streambufffer = std::cout.rdbuf();
+ }
+
+ Simplex_tree simplex;
+ if (rips_complex_from_file.create_complex(simplex, dim_max)) {
+ std::ostream output_stream(streambufffer);
+
+ // ----------------------------------------------------------------------------
+ // Display information about the rips complex
+ // ----------------------------------------------------------------------------
+ output_stream << "Rips complex is of dimension " << simplex.dimension() <<
+ " - " << simplex.num_simplices() << " simplices - " <<
+ simplex.num_vertices() << " vertices." << std::endl;
+
+ output_stream << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" <<
+ std::endl;
+ for (auto f_simplex : simplex.filtration_simplex_range()) {
+ output_stream << " ( ";
+ for (auto vertex : simplex.simplex_vertex_range(f_simplex)) {
+ output_stream << vertex << " ";
+ }
+ output_stream << ") -> " << "[" << simplex.filtration(f_simplex) << "] ";
+ output_stream << std::endl;
+ }
+ }
+ ouput_file_stream.close();
+ return 0;
+}
diff --git a/src/Rips_complex/example/full_skeleton_rips_distance_for_doc.txt b/src/Rips_complex/example/full_skeleton_rips_distance_for_doc.txt
new file mode 100644
index 00000000..6744532d
--- /dev/null
+++ b/src/Rips_complex/example/full_skeleton_rips_distance_for_doc.txt
@@ -0,0 +1,32 @@
+Rips complex is of dimension 3 - 30 simplices - 5 vertices.
+Iterator on rips complex simplices in the filtration order, with [filtration value]:
+ ( 0 ) -> [0]
+ ( 1 ) -> [0]
+ ( 2 ) -> [0]
+ ( 3 ) -> [0]
+ ( 4 ) -> [0]
+ ( 4 0 ) -> [0.11]
+ ( 2 1 ) -> [0.26]
+ ( 3 2 ) -> [0.28]
+ ( 4 3 ) -> [0.3]
+ ( 4 1 ) -> [0.39]
+ ( 2 0 ) -> [0.77]
+ ( 1 0 ) -> [0.94]
+ ( 2 1 0 ) -> [0.94]
+ ( 4 1 0 ) -> [0.94]
+ ( 4 2 ) -> [0.97]
+ ( 4 2 0 ) -> [0.97]
+ ( 4 2 1 ) -> [0.97]
+ ( 4 2 1 0 ) -> [0.97]
+ ( 4 3 2 ) -> [0.97]
+ ( 3 0 ) -> [0.99]
+ ( 3 1 ) -> [0.99]
+ ( 3 1 0 ) -> [0.99]
+ ( 3 2 0 ) -> [0.99]
+ ( 3 2 1 ) -> [0.99]
+ ( 3 2 1 0 ) -> [0.99]
+ ( 4 3 0 ) -> [0.99]
+ ( 4 3 1 ) -> [0.99]
+ ( 4 3 1 0 ) -> [0.99]
+ ( 4 3 2 0 ) -> [0.99]
+ ( 4 3 2 1 ) -> [0.99]
diff --git a/src/Rips_complex/example/one_skeleton_rips_distance_for_doc.txt b/src/Rips_complex/example/one_skeleton_rips_distance_for_doc.txt
new file mode 100644
index 00000000..9bb1a7ab
--- /dev/null
+++ b/src/Rips_complex/example/one_skeleton_rips_distance_for_doc.txt
@@ -0,0 +1,17 @@
+Rips complex is of dimension 1 - 15 simplices - 5 vertices.
+Iterator on rips complex simplices in the filtration order, with [filtration value]:
+ ( 0 ) -> [0]
+ ( 1 ) -> [0]
+ ( 2 ) -> [0]
+ ( 3 ) -> [0]
+ ( 4 ) -> [0]
+ ( 4 0 ) -> [0.11]
+ ( 2 1 ) -> [0.26]
+ ( 3 2 ) -> [0.28]
+ ( 4 3 ) -> [0.3]
+ ( 4 1 ) -> [0.39]
+ ( 2 0 ) -> [0.77]
+ ( 1 0 ) -> [0.94]
+ ( 4 2 ) -> [0.97]
+ ( 3 0 ) -> [0.99]
+ ( 3 1 ) -> [0.99]
diff --git a/src/Rips_complex/include/gudhi/Rips_complex.h b/src/Rips_complex/include/gudhi/Rips_complex.h
index 6f947f41..63207892 100644
--- a/src/Rips_complex/include/gudhi/Rips_complex.h
+++ b/src/Rips_complex/include/gudhi/Rips_complex.h
@@ -78,6 +78,19 @@ class Rips_complex {
compute_proximity_graph<InputPointRange, Distance >(points, threshold, distance);
}
+ /** \brief Rips_complex constructor from a distance matrix.
+ *
+ * @param[in] distance_matrix Range of distances.
+ * @param[in] threshold rips value.
+ *
+ * The type InputDistanceRange must be a range for which std::begin and std::end return input iterators on a point.
+ */
+ template<typename InputDistanceRange>
+ Rips_complex(const InputDistanceRange& distance_matrix, Filtration_value threshold) {
+ compute_proximity_graph(boost::irange((size_t)0,distance_matrix.size()), threshold,
+ [&](size_t i, size_t j){return distance_matrix[j][i];});
+ }
+
/** \brief Initializes the simplicial complex from the 1-skeleton graph and expands it until a given maximal
* dimension.
*
diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h
index 85310f66..85ae8679 100644
--- a/src/common/doc/main_page.h
+++ b/src/common/doc/main_page.h
@@ -60,7 +60,7 @@
<table border="0">
<tr>
<td width="25%">
- <b>Author:</b> Cl&eacute;ment Maria<br>
+ <b>Author:</b> Cl&eacute;ment Maria, Pawel Dlotko, Vincent Rouvreau<br>
<b>Introduced in:</b> GUDHI 1.4.0<br>
<b>Copyright:</b> GPL v3<br>
</td>
@@ -68,6 +68,7 @@
Rips_complex is a simplicial complex constructed from a one skeleton graph.<br>
The filtration value of each edge is computed from a user-given distance function and is inserted until a
user-given threshold value.<br>
+ This complex can be built from a point cloud and a distance function, or from a distance matrix.<br>
<b>User manual:</b> \ref rips_complex - <b>Reference manual:</b> Gudhi::rips_complex::Rips_complex
</td>
</tr>
diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h
index 006df275..ed2c1f5d 100644
--- a/src/common/include/gudhi/distance_functions.h
+++ b/src/common/include/gudhi/distance_functions.h
@@ -4,7 +4,7 @@
*
* Author(s): Clément Maria
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France)
+ * Copyright (C) 2014 INRIA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,9 +25,12 @@
#include <cmath> // for std::sqrt
-/* Compute the Euclidean distance between two Points given
- * by a range of coordinates. The points are assumed to have
- * the same dimension. */
+/** @file
+ * @brief Global distance functions
+ */
+
+/** @brief Compute the Euclidean distance between two Points given by a range of coordinates. The points are assumed to
+ * have the same dimension. */
template< typename Filtration_value, typename Point >
Filtration_value euclidean_distance(const Point &p1,const Point &p2) {
Filtration_value dist = 0.;
diff --git a/src/common/include/gudhi/graph_simplicial_complex.h b/src/common/include/gudhi/graph_simplicial_complex.h
index 9dbcd891..5fe7c826 100644
--- a/src/common/include/gudhi/graph_simplicial_complex.h
+++ b/src/common/include/gudhi/graph_simplicial_complex.h
@@ -4,7 +4,7 @@
*
* Author(s): Clément Maria
*
- * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France)
+ * Copyright (C) 2014 INRIA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/common/include/gudhi/reader_utils.h b/src/common/include/gudhi/reader_utils.h
index 40d566d8..3799e583 100644
--- a/src/common/include/gudhi/reader_utils.h
+++ b/src/common/include/gudhi/reader_utils.h
@@ -34,14 +34,20 @@
#include <string>
#include <vector>
+// Keep this file tag for Doxygen to parse the code, otherwise, functions are not documented.
+// It is required for global functions and variables.
+
+/** @file
+ * @brief This file includes common file reader for GUDHI
+ */
+
/**
- * \brief Read a set of points to turn it
- * into a vector< vector<double> > by filling points
+ * @brief Read a set of points to turn it into a vector< vector<double> > by filling points.
*
- * File format: 1 point per line
- * X11 X12 ... X1d
- * X21 X22 ... X2d
- * etc
+ * File format: 1 point per line<br>
+ * X11 X12 ... X1d<br>
+ * X21 X22 ... X2d<br>
+ * etc<br>
*/
inline void read_points(std::string file_name, std::vector< std::vector< double > > & points) {
std::ifstream in_file(file_name.c_str(), std::ios::in);
@@ -66,12 +72,12 @@ inline void read_points(std::string file_name, std::vector< std::vector< double
}
/**
- * \brief Read a graph from a file.
+ * @brief Read a graph from a file.
*
- * File format: 1 simplex per line
- * Dim1 X11 X12 ... X1d Fil1
- * Dim2 X21 X22 ... X2d Fil2
- * etc
+ * File format: 1 simplex per line<br>
+ * Dim1 X11 X12 ... X1d Fil1<br>
+ * Dim2 X21 X22 ... X2d Fil2<br>
+ * etc<br>
*
* The vertices must be labeled from 0 to n-1.
* Every simplex must appear exactly once.
@@ -141,12 +147,12 @@ inline Graph_t read_graph(std::string file_name) {
}
/**
- * \brief Read a face from a file.
+ * @brief Read a face from a file.
*
- * File format: 1 simplex per line
- * Dim1 X11 X12 ... X1d Fil1
- * Dim2 X21 X22 ... X2d Fil2
- * etc
+ * File format: 1 simplex per line<br>
+ * Dim1 X11 X12 ... X1d Fil1<br>
+ * Dim2 X21 X22 ... X2d Fil2<br>
+ * etc<br>
*
* The vertices must be labeled from 0 to n-1.
* Every simplex must appear exactly once.
@@ -167,18 +173,16 @@ bool read_simplex(std::istream & in_, std::vector< Vertex_handle > & simplex, Fi
}
/**
- * \brief Read a hasse simplex from a file.
+ * @brief Read a hasse simplex from a file.
*
- * File format: 1 simplex per line
- * Dim1 k11 k12 ... k1Dim1 Fil1
- * Dim2 k21 k22 ... k2Dim2 Fil2
- * etc
+ * File format: 1 simplex per line<br>
+ * Dim1 k11 k12 ... k1Dim1 Fil1<br>
+ * Dim2 k21 k22 ... k2Dim2 Fil2<br>
+ * etc<br>
*
- * The key of a simplex is its position in the filtration order
- * and also the number of its row in the file.
- * Dimi ki1 ki2 ... kiDimi Fili means that the ith simplex in the
- * filtration has dimension Dimi, filtration value fil1 and simplices with
- * key ki1 ... kiDimi in its boundary.*/
+ * The key of a simplex is its position in the filtration order and also the number of its row in the file.
+ * Dimi ki1 ki2 ... kiDimi Fili means that the ith simplex in the filtration has dimension Dimi, filtration value
+ * fil1 and simplices with key ki1 ... kiDimi in its boundary.*/
template< typename Simplex_key, typename Filtration_value >
bool read_hasse_simplex(std::istream & in_, std::vector< Simplex_key > & boundary, Filtration_value & fil) {
int dim;
@@ -197,27 +201,27 @@ bool read_hasse_simplex(std::istream & in_, std::vector< Simplex_key > & boundar
}
/**
- * \brief Read a lower triangular distance matrix from a csv file. We assume that the .csv store the whole
+ * @brief Read a lower triangular distance matrix from a csv file. We assume that the .csv store the whole
* (square) matrix.
*
- * \author Pawel Dlotko
+ * @author Pawel Dlotko
*
- * Square matrix file format:
- * 0;D12;...;D1j
- * D21;0;...;D2j
- * ...
- * Dj1;Dj2;...;0
+ * Square matrix file format:<br>
+ * 0;D12;...;D1j<br>
+ * D21;0;...;D2j<br>
+ * ...<br>
+ * Dj1;Dj2;...;0<br>
*
- * lower matrix file format:
- * 0
- * D21;
- * D31;D32;
- * ...
- * Dj1;Dj2;...;Dj(j-1);
+ * lower matrix file format:<br>
+ * 0<br>
+ * D21;<br>
+ * D31;D32;<br>
+ * ...<br>
+ * Dj1;Dj2;...;Dj(j-1);<br>
*
**/
template< typename Filtration_value >
-std::vector< std::vector< Filtration_value > > read_lower_triangular_matrix_from_csv_file(std::string filename,
+std::vector< std::vector< Filtration_value > > read_lower_triangular_matrix_from_csv_file(const std::string& filename,
const char separator=';') {
bool dbg = false;
if (dbg) {
diff --git a/src/common/test/test_distance_matrix_reader.cpp b/src/common/test/test_distance_matrix_reader.cpp
index 7eb7e846..a4c46bb1 100644
--- a/src/common/test/test_distance_matrix_reader.cpp
+++ b/src/common/test/test_distance_matrix_reader.cpp
@@ -47,21 +47,21 @@ BOOST_AUTO_TEST_CASE( lower_triangular_distance_matrix )
std::cout << "from_lower_triangular size = " << from_lower_triangular.size() << std::endl;
BOOST_CHECK(from_lower_triangular.size() == 5);
- for (int i = 0; i < from_lower_triangular.size(); i++) {
+ for (std::size_t i = 0; i < from_lower_triangular.size(); i++) {
std::cout << "from_lower_triangular[" << i << "] size = " << from_lower_triangular[i].size() << std::endl;
BOOST_CHECK(from_lower_triangular[i].size() == i);
}
std::vector<double> expected = {1};
- BOOST_CHECK(from_lower_triangular[0] == expected);
+ BOOST_CHECK(from_lower_triangular[1] == expected);
expected = {2,3};
- BOOST_CHECK(from_lower_triangular[0] == expected);
+ BOOST_CHECK(from_lower_triangular[2] == expected);
expected = {4,5,6};
- BOOST_CHECK(from_lower_triangular[0] == expected);
+ BOOST_CHECK(from_lower_triangular[3] == expected);
expected = {7,8,9,10};
- BOOST_CHECK(from_lower_triangular[0] == expected);
+ BOOST_CHECK(from_lower_triangular[4] == expected);
}
@@ -78,8 +78,8 @@ BOOST_AUTO_TEST_CASE( full_square_distance_matrix )
}
std::cout << "from_full_square size = " << from_full_square.size() << std::endl;
BOOST_CHECK(from_full_square.size() == 5);
- for (int i = 0; i < from_lower_triangular.size(); i++) {
- std::cout << "from_lower_triangular[" << i << "] size = " << from_lower_triangular[i].size() << std::endl;
- BOOST_CHECK(from_lower_triangular[i].size() == i);
+ for (std::size_t i = 0; i < from_full_square.size(); i++) {
+ std::cout << "from_full_square[" << i << "] size = " << from_full_square[i].size() << std::endl;
+ BOOST_CHECK(from_full_square[i].size() == i);
}
}