From 54e0cec31e556c88d9f8107394ad972883fdbbdf Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Fri, 11 Sep 2020 17:41:39 +0200 Subject: Add weighted ctor and its test --- .../test/Weighted_alpha_complex_unit_test.cpp | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp (limited to 'src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp') diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp new file mode 100644 index 00000000..b4fc76de --- /dev/null +++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp @@ -0,0 +1,82 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Vincent Rouvreau + * + * Copyright (C) 2020 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE "weighted_alpha_complex" +#include +#include + +#include +#include + +#include // float comparison +#include +#include + +#include +#include +#include + +// Use dynamic_dimension_tag for the user to be able to set dimension +typedef CGAL::Epeck_d< CGAL::Dynamic_dimension_tag > Exact_kernel_d; +// Use static dimension_tag for the user not to be able to set dimension +typedef CGAL::Epeck_d< CGAL::Dimension_tag<4> > Exact_kernel_s; +// Use dynamic_dimension_tag for the user to be able to set dimension +typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Inexact_kernel_d; +// Use static dimension_tag for the user not to be able to set dimension +typedef CGAL::Epick_d< CGAL::Dimension_tag<4> > Inexact_kernel_s; +// The triangulation uses the default instantiation of the TriangulationDataStructure template parameter + +typedef boost::mpl::list list_of_kernel_variants; + +BOOST_AUTO_TEST_CASE_TEMPLATE(Zero_weighted_alpha_complex, Kernel, list_of_kernel_variants) { + // Random points construction + using Point_d = typename Kernel::Point_d; + std::vector points; + std::uniform_real_distribution rd_pts(-10., 10.); + std::random_device rand_dev; + std::mt19937 rand_engine(rand_dev()); + for (int idx = 0; idx < 20; idx++) { + std::vector point {rd_pts(rand_engine), rd_pts(rand_engine), rd_pts(rand_engine), rd_pts(rand_engine)}; + points.emplace_back(Point_d(point.begin(), point.end())); + } + + // Alpha complex from points + Gudhi::alpha_complex::Alpha_complex alpha_complex_from_points(points); + Gudhi::Simplex_tree<> simplex; + BOOST_CHECK(alpha_complex_from_points.create_complex(simplex)); + std::clog << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + for (auto f_simplex : simplex.filtration_simplex_range()) { + std::clog << " ( "; + for (auto vertex : simplex.simplex_vertex_range(f_simplex)) { + std::clog << vertex << " "; + } + std::clog << ") -> " << "[" << simplex.filtration(f_simplex) << "] "; + std::clog << std::endl; + } + + // Alpha complex from zero weighted points + std::vector weights(20, 0.); + Gudhi::alpha_complex::Alpha_complex alpha_complex_from_zero_weighted_points(points, weights); + Gudhi::Simplex_tree<> zw_simplex; + BOOST_CHECK(alpha_complex_from_zero_weighted_points.create_complex(zw_simplex)); + + std::clog << "Iterator on zero weighted alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + for (auto f_simplex : zw_simplex.filtration_simplex_range()) { + std::clog << " ( "; + for (auto vertex : zw_simplex.simplex_vertex_range(f_simplex)) { + std::clog << vertex << " "; + } + std::clog << ") -> " << "[" << zw_simplex.filtration(f_simplex) << "] "; + std::clog << std::endl; + } + + BOOST_CHECK(zw_simplex == simplex); +} \ No newline at end of file -- cgit v1.2.3 From 5e3871c2d99249bd7560faa4e1229d3b3751b0ff Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Mon, 14 Sep 2020 11:17:40 +0200 Subject: alpha_complex_persistence utils can use weighted points. Update Alpha_kernel_d_unit_test to work --- .../test/Alpha_kernel_d_unit_test.cpp | 28 ------ .../test/Weighted_alpha_complex_unit_test.cpp | 2 +- .../utilities/alpha_complex_persistence.cpp | 101 ++++++++++++++++----- src/Alpha_complex/utilities/alphacomplex.md | 7 ++ 4 files changed, 84 insertions(+), 54 deletions(-) (limited to 'src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp') diff --git a/src/Alpha_complex/test/Alpha_kernel_d_unit_test.cpp b/src/Alpha_complex/test/Alpha_kernel_d_unit_test.cpp index 70b65aad..192834b3 100644 --- a/src/Alpha_complex/test/Alpha_kernel_d_unit_test.cpp +++ b/src/Alpha_complex/test/Alpha_kernel_d_unit_test.cpp @@ -102,31 +102,3 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_kernel_d_sphere, TestedKernel, list_of_kerne std::clog << "Squared radius is " << w_sq_rd << std::endl; GUDHI_TEST_FLOAT_EQUALITY_CHECK(cast_to_double(w_sphere.weight()), cast_to_double(w_sq_rd)); } - - -BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_kernel_d_distance, TestedKernel, list_of_kernel_variants) { - using Unweighted_kernel = Gudhi::alpha_complex::Alpha_kernel_d; - - std::vector p0 {1., 0., 0., 0.}; - std::vector p1 {0., 1., 0., 0.}; - - using Point_d = typename Unweighted_kernel::Point_d; - Unweighted_kernel kernel; - auto dist_01 = kernel.get_squared_distance(Point_d(p0.begin(), p0.end()), Point_d(p1.begin(), p1.end())); - std::clog << "Distance is " << dist_01 << std::endl; - - using Weighted_kernel = Gudhi::alpha_complex::Alpha_kernel_d; - - using Weighted_point_d = typename Weighted_kernel::Weighted_point_d; - using Bare_point_d = typename Weighted_kernel::Bare_point_d; - std::vector w_pts; - - Weighted_kernel w_kernel; - auto w_dist_01 = w_kernel.get_squared_distance(Weighted_point_d(Bare_point_d(p0.begin(), p0.end()), 0.), - Weighted_point_d(Bare_point_d(p1.begin(), p1.end()), 0.)); - std::clog << "Distance is " << w_dist_01 << std::endl; - - CGAL::NT_converter cast_to_double; - // The results shall be the same with weights = 0. - GUDHI_TEST_FLOAT_EQUALITY_CHECK(cast_to_double(dist_01), cast_to_double(w_dist_01)); -} diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp index b4fc76de..57a57058 100644 --- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -32,7 +33,6 @@ typedef CGAL::Epeck_d< CGAL::Dimension_tag<4> > Exact_kernel_s; typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Inexact_kernel_d; // Use static dimension_tag for the user not to be able to set dimension typedef CGAL::Epick_d< CGAL::Dimension_tag<4> > Inexact_kernel_s; -// The triangulation uses the default instantiation of the TriangulationDataStructure template parameter typedef boost::mpl::list list_of_kernel_variants; diff --git a/src/Alpha_complex/utilities/alpha_complex_persistence.cpp b/src/Alpha_complex/utilities/alpha_complex_persistence.cpp index e17831d9..e86b34e2 100644 --- a/src/Alpha_complex/utilities/alpha_complex_persistence.cpp +++ b/src/Alpha_complex/utilities/alpha_complex_persistence.cpp @@ -17,19 +17,82 @@ #include // to construct a simplex_tree from alpha complex #include +#include #include #include #include // for numeric_limits +#include +#include using Simplex_tree = Gudhi::Simplex_tree<>; using Filtration_value = Simplex_tree::Filtration_value; void program_options(int argc, char *argv[], std::string &off_file_points, bool &exact, bool &fast, - std::string &output_file_diag, Filtration_value &alpha_square_max_value, + std::string &weight_file, std::string &output_file_diag, Filtration_value &alpha_square_max_value, int &coeff_field_characteristic, Filtration_value &min_persistence); +template +std::vector read_off(const std::string &off_file_points) { + Gudhi::Points_off_reader off_reader(off_file_points); + if (!off_reader.is_valid()) { + std::cerr << "Alpha_complex - Unable to read file " << off_file_points << "\n"; + exit(-1); // ----- >> + } + return off_reader.get_point_cloud(); +} + +std::vector read_weight_file(const std::string &weight_file) { + std::vector weights; + // Read weights information from file + std::ifstream weights_ifstr(weight_file); + if (weights_ifstr.good()) { + double weight = 0.0; + // Attempt read the weight in a double format, return false if it fails + while (weights_ifstr >> weight) { + weights.push_back(weight); + } + } else { + std::cerr << "Unable to read weights file " << weight_file << std::endl; + exit(-1); + } + return weights; +} + +template +Simplex_tree create_simplex_tree(const std::string &off_file_points, const std::string &weight_file, + bool exact_version, Filtration_value alpha_square_max_value) { + Simplex_tree stree; + auto points = read_off(off_file_points); + + if (weight_file != std::string()) { + std::vector weights = read_weight_file(weight_file); + if (points.size() != weights.size()) { + std::cerr << "Alpha_complex - Inconsistency between number of points (" << points.size() + << ") and number of weights (" << weights.size() << ")" << "\n"; + exit(-1); // ----- >> + } + // Init of an alpha complex from an OFF file + Gudhi::alpha_complex::Alpha_complex alpha_complex_from_file(points, weights); + + if (!alpha_complex_from_file.create_complex(stree, alpha_square_max_value, exact_version)) { + std::cerr << "Alpha complex simplicial complex creation failed." << std::endl; + exit(-1); + } + } else { + // Init of an alpha complex from an OFF file + Gudhi::alpha_complex::Alpha_complex alpha_complex_from_file(points); + + if (!alpha_complex_from_file.create_complex(stree, alpha_square_max_value, exact_version)) { + std::cerr << "Alpha complex simplicial complex creation failed." << std::endl; + exit(-1); + } + } + return stree; +} + int main(int argc, char **argv) { + std::string weight_file; std::string off_file_points; std::string output_file_diag; bool exact_version = false; @@ -38,48 +101,34 @@ int main(int argc, char **argv) { int coeff_field_characteristic; Filtration_value min_persistence; - program_options(argc, argv, off_file_points, exact_version, fast_version, output_file_diag, alpha_square_max_value, - coeff_field_characteristic, min_persistence); + program_options(argc, argv, off_file_points, exact_version, fast_version, weight_file, output_file_diag, + alpha_square_max_value, coeff_field_characteristic, min_persistence); if ((exact_version) && (fast_version)) { std::cerr << "You cannot set the exact and the fast version." << std::endl; exit(-1); } - Simplex_tree simplex; + Simplex_tree stree; if (fast_version) { // WARNING : CGAL::Epick_d is fast but not safe (unlike CGAL::Epeck_d) // (i.e. when the points are on a grid) using Fast_kernel = CGAL::Epick_d; - - // Init of an alpha complex from an OFF file - Gudhi::alpha_complex::Alpha_complex alpha_complex_from_file(off_file_points); - - if (!alpha_complex_from_file.create_complex(simplex, alpha_square_max_value)) { - std::cerr << "Fast Alpha complex simplicial complex creation failed." << std::endl; - exit(-1); - } + stree = create_simplex_tree(off_file_points, weight_file, exact_version, alpha_square_max_value); } else { using Kernel = CGAL::Epeck_d; - - // Init of an alpha complex from an OFF file - Gudhi::alpha_complex::Alpha_complex alpha_complex_from_file(off_file_points); - - if (!alpha_complex_from_file.create_complex(simplex, alpha_square_max_value, exact_version)) { - std::cerr << "Alpha complex simplicial complex creation failed." << std::endl; - exit(-1); - } + stree = create_simplex_tree(off_file_points, weight_file, exact_version, alpha_square_max_value); } // ---------------------------------------------------------------------------- // Display information about the alpha complex // ---------------------------------------------------------------------------- - std::clog << "Simplicial complex is of dimension " << simplex.dimension() << " - " << simplex.num_simplices() - << " simplices - " << simplex.num_vertices() << " vertices." << std::endl; + std::clog << "Simplicial complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() + << " simplices - " << stree.num_vertices() << " vertices." << std::endl; - std::clog << "Simplex_tree dim: " << simplex.dimension() << std::endl; + std::clog << "Simplex_tree dim: " << stree.dimension() << std::endl; // Compute the persistence diagram of the complex Gudhi::persistent_cohomology::Persistent_cohomology pcoh( - simplex); + stree); // initializes the coefficient field for homology pcoh.init_coefficients(coeff_field_characteristic); @@ -98,7 +147,7 @@ int main(int argc, char **argv) { } void program_options(int argc, char *argv[], std::string &off_file_points, bool &exact, bool &fast, - std::string &output_file_diag, Filtration_value &alpha_square_max_value, + std::string &weight_file, std::string &output_file_diag, Filtration_value &alpha_square_max_value, int &coeff_field_characteristic, Filtration_value &min_persistence) { namespace po = boost::program_options; po::options_description hidden("Hidden options"); @@ -111,6 +160,8 @@ void program_options(int argc, char *argv[], std::string &off_file_points, bool "To activate exact version of Alpha complex (default is false, not available if fast is set)")( "fast,f", po::bool_switch(&fast), "To activate fast version of Alpha complex (default is false, not available if exact is set)")( + "weight-file,w", po::value(&weight_file)->default_value(std::string()), + "Name of file containing a point weights. Format is one weight per line:\n W1\n ...\n Wn ")( "output-file,o", po::value(&output_file_diag)->default_value(std::string()), "Name of file in which the persistence diagram is written. Default print in std::clog")( "max-alpha-square-value,r", po::value(&alpha_square_max_value) diff --git a/src/Alpha_complex/utilities/alphacomplex.md b/src/Alpha_complex/utilities/alphacomplex.md index 527598a9..0d3c6027 100644 --- a/src/Alpha_complex/utilities/alphacomplex.md +++ b/src/Alpha_complex/utilities/alphacomplex.md @@ -46,6 +46,9 @@ for the Alpha complex construction. coefficient field Z/pZ for computing homology. * `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. +* `-w [ --weight-file ]` is the path to the file containing the weights of the +points (one value per line). +Default version is not weighted. * `-e [ --exact ]` for the exact computation version. * `-f [ --fast ]` for the fast computation version. @@ -58,6 +61,10 @@ to be recorded. Enter a negative value to see zero length intervals. N.B.: * Filtration values are alpha square values. +* Weights values are explained on CGAL +[dD Triangulations](https://doc.cgal.org/latest/Triangulation/index.html) +and +[Regular triangulation](https://doc.cgal.org/latest/Triangulation/index.html#title20) documentation. ## alpha_complex_3d_persistence ## -- cgit v1.2.3 From de39546182c20a69e45aa07830351f6e9d2e4b84 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Mon, 14 Sep 2020 17:27:40 +0200 Subject: Add but comment a test to compare dD and 3D alpha complex --- src/Alpha_complex/include/gudhi/Alpha_complex.h | 2 - .../test/Weighted_alpha_complex_unit_test.cpp | 79 +++++++++++++++++++++- 2 files changed, 78 insertions(+), 3 deletions(-) (limited to 'src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h index 00231e1c..e1aae2d4 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h @@ -267,8 +267,6 @@ class Alpha_complex { // Save index value as data to retrieve it after insertion pos->data() = index; hint = pos->full_cell(); - } else { - std::cout << "NULLPTR" << std::endl; } } // -------------------------------------------------------------------------------------------- diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp index 57a57058..bf659ef7 100644 --- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp @@ -79,4 +79,81 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Zero_weighted_alpha_complex, Kernel, list_of_kerne } BOOST_CHECK(zw_simplex == simplex); -} \ No newline at end of file +} + +template +bool cgal_3d_point_sort (Point_d a,Point_d b) { + if (a[0] != b[0]) + return a[0] < b[0]; + if (a[1] != b[1]) + return a[1] < b[1]; + return a[2] < b[2]; +} + +/*BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { + // Random points construction + using Kernel_dD = CGAL::Epeck_d< CGAL::Dimension_tag<3> >; + using Bare_point_d = typename Kernel_dD::Point_d; + using Weighted_point_d = typename Kernel_dD::Weighted_point_d; + std::vector w_points_d; + + using Exact_weighted_alpha_complex_3d = + Gudhi::alpha_complex::Alpha_complex_3d; + using Bare_point_3 = typename Exact_weighted_alpha_complex_3d::Bare_point_3; + using Weighted_point_3 = typename Exact_weighted_alpha_complex_3d::Weighted_point_3; + std::vector w_points_3; + + std::uniform_real_distribution rd_pts(-10., 10.); + std::uniform_real_distribution rd_wghts(-0.5, 0.5); + std::random_device rand_dev; + std::mt19937 rand_engine(rand_dev()); + for (int idx = 0; idx < 20; idx++) { + std::vector point {rd_pts(rand_engine), rd_pts(rand_engine), rd_pts(rand_engine)}; + double weight = rd_wghts(rand_engine); + w_points_d.emplace_back(Weighted_point_d(Bare_point_d(point.begin(), point.end()), weight)); + w_points_3.emplace_back(Weighted_point_3(Bare_point_3(point[0], point[1], point[2]), weight)); + } + + // Weighted alpha complex for dD version + Gudhi::alpha_complex::Alpha_complex alpha_complex_dD_from_weighted_points(w_points_d); + Gudhi::Simplex_tree<> w_simplex_d; + BOOST_CHECK(alpha_complex_dD_from_weighted_points.create_complex(w_simplex_d)); + + std::clog << "Iterator on weighted alpha complex dD simplices in the filtration order, with [filtration value]:" << std::endl; + for (auto f_simplex : w_simplex_d.filtration_simplex_range()) { + std::clog << " ( "; + std::vector points; + for (auto vertex : w_simplex_d.simplex_vertex_range(f_simplex)) { + points.emplace_back(alpha_complex_dD_from_weighted_points.get_point(vertex).point()); + } + std::sort (points.begin(), points.end(), cgal_3d_point_sort); + for (auto point : points) { + std::clog << point[0] << " " << point[1] << " " << point[2] << " | "; + } + std::clog << ") -> " << "[" << w_simplex_d.filtration(f_simplex) << "] "; + std::clog << std::endl; + } + + // Weighted alpha complex for 3D version + Exact_weighted_alpha_complex_3d alpha_complex_3D_from_weighted_points(w_points_3); + Gudhi::Simplex_tree<> w_simplex_3; + BOOST_CHECK(alpha_complex_3D_from_weighted_points.create_complex(w_simplex_3)); + + std::clog << "Iterator on weighted alpha complex 3D simplices in the filtration order, with [filtration value]:" << std::endl; + for (auto f_simplex : w_simplex_3.filtration_simplex_range()) { + std::clog << " ( "; + std::vector points; + for (auto vertex : w_simplex_3.simplex_vertex_range(f_simplex)) { + points.emplace_back(alpha_complex_3D_from_weighted_points.get_point(vertex).point()); + } + std::sort (points.begin(), points.end()); + for (auto point : points) { + std::clog << point[0] << " " << point[1] << " " << point[2] << " | "; + } + std::clog << ") -> " << "[" << w_simplex_3.filtration(f_simplex) << "] "; + std::clog << std::endl; + } + + BOOST_CHECK(w_simplex_d == w_simplex_3); + +}*/ \ No newline at end of file -- cgit v1.2.3 From d6f68d20e975e0cd530cd15ca5f7f782550e6af4 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 15 Sep 2020 16:57:15 +0200 Subject: Test alpha complex dD versus 3d --- .../test/Weighted_alpha_complex_unit_test.cpp | 54 +++++++++++++++++----- 1 file changed, 43 insertions(+), 11 deletions(-) (limited to 'src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp') diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp index bf659ef7..e8372656 100644 --- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp @@ -19,6 +19,8 @@ #include // float comparison #include #include +#include +#include // for std::fabs #include #include @@ -90,7 +92,7 @@ bool cgal_3d_point_sort (Point_d a,Point_d b) { return a[2] < b[2]; } -/*BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { +BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { // Random points construction using Kernel_dD = CGAL::Epeck_d< CGAL::Dimension_tag<3> >; using Bare_point_d = typename Kernel_dD::Point_d; @@ -114,6 +116,12 @@ bool cgal_3d_point_sort (Point_d a,Point_d b) { w_points_3.emplace_back(Weighted_point_3(Bare_point_3(point[0], point[1], point[2]), weight)); } + // Structures necessary for comparison + using Points = std::vector>; + using Points_and_filtrations = std::map; + Points_and_filtrations pts_fltr_dD; + Points_and_filtrations pts_fltr_3d; + // Weighted alpha complex for dD version Gudhi::alpha_complex::Alpha_complex alpha_complex_dD_from_weighted_points(w_points_d); Gudhi::Simplex_tree<> w_simplex_d; @@ -121,17 +129,20 @@ bool cgal_3d_point_sort (Point_d a,Point_d b) { std::clog << "Iterator on weighted alpha complex dD simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : w_simplex_d.filtration_simplex_range()) { - std::clog << " ( "; - std::vector points; + Points points; for (auto vertex : w_simplex_d.simplex_vertex_range(f_simplex)) { - points.emplace_back(alpha_complex_dD_from_weighted_points.get_point(vertex).point()); + CGAL::NT_converter cgal_converter; + Bare_point_d pt = alpha_complex_dD_from_weighted_points.get_point(vertex).point(); + points.push_back({cgal_converter(pt[0]), cgal_converter(pt[1]), cgal_converter(pt[2])}); } - std::sort (points.begin(), points.end(), cgal_3d_point_sort); + std::clog << " ( "; + std::sort (points.begin(), points.end()); for (auto point : points) { std::clog << point[0] << " " << point[1] << " " << point[2] << " | "; } std::clog << ") -> " << "[" << w_simplex_d.filtration(f_simplex) << "] "; std::clog << std::endl; + pts_fltr_dD[points] = w_simplex_d.filtration(f_simplex); } // Weighted alpha complex for 3D version @@ -141,19 +152,40 @@ bool cgal_3d_point_sort (Point_d a,Point_d b) { std::clog << "Iterator on weighted alpha complex 3D simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : w_simplex_3.filtration_simplex_range()) { - std::clog << " ( "; - std::vector points; + Points points; for (auto vertex : w_simplex_3.simplex_vertex_range(f_simplex)) { - points.emplace_back(alpha_complex_3D_from_weighted_points.get_point(vertex).point()); + Bare_point_3 pt = alpha_complex_3D_from_weighted_points.get_point(vertex).point(); + CGAL::NT_converter cgal_converter; + points.push_back({cgal_converter(pt[0]), cgal_converter(pt[1]), cgal_converter(pt[2])}); } + std::clog << " ( "; std::sort (points.begin(), points.end()); for (auto point : points) { std::clog << point[0] << " " << point[1] << " " << point[2] << " | "; } std::clog << ") -> " << "[" << w_simplex_3.filtration(f_simplex) << "] "; std::clog << std::endl; + pts_fltr_3d[points] = w_simplex_d.filtration(f_simplex); } - BOOST_CHECK(w_simplex_d == w_simplex_3); - -}*/ \ No newline at end of file + // Compares structures + auto d3_itr = pts_fltr_3d.begin(); + auto dD_itr = pts_fltr_dD.begin(); + for (; d3_itr != pts_fltr_3d.end() && dD_itr != pts_fltr_dD.end(); ++d3_itr) { + if (d3_itr->first != dD_itr->first) { + for(auto point : d3_itr->first) + std::clog << point[0] << " " << point[1] << " " << point[2] << " | "; + std::clog << " versus "; + for(auto point : dD_itr->first) + std::clog << point[0] << " " << point[1] << " " << point[2] << " | "; + std::clog << std::endl; + BOOST_CHECK(false); + } + // I had to make a hard limit as it is converted from Kernel::FT + if (std::fabs(d3_itr->second - dD_itr->second) > 1e-5) { + std::clog << d3_itr->second << " versus " << dD_itr->second << " diff " << std::fabs(d3_itr->second - dD_itr->second) << std::endl; + BOOST_CHECK(false); + } + ++dD_itr; + } +} -- cgit v1.2.3 From 4d8c5c315b79260fbae05d359987c8d39a863d2d Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 27 Oct 2020 11:15:36 +0100 Subject: zero weighted test is guaranteed only for exact version --- src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp') diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp index e8372656..cae9dbb5 100644 --- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp @@ -29,14 +29,10 @@ // Use dynamic_dimension_tag for the user to be able to set dimension typedef CGAL::Epeck_d< CGAL::Dynamic_dimension_tag > Exact_kernel_d; -// Use static dimension_tag for the user not to be able to set dimension +// Use static dimension_tag to set dimension at 4 typedef CGAL::Epeck_d< CGAL::Dimension_tag<4> > Exact_kernel_s; -// Use dynamic_dimension_tag for the user to be able to set dimension -typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Inexact_kernel_d; -// Use static dimension_tag for the user not to be able to set dimension -typedef CGAL::Epick_d< CGAL::Dimension_tag<4> > Inexact_kernel_s; -typedef boost::mpl::list list_of_kernel_variants; +typedef boost::mpl::list list_of_kernel_variants; BOOST_AUTO_TEST_CASE_TEMPLATE(Zero_weighted_alpha_complex, Kernel, list_of_kernel_variants) { // Random points construction @@ -53,7 +49,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Zero_weighted_alpha_complex, Kernel, list_of_kerne // Alpha complex from points Gudhi::alpha_complex::Alpha_complex alpha_complex_from_points(points); Gudhi::Simplex_tree<> simplex; - BOOST_CHECK(alpha_complex_from_points.create_complex(simplex)); + BOOST_CHECK(alpha_complex_from_points.create_complex(simplex, std::numeric_limits::Filtration_value>::infinity(), true)); std::clog << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : simplex.filtration_simplex_range()) { std::clog << " ( "; @@ -68,7 +64,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Zero_weighted_alpha_complex, Kernel, list_of_kerne std::vector weights(20, 0.); Gudhi::alpha_complex::Alpha_complex alpha_complex_from_zero_weighted_points(points, weights); Gudhi::Simplex_tree<> zw_simplex; - BOOST_CHECK(alpha_complex_from_zero_weighted_points.create_complex(zw_simplex)); + BOOST_CHECK(alpha_complex_from_zero_weighted_points.create_complex(zw_simplex, std::numeric_limits::Filtration_value>::infinity(), true)); std::clog << "Iterator on zero weighted alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : zw_simplex.filtration_simplex_range()) { -- cgit v1.2.3 From beaa5c2fa89ed92c84328383ac58f1e71cf510ff Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 27 Oct 2020 12:16:34 +0100 Subject: Add a test for non visible points (hidden by weights) --- .../test/Weighted_alpha_complex_unit_test.cpp | 35 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp') diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp index cae9dbb5..cc63ac1f 100644 --- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Zero_weighted_alpha_complex, Kernel, list_of_kerne std::mt19937 rand_engine(rand_dev()); for (int idx = 0; idx < 20; idx++) { std::vector point {rd_pts(rand_engine), rd_pts(rand_engine), rd_pts(rand_engine), rd_pts(rand_engine)}; - points.emplace_back(Point_d(point.begin(), point.end())); + points.emplace_back(point.begin(), point.end()); } // Alpha complex from points @@ -108,8 +108,8 @@ BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { for (int idx = 0; idx < 20; idx++) { std::vector point {rd_pts(rand_engine), rd_pts(rand_engine), rd_pts(rand_engine)}; double weight = rd_wghts(rand_engine); - w_points_d.emplace_back(Weighted_point_d(Bare_point_d(point.begin(), point.end()), weight)); - w_points_3.emplace_back(Weighted_point_3(Bare_point_3(point[0], point[1], point[2]), weight)); + w_points_d.emplace_back(Bare_point_d(point.begin(), point.end()), weight); + w_points_3.emplace_back(Bare_point_3(point[0], point[1], point[2]), weight); } // Structures necessary for comparison @@ -185,3 +185,32 @@ BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { ++dD_itr; } } + +BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_non_visible_points) { + using Point_d = typename Exact_kernel_d::Point_d; + std::vector points; + std::vector p1 {0.}; + points.emplace_back(p1.begin(), p1.end()); + // closed enough points + std::vector p2 {0.1}; + points.emplace_back(p2.begin(), p2.end()); + std::vector weights {100., 0.01}; + + Gudhi::alpha_complex::Alpha_complex alpha_complex(points, weights); + Gudhi::Simplex_tree<> stree; + BOOST_CHECK(alpha_complex.create_complex(stree)); + + std::clog << "Iterator on weighted alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + for (auto f_simplex : stree.filtration_simplex_range()) { + std::clog << " ( "; + for (auto vertex : stree.simplex_vertex_range(f_simplex)) { + std::clog << vertex << " "; + } + std::clog << ") -> " << "[" << stree.filtration(f_simplex) << "] "; + std::clog << std::endl; + } + + BOOST_CHECK(stree.filtration(stree.find({0})) == -100.); + BOOST_CHECK(stree.filtration(stree.find({1})) == stree.filtration(stree.find({0, 1}))); + +} \ No newline at end of file -- cgit v1.2.3 From 901fbd0ccdee2d9bb7794de8896d35aae8ede989 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 27 Oct 2020 14:45:25 +0100 Subject: Add a test about the filtration --- src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp') diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp index cc63ac1f..b84ab3de 100644 --- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp @@ -212,5 +212,6 @@ BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_non_visible_points) { BOOST_CHECK(stree.filtration(stree.find({0})) == -100.); BOOST_CHECK(stree.filtration(stree.find({1})) == stree.filtration(stree.find({0, 1}))); + BOOST_CHECK(stree.filtration(stree.find({1})) > 100000); } \ No newline at end of file -- cgit v1.2.3 From 69c70afd0442774582b7e930bdab603600a3e750 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 3 Nov 2020 11:33:39 +0100 Subject: doc review: explain briefly test aims --- .../test/Alpha_kernel_d_unit_test.cpp | 5 ++++ .../test/Weighted_alpha_complex_unit_test.cpp | 30 ++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) (limited to 'src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp') diff --git a/src/Alpha_complex/test/Alpha_kernel_d_unit_test.cpp b/src/Alpha_complex/test/Alpha_kernel_d_unit_test.cpp index 6eae103d..6da4c084 100644 --- a/src/Alpha_complex/test/Alpha_kernel_d_unit_test.cpp +++ b/src/Alpha_complex/test/Alpha_kernel_d_unit_test.cpp @@ -37,6 +37,8 @@ typedef CGAL::Epick_d< CGAL::Dimension_tag<4> > Inexact_kernel_s; typedef boost::mpl::list list_of_kernel_variants; BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_kernel_d_dimension, TestedKernel, list_of_kernel_variants) { + // Test for a point (weighted or not) in 4d, that the dimension is 4. + Gudhi::alpha_complex::Alpha_kernel_d kernel; std::vector p0 {0., 1., 2., 3.}; typename TestedKernel::Point_d p0_d(p0.begin(), p0.end()); @@ -52,6 +54,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_kernel_d_dimension, TestedKernel, list_of_ke } BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_kernel_d_sphere, TestedKernel, list_of_kernel_variants) { + // Test with 5 points on a 3-sphere, that get_sphere returns the same center and squared radius + // for dD unweighted and for dD weighted with all weights at 0. + using Unweighted_kernel = Gudhi::alpha_complex::Alpha_kernel_d; // Sphere: (x-1)² + (y-1)² + z² + t² = 1 // At least 5 points for a 3-sphere diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp index b84ab3de..2cd66963 100644 --- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp @@ -27,14 +27,14 @@ #include #include -// Use dynamic_dimension_tag for the user to be able to set dimension -typedef CGAL::Epeck_d< CGAL::Dynamic_dimension_tag > Exact_kernel_d; -// Use static dimension_tag to set dimension at 4 -typedef CGAL::Epeck_d< CGAL::Dimension_tag<4> > Exact_kernel_s; +using list_of_exact_kernel_variants = boost::mpl::list, + CGAL::Epeck_d< CGAL::Dimension_tag<4> > + > ; -typedef boost::mpl::list list_of_kernel_variants; +BOOST_AUTO_TEST_CASE_TEMPLATE(Zero_weighted_alpha_complex, Kernel, list_of_exact_kernel_variants) { + // Check that in exact mode for static dimension 4 the code for dD unweighted and for dD weighted with all weights + // 0 give exactly the same simplex tree (simplices and filtration values). -BOOST_AUTO_TEST_CASE_TEMPLATE(Zero_weighted_alpha_complex, Kernel, list_of_kernel_variants) { // Random points construction using Point_d = typename Kernel::Point_d; std::vector points; @@ -89,6 +89,8 @@ bool cgal_3d_point_sort (Point_d a,Point_d b) { } BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { + // check that for random weighted 3d points in safe mode the 3D and dD codes give the same result with some tolerance + // Random points construction using Kernel_dD = CGAL::Epeck_d< CGAL::Dimension_tag<3> >; using Bare_point_d = typename Kernel_dD::Point_d; @@ -186,17 +188,25 @@ BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { } } -BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_non_visible_points) { - using Point_d = typename Exact_kernel_d::Point_d; +using list_of_1d_kernel_variants = boost::mpl::list, + CGAL::Epeck_d< CGAL::Dimension_tag<1>>, + CGAL::Epick_d< CGAL::Dynamic_dimension_tag >, + CGAL::Epick_d< CGAL::Dimension_tag<1>> + >; + +BOOST_AUTO_TEST_CASE_TEMPLATE(Weighted_alpha_complex_non_visible_points, Kernel, list_of_1d_kernel_variants) { + // check that for 2 closed weighted 1-d points, one with a high weight to hide the second one with a small weight, + // that the point with a small weight has the same high filtration value than the edge formed by the 2 points + using Point_d = typename Kernel::Point_d; std::vector points; std::vector p1 {0.}; points.emplace_back(p1.begin(), p1.end()); // closed enough points std::vector p2 {0.1}; points.emplace_back(p2.begin(), p2.end()); - std::vector weights {100., 0.01}; + std::vector weights {100., 0.01}; - Gudhi::alpha_complex::Alpha_complex alpha_complex(points, weights); + Gudhi::alpha_complex::Alpha_complex alpha_complex(points, weights); Gudhi::Simplex_tree<> stree; BOOST_CHECK(alpha_complex.create_complex(stree)); -- cgit v1.2.3 From baaf350869dbd5ff78e22cc4c3de9b8ab35b75ba Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 3 Nov 2020 11:56:52 +0100 Subject: code review: use relative error --- src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp') diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp index 2cd66963..3df76dbf 100644 --- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp @@ -179,8 +179,8 @@ BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { std::clog << std::endl; BOOST_CHECK(false); } - // I had to make a hard limit as it is converted from Kernel::FT - if (std::fabs(d3_itr->second - dD_itr->second) > 1e-5) { + // In safe mode, relative error is less than 1e-5 (can be changed with set_relative_precision_of_to_double) + if (std::fabs(d3_itr->second - dD_itr->second) / std::fabs(d3_itr->second) > 1e-5) { std::clog << d3_itr->second << " versus " << dD_itr->second << " diff " << std::fabs(d3_itr->second - dD_itr->second) << std::endl; BOOST_CHECK(false); } -- cgit v1.2.3 From 05e28e39717c4ca5871b13a350c4b142ec9a173b Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 3 Nov 2020 14:09:05 +0100 Subject: code review: use Marc's trick to test relative error --- .../test/Weighted_alpha_complex_unit_test.cpp | 38 ++++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp') diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp index 3df76dbf..d267276c 100644 --- a/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_alpha_complex_unit_test.cpp @@ -49,31 +49,32 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Zero_weighted_alpha_complex, Kernel, list_of_exact // Alpha complex from points Gudhi::alpha_complex::Alpha_complex alpha_complex_from_points(points); Gudhi::Simplex_tree<> simplex; - BOOST_CHECK(alpha_complex_from_points.create_complex(simplex, std::numeric_limits::Filtration_value>::infinity(), true)); - std::clog << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + Gudhi::Simplex_tree<>::Filtration_value infty = std::numeric_limits::Filtration_value>::infinity(); + BOOST_CHECK(alpha_complex_from_points.create_complex(simplex, infty, true)); + std::clog << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" + << std::endl; for (auto f_simplex : simplex.filtration_simplex_range()) { std::clog << " ( "; for (auto vertex : simplex.simplex_vertex_range(f_simplex)) { std::clog << vertex << " "; } - std::clog << ") -> " << "[" << simplex.filtration(f_simplex) << "] "; - std::clog << std::endl; + std::clog << ") -> " << "[" << simplex.filtration(f_simplex) << "] " << std::endl; } // Alpha complex from zero weighted points std::vector weights(20, 0.); Gudhi::alpha_complex::Alpha_complex alpha_complex_from_zero_weighted_points(points, weights); Gudhi::Simplex_tree<> zw_simplex; - BOOST_CHECK(alpha_complex_from_zero_weighted_points.create_complex(zw_simplex, std::numeric_limits::Filtration_value>::infinity(), true)); + BOOST_CHECK(alpha_complex_from_zero_weighted_points.create_complex(zw_simplex, infty, true)); - std::clog << "Iterator on zero weighted alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on zero weighted alpha complex simplices in the filtration order, with [filtration value]:" + << std::endl; for (auto f_simplex : zw_simplex.filtration_simplex_range()) { std::clog << " ( "; for (auto vertex : zw_simplex.simplex_vertex_range(f_simplex)) { std::clog << vertex << " "; } - std::clog << ") -> " << "[" << zw_simplex.filtration(f_simplex) << "] "; - std::clog << std::endl; + std::clog << ") -> " << "[" << zw_simplex.filtration(f_simplex) << "] " << std::endl; } BOOST_CHECK(zw_simplex == simplex); @@ -125,7 +126,8 @@ BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { Gudhi::Simplex_tree<> w_simplex_d; BOOST_CHECK(alpha_complex_dD_from_weighted_points.create_complex(w_simplex_d)); - std::clog << "Iterator on weighted alpha complex dD simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on weighted alpha complex dD simplices in the filtration order, with [filtration value]:" + << std::endl; for (auto f_simplex : w_simplex_d.filtration_simplex_range()) { Points points; for (auto vertex : w_simplex_d.simplex_vertex_range(f_simplex)) { @@ -148,7 +150,8 @@ BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { Gudhi::Simplex_tree<> w_simplex_3; BOOST_CHECK(alpha_complex_3D_from_weighted_points.create_complex(w_simplex_3)); - std::clog << "Iterator on weighted alpha complex 3D simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on weighted alpha complex 3D simplices in the filtration order, with [filtration value]:" + << std::endl; for (auto f_simplex : w_simplex_3.filtration_simplex_range()) { Points points; for (auto vertex : w_simplex_3.simplex_vertex_range(f_simplex)) { @@ -161,8 +164,7 @@ BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { for (auto point : points) { std::clog << point[0] << " " << point[1] << " " << point[2] << " | "; } - std::clog << ") -> " << "[" << w_simplex_3.filtration(f_simplex) << "] "; - std::clog << std::endl; + std::clog << ") -> " << "[" << w_simplex_3.filtration(f_simplex) << "] " << std::endl; pts_fltr_3d[points] = w_simplex_d.filtration(f_simplex); } @@ -180,8 +182,9 @@ BOOST_AUTO_TEST_CASE(Weighted_alpha_complex_3d_comparison) { BOOST_CHECK(false); } // In safe mode, relative error is less than 1e-5 (can be changed with set_relative_precision_of_to_double) - if (std::fabs(d3_itr->second - dD_itr->second) / std::fabs(d3_itr->second) > 1e-5) { - std::clog << d3_itr->second << " versus " << dD_itr->second << " diff " << std::fabs(d3_itr->second - dD_itr->second) << std::endl; + if (std::fabs(d3_itr->second - dD_itr->second) > 1e-5 * (std::fabs(d3_itr->second) + std::fabs(dD_itr->second))) { + std::clog << d3_itr->second << " versus " << dD_itr->second << " diff " + << std::fabs(d3_itr->second - dD_itr->second) << std::endl; BOOST_CHECK(false); } ++dD_itr; @@ -210,18 +213,17 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Weighted_alpha_complex_non_visible_points, Kernel, Gudhi::Simplex_tree<> stree; BOOST_CHECK(alpha_complex.create_complex(stree)); - std::clog << "Iterator on weighted alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on weighted alpha complex simplices in the filtration order, with [filtration value]:" + << std::endl; for (auto f_simplex : stree.filtration_simplex_range()) { std::clog << " ( "; for (auto vertex : stree.simplex_vertex_range(f_simplex)) { std::clog << vertex << " "; } - std::clog << ") -> " << "[" << stree.filtration(f_simplex) << "] "; - std::clog << std::endl; + std::clog << ") -> " << "[" << stree.filtration(f_simplex) << "] " << std::endl; } BOOST_CHECK(stree.filtration(stree.find({0})) == -100.); BOOST_CHECK(stree.filtration(stree.find({1})) == stree.filtration(stree.find({0, 1}))); BOOST_CHECK(stree.filtration(stree.find({1})) > 100000); - } \ No newline at end of file -- cgit v1.2.3