From 5f292d2580219097e53753885b02a4cdaba9c798 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 25 Jan 2017 09:58:36 +0000 Subject: Fix code review git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/rips_doc_fixes@2008 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: d742fb816e1c83a85400d2f0c187e045dcea362f --- .../concept/Simplicial_complex_for_rips.h | 5 ++--- src/Rips_complex/doc/Intro_rips_complex.h | 10 +++++----- ...ample_one_skeleton_rips_from_distance_matrix.cpp | 6 +++--- .../example_one_skeleton_rips_from_points.cpp | 6 +++--- ...e_rips_complex_from_csv_distance_matrix_file.cpp | 6 +++--- .../example/example_rips_complex_from_off_file.cpp | 6 +++--- .../example/full_skeleton_rips_for_doc.txt | 2 +- .../example/one_skeleton_rips_for_doc.txt | 2 +- src/Rips_complex/include/gudhi/Rips_complex.h | 21 ++++++++++----------- src/Rips_complex/test/test_rips_complex.cpp | 16 ++++++++-------- 10 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/Rips_complex/concept/Simplicial_complex_for_rips.h b/src/Rips_complex/concept/Simplicial_complex_for_rips.h index dc871177..7dab0615 100644 --- a/src/Rips_complex/concept/Simplicial_complex_for_rips.h +++ b/src/Rips_complex/concept/Simplicial_complex_for_rips.h @@ -31,11 +31,10 @@ namespace rips_complex { * complex, that can be created from a `Rips_complex`. The only available model for the moment is the `Simplex_tree`. */ struct SimplicialComplexForRips { - /** \brief Handle to specify the simplex filtration value. */ + /** \brief Type used to store the filtration values of the simplicial complex. */ typedef unspecified Filtration_value; - /** \brief Inserts a given range `Gudhi::rips_complex::Rips_complex::OneSkeletonGraph` in the simplicial - * complex. */ + /** \brief Inserts a given `Gudhi::rips_complex::Rips_complex::OneSkeletonGraph` in the simplicial complex. */ template void insert_graph(const OneSkeletonGraph& skel_graph); diff --git a/src/Rips_complex/doc/Intro_rips_complex.h b/src/Rips_complex/doc/Intro_rips_complex.h index 64fd34bc..ceecfa7b 100644 --- a/src/Rips_complex/doc/Intro_rips_complex.h +++ b/src/Rips_complex/doc/Intro_rips_complex.h @@ -48,7 +48,7 @@ namespace rips_complex { * All edges that have a filtration value strictly greater than a given threshold value are not inserted into * the complex. * - * When creating a simplicial complex from this one skeleton graph, rips inserts the one skeleton graph into the data + * When creating a simplicial complex from this one skeleton graph, Rips inserts the one skeleton graph into the data * structure, and then expands the simplicial when required. * * \image html "rips_complex_representation.png" "Rips-complex one skeleton graph representation" @@ -68,7 +68,7 @@ namespace rips_complex { * * \include Rips_complex/example_one_skeleton_rips_from_points.cpp * - * When launching (rips maximal distance between 2 points is 12.0, is expanded until dimension 1 - one skeleton graph + * When launching (Rips maximal distance between 2 points is 12.0, is expanded until dimension 1 - one skeleton graph * in other words): * * \code $> ./oneskeletonripspoints @@ -85,7 +85,7 @@ namespace rips_complex { * Then it creates a `Simplex_tree` with it. * * - * Then, it is asked to display information about the rips complex. + * Then, it is asked to display information about the Rips complex. * * \include Rips_complex/example_rips_complex_from_off_file.cpp * @@ -111,7 +111,7 @@ namespace rips_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 + * When launching (Rips maximal distance between 2 points is 1.0, is expanded until dimension 1 - one skeleton graph * with other words): * * \code $> ./oneskeletonripsdistance @@ -127,7 +127,7 @@ namespace rips_complex { * Then it creates a `Simplex_tree` with it. * * - * Then, it is asked to display information about the rips complex. + * Then, it is asked to display information about the Rips complex. * * \include Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp * 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 index 90bd8e38..bbc3c755 100644 --- 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 @@ -29,7 +29,7 @@ int main() { distances.push_back({0.11, 0.39, 0.97, 0.30}); // ---------------------------------------------------------------------------- - // Init of a rips complex from points + // Init of a Rips complex from points // ---------------------------------------------------------------------------- double threshold = 1.0; Rips_complex rips_complex_from_points(distances, threshold); @@ -37,13 +37,13 @@ int main() { Simplex_tree stree; rips_complex_from_points.create_complex(stree, 1); // ---------------------------------------------------------------------------- - // Display information about the one skeleton rips complex + // Display information about the one skeleton Rips complex // ---------------------------------------------------------------------------- std::cout << "Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " << stree.num_vertices() << " vertices." << std::endl; - std::cout << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" << + std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : stree.filtration_simplex_range()) { std::cout << " ( "; 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 5d1216a0..3fd69ebc 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 @@ -24,7 +24,7 @@ int main() { points.push_back({9.0, 17.0}); // ---------------------------------------------------------------------------- - // Init of a rips complex from points + // Init of a Rips complex from points // ---------------------------------------------------------------------------- double threshold = 12.0; Rips_complex rips_complex_from_points(points, threshold, Euclidean_distance()); @@ -32,13 +32,13 @@ int main() { Simplex_tree stree; rips_complex_from_points.create_complex(stree, 1); // ---------------------------------------------------------------------------- - // Display information about the one skeleton rips complex + // Display information about the one skeleton Rips complex // ---------------------------------------------------------------------------- std::cout << "Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " << stree.num_vertices() << " vertices." << std::endl; - std::cout << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" << + std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : stree.filtration_simplex_range()) { std::cout << " ( "; 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 index cc6c3a33..ef3a9d13 100644 --- 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 @@ -29,7 +29,7 @@ int main(int argc, char **argv) { using Distance_matrix = std::vector>; // ---------------------------------------------------------------------------- - // Init of a rips complex from a distance matrix in a csv file + // 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(csv_file_name); @@ -50,13 +50,13 @@ int main(int argc, char **argv) { std::ostream output_stream(streambufffer); // ---------------------------------------------------------------------------- - // Display information about the rips complex + // Display information about the Rips complex // ---------------------------------------------------------------------------- output_stream << "Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " << stree.num_vertices() << " vertices." << std::endl; - output_stream << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" << + output_stream << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : stree.filtration_simplex_range()) { output_stream << " ( "; diff --git a/src/Rips_complex/example/example_rips_complex_from_off_file.cpp b/src/Rips_complex/example/example_rips_complex_from_off_file.cpp index b6c961d0..a1e4e255 100644 --- a/src/Rips_complex/example/example_rips_complex_from_off_file.cpp +++ b/src/Rips_complex/example/example_rips_complex_from_off_file.cpp @@ -29,7 +29,7 @@ int main(int argc, char **argv) { using Rips_complex = Gudhi::rips_complex::Rips_complex; // ---------------------------------------------------------------------------- - // Init of a rips complex from an OFF file + // Init of a Rips complex from an OFF file // ---------------------------------------------------------------------------- Gudhi::Points_off_reader off_reader(off_file_name); Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Euclidean_distance()); @@ -49,13 +49,13 @@ int main(int argc, char **argv) { std::ostream output_stream(streambufffer); // ---------------------------------------------------------------------------- - // Display information about the rips complex + // Display information about the Rips complex // ---------------------------------------------------------------------------- output_stream << "Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " << stree.num_vertices() << " vertices." << std::endl; - output_stream << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" << + output_stream << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : stree.filtration_simplex_range()) { output_stream << " ( "; diff --git a/src/Rips_complex/example/full_skeleton_rips_for_doc.txt b/src/Rips_complex/example/full_skeleton_rips_for_doc.txt index 319931e0..55de4ab8 100644 --- a/src/Rips_complex/example/full_skeleton_rips_for_doc.txt +++ b/src/Rips_complex/example/full_skeleton_rips_for_doc.txt @@ -1,5 +1,5 @@ Rips complex is of dimension 3 - 24 simplices - 7 vertices. -Iterator on rips complex simplices in the filtration order, with [filtration value]: +Iterator on Rips complex simplices in the filtration order, with [filtration value]: ( 0 ) -> [0] ( 1 ) -> [0] ( 2 ) -> [0] diff --git a/src/Rips_complex/example/one_skeleton_rips_for_doc.txt b/src/Rips_complex/example/one_skeleton_rips_for_doc.txt index b0e25cc5..706512a5 100644 --- a/src/Rips_complex/example/one_skeleton_rips_for_doc.txt +++ b/src/Rips_complex/example/one_skeleton_rips_for_doc.txt @@ -1,5 +1,5 @@ Rips complex is of dimension 1 - 18 simplices - 7 vertices. -Iterator on rips complex simplices in the filtration order, with [filtration value]: +Iterator on Rips complex simplices in the filtration order, with [filtration value]: ( 0 ) -> [0] ( 1 ) -> [0] ( 2 ) -> [0] diff --git a/src/Rips_complex/include/gudhi/Rips_complex.h b/src/Rips_complex/include/gudhi/Rips_complex.h index f0f39db8..65e742ce 100644 --- a/src/Rips_complex/include/gudhi/Rips_complex.h +++ b/src/Rips_complex/include/gudhi/Rips_complex.h @@ -51,7 +51,7 @@ namespace rips_complex { * to a given threshold. Edge length is computed from a user given point cloud with a given distance function, or a * distance matrix. * - * \tparam Filtration_value must meet `SimplicialComplexForRips` concept. + * \tparam Filtration_value is the type used to store the filtration values of the simplicial complex. */ template class Rips_complex { @@ -70,7 +70,7 @@ class Rips_complex { /** \brief Rips_complex constructor from a list of points. * * @param[in] points Range of points. - * @param[in] threshold rips value. + * @param[in] threshold Rips value. * @param[in] distance distance function that returns a `Filtration_value` from 2 given points. * * \tparam InputPointRange must be a range for which `std::begin` and `std::end` return input iterators on a @@ -81,20 +81,20 @@ class Rips_complex { */ template Rips_complex(const InputPointRange& points, Filtration_value threshold, Distance distance) { - compute_proximity_graph(points, threshold, distance); + compute_proximity_graph(points, threshold, distance); } /** \brief Rips_complex constructor from a distance matrix. * * @param[in] distance_matrix Range of distances. - * @param[in] threshold rips value. + * @param[in] threshold Rips value. * - * \tparam InputDistanceRange must have a `size()` method and on which `distance_matrix[i][j]` returns - * the distance between points \f$i\f$ and \f$j\f$ as long as \f$ 0 \leqslant i \leqslant j \leqslant + * \tparam DistanceMatrix must have a `size()` method and on which `distance_matrix[i][j]` returns + * the distance between points \f$i\f$ and \f$j\f$ as long as \f$ 0 \leqslant i < j \leqslant * distance\_matrix.size().\f$ */ - template - Rips_complex(const InputDistanceRange& distance_matrix, Filtration_value threshold) { + template + Rips_complex(const DistanceMatrix& 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];}); } @@ -105,7 +105,7 @@ class Rips_complex { * \tparam SimplicialComplexForRips must meet `SimplicialComplexForRips` concept. * * @param[in] complex SimplicialComplexForRips to be created. - * @param[in] dim_max graph expansion for rips until this given maximal dimension. + * @param[in] dim_max graph expansion for Rips until this given maximal dimension. * @exception std::invalid_argument In debug mode, if `complex.num_vertices()` does not return 0. * */ @@ -144,7 +144,7 @@ class Rips_complex { // -------------------------------------------------------------------------------------------- // Creates the vector of edges and its filtration values (returned by distance function) Vertex_handle idx_u = 0; - for (auto it_u = std::begin(points); it_u != std::end(points); ++it_u) { + for (auto it_u = std::begin(points); it_u != std::end(points); ++it_u, ++idx_u) { Vertex_handle idx_v = idx_u + 1; for (auto it_v = it_u + 1; it_v != std::end(points); ++it_v, ++idx_v) { Filtration_value fil = distance(*it_u, *it_v); @@ -153,7 +153,6 @@ class Rips_complex { edges_fil.push_back(fil); } } - ++idx_u; } // -------------------------------------------------------------------------------------------- diff --git a/src/Rips_complex/test/test_rips_complex.cpp b/src/Rips_complex/test/test_rips_complex.cpp index 1bdd0512..ae68ba0d 100644 --- a/src/Rips_complex/test/test_rips_complex.cpp +++ b/src/Rips_complex/test/test_rips_complex.cpp @@ -51,12 +51,12 @@ bool are_almost_the_same(float a, float b) { BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) { // ---------------------------------------------------------------------------- // - // Init of a rips complex from a OFF file + // Init of a Rips complex from a OFF file // // ---------------------------------------------------------------------------- std::string off_file_name("alphacomplexdoc.off"); double rips_threshold = 12.0; - std::cout << "========== OFF FILE NAME = " << off_file_name << " - rips threshold=" << + std::cout << "========== OFF FILE NAME = " << off_file_name << " - Rips threshold=" << rips_threshold << "==========" << std::endl; Gudhi::Points_off_reader off_reader(off_file_name); @@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE(Rips_complex_from_points) { points.push_back(Point(coords.begin(), coords.end())); // ---------------------------------------------------------------------------- - // Init of a rips complex from the list of points + // Init of a Rips complex from the list of points // ---------------------------------------------------------------------------- Rips_complex rips_complex_from_points(points, 2.0, Custom_square_euclidean_distance()); @@ -195,7 +195,7 @@ BOOST_AUTO_TEST_CASE(Rips_complex_from_points) { rips_complex_from_points.create_complex(st, DIMENSION); // Another way to check num_simplices - std::cout << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; int num_simplices = 0; for (auto f_simplex : st.filtration_simplex_range()) { num_simplices++; @@ -236,12 +236,12 @@ BOOST_AUTO_TEST_CASE(Rips_complex_from_points) { BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) { // ---------------------------------------------------------------------------- // - // Init of a rips complex from a OFF file + // Init of a Rips complex from a OFF file // // ---------------------------------------------------------------------------- std::string csv_file_name("full_square_distance_matrix.csv"); double rips_threshold = 12.0; - std::cout << "========== CSV FILE NAME = " << csv_file_name << " - rips threshold=" << + std::cout << "========== CSV FILE NAME = " << csv_file_name << " - Rips threshold=" << rips_threshold << "==========" << std::endl; Distance_matrix distances = read_lower_triangular_matrix_from_csv_file(csv_file_name); @@ -332,12 +332,12 @@ BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) { BOOST_AUTO_TEST_CASE(Rips_create_complex_throw) { // ---------------------------------------------------------------------------- // - // Init of a rips complex from a OFF file + // Init of a Rips complex from a OFF file // // ---------------------------------------------------------------------------- std::string off_file_name("alphacomplexdoc.off"); double rips_threshold = 12.0; - std::cout << "========== OFF FILE NAME = " << off_file_name << " - rips threshold=" << + std::cout << "========== OFF FILE NAME = " << off_file_name << " - Rips threshold=" << rips_threshold << "==========" << std::endl; Gudhi::Points_off_reader off_reader(off_file_name); -- cgit v1.2.3