From e6992894cf4e9b76acee98e2c1ad840a3ebd7274 Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 4 Oct 2016 18:07:42 +0000 Subject: Fixed a major bug in the Active_witness_iterator git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1633 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: d4f474b44835b11e65a152f9d3fe87cc32b527f5 --- .../test/simple_witness_complex.cpp | 86 +++++++++++++++++----- 1 file changed, 66 insertions(+), 20 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/test/simple_witness_complex.cpp b/src/Witness_complex/test/simple_witness_complex.cpp index 03df78ee..30b168c1 100644 --- a/src/Witness_complex/test/simple_witness_complex.cpp +++ b/src/Witness_complex/test/simple_witness_complex.cpp @@ -25,6 +25,8 @@ #include #include +#include + #include #include @@ -34,26 +36,70 @@ typedef Gudhi::Simplex_tree<> Simplex_tree; typedef std::vector< Vertex_handle > typeVectorVertex; -typedef Gudhi::witness_complex::Witness_complex WitnessComplex; +typedef CGAL::Epick_d Kernel; +typedef typename Kernel::FT FT; +typedef typename Kernel::Point_d Point_d; +typedef Gudhi::witness_complex::Witness_complex WitnessComplex; + +/* All landmarks and witnesses are taken on the grid in the following manner. + LWLWL 2W4W7 + WW.WW WW.WW + L...L 1...6 + WW.WW WW.WW + LWLWL 0W3W5 + + Witness complex consists of 8 vertices, 12 edges and 4 triangles + */ BOOST_AUTO_TEST_CASE(simple_witness_complex) { - Simplex_tree complex; - std::vector< typeVectorVertex > knn; - - knn.push_back({1, 0, 5, 2, 6, 3, 4}); - knn.push_back({2, 6, 4, 5, 0, 1, 3}); - knn.push_back({3, 4, 2, 1, 5, 6, 0}); - knn.push_back({4, 2, 1, 3, 5, 6, 0}); - knn.push_back({5, 1, 6, 0, 2, 3, 4}); - knn.push_back({6, 0, 5, 2, 1, 3, 4}); - knn.push_back({0, 5, 6, 1, 2, 3, 4}); - knn.push_back({2, 6, 4, 5, 3, 1, 0}); - knn.push_back({1, 2, 5, 4, 3, 6, 0}); - knn.push_back({3, 4, 0, 6, 5, 1, 2}); - knn.push_back({5, 0, 1, 3, 6, 2, 4}); - knn.push_back({5, 6, 1, 0, 2, 3, 4}); - knn.push_back({1, 6, 0, 5, 2, 3, 4}); - WitnessComplex witnessComplex(knn, 7, 7, complex); - - BOOST_CHECK(witnessComplex.is_witness_complex(knn, false)); + Simplex_tree complex, relaxed_complex; + + std::vector witnesses, landmarks; + + landmarks.push_back(Point_d(std::vector{-2,-2})); + landmarks.push_back(Point_d(std::vector{-2, 0})); + landmarks.push_back(Point_d(std::vector{-2, 2})); + landmarks.push_back(Point_d(std::vector{ 0,-2})); + landmarks.push_back(Point_d(std::vector{ 0, 2})); + landmarks.push_back(Point_d(std::vector{ 2,-2})); + landmarks.push_back(Point_d(std::vector{ 2, 0})); + landmarks.push_back(Point_d(std::vector{ 2, 2})); + witnesses.push_back(Point_d(std::vector{-2,-1})); + witnesses.push_back(Point_d(std::vector{-2, 1})); + witnesses.push_back(Point_d(std::vector{-1,-2})); + witnesses.push_back(Point_d(std::vector{-1,-1})); + witnesses.push_back(Point_d(std::vector{-1, 1})); + witnesses.push_back(Point_d(std::vector{-1, 2})); + witnesses.push_back(Point_d(std::vector{ 1,-2})); + witnesses.push_back(Point_d(std::vector{ 1,-1})); + witnesses.push_back(Point_d(std::vector{ 1, 1})); + witnesses.push_back(Point_d(std::vector{ 1, 2})); + witnesses.push_back(Point_d(std::vector{ 2,-1})); + witnesses.push_back(Point_d(std::vector{ 2, 1})); + + // landmarks.push_back(Point_d(std::vector{1,0})); + // landmarks.push_back(Point_d(std::vector{0,0})); + // landmarks.push_back(Point_d(std::vector{0,1})); + // witnesses.push_back(Point_d(std::vector{1,0})); + + WitnessComplex witness_complex(landmarks.begin(), + landmarks.end(), + witnesses.begin(), + witnesses.end()); + // witness_complex.create_complex(complex, 0); + + //std::cout << complex << "\n"; + + // BOOST_CHECK(complex.num_simplices() == 24); + + witness_complex.create_complex(relaxed_complex, 8.01); + + std::cout << "Num_simplices: " << relaxed_complex.num_simplices() << "\n"; + std::cout << relaxed_complex << "\n"; + + //BOOST_CHECK(relaxed_complex.num_simplices() == 24); + + //BOOST_CHECK(witnessComplex.is_witness_complex(knn, false)); + + } -- cgit v1.2.3 From 30eb48c287ef6453a095535306b2a9acf672472a Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 4 Oct 2016 19:49:40 +0000 Subject: Strong witness is ready as well git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1636 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 1e50ece69054b45787353c37877fdfa970209f20 --- src/Witness_complex/test/simple_witness_complex.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/test/simple_witness_complex.cpp b/src/Witness_complex/test/simple_witness_complex.cpp index 30b168c1..0c2c3710 100644 --- a/src/Witness_complex/test/simple_witness_complex.cpp +++ b/src/Witness_complex/test/simple_witness_complex.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -40,6 +41,7 @@ typedef CGAL::Epick_d Kernel; typedef typename Kernel::FT FT; typedef typename Kernel::Point_d Point_d; typedef Gudhi::witness_complex::Witness_complex WitnessComplex; +typedef Gudhi::witness_complex::Strong_witness_complex StrongWitnessComplex; /* All landmarks and witnesses are taken on the grid in the following manner. LWLWL 2W4W7 @@ -52,7 +54,7 @@ typedef Gudhi::witness_complex::Witness_complex WitnessComplex; */ BOOST_AUTO_TEST_CASE(simple_witness_complex) { - Simplex_tree complex, relaxed_complex; + Simplex_tree complex, relaxed_complex, strong_relaxed_complex; std::vector witnesses, landmarks; @@ -92,11 +94,20 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { // BOOST_CHECK(complex.num_simplices() == 24); - witness_complex.create_complex(relaxed_complex, 8.01); + // witness_complex.create_complex(relaxed_complex, 8.01); - std::cout << "Num_simplices: " << relaxed_complex.num_simplices() << "\n"; - std::cout << relaxed_complex << "\n"; + // std::cout << "Num_simplices: " << relaxed_complex.num_simplices() << "\n"; + // std::cout << relaxed_complex << "\n"; + StrongWitnessComplex strong_witness_complex(landmarks.begin(), + landmarks.end(), + witnesses.begin(), + witnesses.end()); + + strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); + std::cout << "Num_simplices: " << strong_relaxed_complex.num_simplices() << "\n"; + std::cout << strong_relaxed_complex << "\n"; + //BOOST_CHECK(relaxed_complex.num_simplices() == 24); //BOOST_CHECK(witnessComplex.is_witness_complex(knn, false)); -- cgit v1.2.3 From d439da1345822fe25f58adb631f7d0cd9749ecfc Mon Sep 17 00:00:00 2001 From: skachano Date: Wed, 5 Oct 2016 17:06:15 +0000 Subject: Modified existing tests and examples git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1647 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: cd187fe5bc9174403aa5dc96c74871c697b3a5e6 --- src/Witness_complex/example/CMakeLists.txt | 10 +- .../example/example_witness_complex_off.cpp | 86 ++++++ .../example/example_witness_complex_sphere.cpp | 98 +++++++ src/Witness_complex/example/output.h | 308 --------------------- src/Witness_complex/example/output_tikz.h | 178 ------------ .../example/witness_complex_from_file.cpp | 106 ------- .../example/witness_complex_sphere.cpp | 99 ------- src/Witness_complex/test/CMakeLists.txt | 10 +- .../test/simple_witness_complex.cpp | 116 -------- .../test/test_simple_witness_complex.cpp | 103 +++++++ 10 files changed, 295 insertions(+), 819 deletions(-) create mode 100644 src/Witness_complex/example/example_witness_complex_off.cpp create mode 100644 src/Witness_complex/example/example_witness_complex_sphere.cpp delete mode 100644 src/Witness_complex/example/output.h delete mode 100644 src/Witness_complex/example/output_tikz.h delete mode 100644 src/Witness_complex/example/witness_complex_from_file.cpp delete mode 100644 src/Witness_complex/example/witness_complex_sphere.cpp delete mode 100644 src/Witness_complex/test/simple_witness_complex.cpp create mode 100644 src/Witness_complex/test/test_simple_witness_complex.cpp (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/example/CMakeLists.txt b/src/Witness_complex/example/CMakeLists.txt index 0054775d..469c9aac 100644 --- a/src/Witness_complex/example/CMakeLists.txt +++ b/src/Witness_complex/example/CMakeLists.txt @@ -1,17 +1,13 @@ cmake_minimum_required(VERSION 2.6) project(Witness_complex_examples) -# A simple example - add_executable( witness_complex_from_file witness_complex_from_file.cpp ) - add_test( witness_complex_from_bunny ${CMAKE_CURRENT_BINARY_DIR}/witness_complex_from_file ${CMAKE_SOURCE_DIR}/data/points/bunny_5000 100) if(CGAL_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.6.0) if (EIGEN3_FOUND) - add_executable ( witness_complex_sphere witness_complex_sphere.cpp ) - target_link_libraries(witness_complex_sphere ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) - add_test( witness_complex_sphere_10 ${CMAKE_CURRENT_BINARY_DIR}/witness_complex_sphere 10) - add_executable ( relaxed_witness_persistence relaxed_witness_persistence.cpp ) + add_executable( Witness_complex_example_off example_witness_complex_off.cpp ) + add_executable ( Witness_complex_example_sphere example_witness_complex_sphere.cpp ) + #add_executable ( relaxed_witness_persistence relaxed_witness_persistence.cpp ) endif(EIGEN3_FOUND) endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) endif() diff --git a/src/Witness_complex/example/example_witness_complex_off.cpp b/src/Witness_complex/example/example_witness_complex_off.cpp new file mode 100644 index 00000000..6b0060d9 --- /dev/null +++ b/src/Witness_complex/example/example_witness_complex_off.cpp @@ -0,0 +1,86 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +typedef CGAL::Epick_d K; +typedef typename K::Point_d Point_d; +typedef typename Gudhi::witness_complex::Witness_complex Witness_complex; +typedef std::vector< Vertex_handle > typeVectorVertex; +typedef std::vector< Point_d > Point_vector; + +int main(int argc, char * const argv[]) { + if (argc != 4) { + std::cerr << "Usage: " << argv[0] + << " path_to_point_file nbL alpha^2\n"; + return 0; + } + + std::string file_name = argv[1]; + int nbL = atoi(argv[2]); + double alpha2 = atof(argv[3]); + clock_t start, end; + + // Construct the Simplex Tree + Gudhi::Simplex_tree<> simplex_tree; + + // Read the point file + Point_vector point_vector, landmarks; + Gudhi::Points_off_reader off_reader(file_name); + if (!off_reader.is_valid()) { + std::cerr << "Witness complex - Unable to read file " << file_name << "\n"; + exit(-1); // ----- >> + } + point_vector = Point_vector(off_reader.get_point_cloud()); + + std::cout << "Successfully read " << point_vector.size() << " points.\n"; + std::cout << "Ambient dimension is " << point_vector[0].dimension() << ".\n"; + + // Choose landmarks + Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks)); + + // Compute witness complex + start = clock(); + Witness_complex witness_complex(landmarks.begin(), + landmarks.end(), + point_vector.begin(), + point_vector.end()); + witness_complex.create_complex(simplex_tree, alpha2); + end = clock(); + std::cout << "Witness complex took " + << static_cast(end - start) / CLOCKS_PER_SEC << " s. \n"; + std::cout << "Number of simplices is: " << simplex_tree.num_simplices() << "\n"; +} diff --git a/src/Witness_complex/example/example_witness_complex_sphere.cpp b/src/Witness_complex/example/example_witness_complex_sphere.cpp new file mode 100644 index 00000000..8e2c5ff6 --- /dev/null +++ b/src/Witness_complex/example/example_witness_complex_sphere.cpp @@ -0,0 +1,98 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#define BOOST_PARAMETER_MAX_ARITY 12 + + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include "generators.h" + +/** Write a gnuplot readable file. + * Data range is a random access range of pairs (arg, value) + */ +template < typename Data_range > +void write_data(Data_range & data, std::string filename) { + std::ofstream ofs(filename, std::ofstream::out); + for (auto entry : data) + ofs << entry.first << ", " << entry.second << "\n"; + ofs.close(); +} + +int main(int argc, char * const argv[]) { + typedef Gudhi::witness_complex::Witness_complex> Witness_complex; + + if (argc != 2) { + std::cerr << "Usage: " << argv[0] + << " number_of_landmarks \n"; + return 0; + } + + int number_of_landmarks = atoi(argv[1]); + clock_t start, end; + + std::vector< std::pair > l_time; + + // Read the point file + for (int nbP = 500; nbP < 10000; nbP += 500) { + // Construct the Simplex Tree + Gudhi::Simplex_tree<> simplex_tree; + Point_Vector point_vector, landmarks; + generate_points_sphere(point_vector, nbP, 4); + std::cout << "Successfully generated " << point_vector.size() << " points.\n"; + std::cout << "Ambient dimension is " << point_vector[0].size() << ".\n"; + + // Choose landmarks + start = clock(); + Gudhi::subsampling::pick_n_random_points(point_vector, number_of_landmarks, std::back_inserter(landmarks)); + + // Compute witness complex + Witness_complex witness_complex(landmarks.begin(), + landmarks.end(), + point_vector.begin(), + point_vector.end()); + witness_complex.create_complex(simplex_tree, 0); + end = clock(); + double time = static_cast(end - start) / CLOCKS_PER_SEC; + std::cout << "Witness complex for " << number_of_landmarks << " landmarks took " + << time << " s. \n"; + //assert(1 == 0); + //std::cout << simplex_tree << "\n"; + std::cout << "Number of simplices is: " << simplex_tree.num_simplices() << "\n"; + l_time.push_back(std::make_pair(nbP, time)); + } + write_data(l_time, "w_time.dat"); +} diff --git a/src/Witness_complex/example/output.h b/src/Witness_complex/example/output.h deleted file mode 100644 index d3f534af..00000000 --- a/src/Witness_complex/example/output.h +++ /dev/null @@ -1,308 +0,0 @@ -#ifndef OUTPUT_H -#define OUTPUT_H - -#include -#include -#include - -#include - -#include -#include - -//typename Gudhi::Witness_complex<> Witness_complex; - -typedef CGAL::Epick_d K; -typedef K::Point_d Point_d; -typedef std::vector Point_Vector; -typedef CGAL::Delaunay_triangulation Delaunay_triangulation; - -/** \brief Write the table of the nearest landmarks to each witness - * to a file. - */ -template -void write_wl( std::string file_name, std::vector< std::vector > & WL) -{ - std::ofstream ofs (file_name, std::ofstream::out); - for (auto w : WL) - { - for (auto l: w) - ofs << l << " "; - ofs << "\n"; - } - ofs.close(); -} - -/** \brief Write the coordinates of points in points to a file. - * - */ -void write_points( std::string file_name, std::vector< Point_d > & points) -{ - std::ofstream ofs (file_name, std::ofstream::out); - for (auto w : points) - { - for (auto it = w.cartesian_begin(); it != w.cartesian_end(); ++it) - ofs << *it << " "; - ofs << "\n"; - } - ofs.close(); -} - -/** Write edges of a witness complex in a file. - * The format of an edge is coordinates of u \n coordinates of v \n\n\n - * This format is compatible with gnuplot - */ -template< typename STree > -void write_edges(std::string file_name, STree& witness_complex, Point_Vector& landmarks) -{ - std::ofstream ofs (file_name, std::ofstream::out); - for (auto u: witness_complex.complex_vertex_range()) - for (auto v: witness_complex.complex_vertex_range()) - { - std::vector edge = {u,v}; - if (u < v && witness_complex.find(edge) != witness_complex.null_simplex()) - { - for (auto it = landmarks[u].cartesian_begin(); it != landmarks[u].cartesian_end(); ++it) - ofs << *it << " "; - ofs << "\n"; - for (auto it = landmarks[v].cartesian_begin(); it != landmarks[v].cartesian_end(); ++it) - ofs << *it << " "; - ofs << "\n\n\n"; - } - } - ofs.close(); -} - -/** \brief Write triangles (tetrahedra in 3d) of a simplicial complex in a file, compatible with medit. - * `landmarks_ind` represents the set of landmark indices in W - * `st` is the Simplex_tree to be visualized, - * `shr` is the Simplex_handle_range of simplices in `st` to be visualized - * `is2d` should be true if the simplicial complex is 2d, false if 3d - * `l_is_v` = landmark is vertex - */ -template -void write_witness_mesh(Point_Vector& W, std::vector& landmarks_ind, STree& st, SimplexHandleRange const & shr, bool is2d, bool l_is_v, std::string file_name = "witness.mesh") -{ - std::ofstream ofs (file_name, std::ofstream::out); - if (is2d) - ofs << "MeshVersionFormatted 1\nDimension 2\n"; - else - ofs << "MeshVersionFormatted 1\nDimension 3\n"; - - if (!l_is_v) - ofs << "Vertices\n" << W.size() << "\n"; - else - ofs << "Vertices\n" << landmarks_ind.size() << "\n"; - - if (l_is_v) - for (auto p_it : landmarks_ind) { - for (auto coord = W[p_it].cartesian_begin(); coord != W[p_it].cartesian_end() && coord != W[p_it].cartesian_begin()+3 ; ++coord) - ofs << *coord << " "; - ofs << "508\n"; - } - else - for (auto p_it : W) { - for (auto coord = p_it.cartesian_begin(); coord != p_it.cartesian_end() && coord != p_it.cartesian_begin()+3 ; ++coord) - ofs << *coord << " "; - ofs << "508\n"; - } - - // int num_triangles = W.size(), num_tetrahedra = 0; - int num_edges = 0, num_triangles = 0, num_tetrahedra = 0; - if (!l_is_v) { - for (auto sh_it : shr) - if (st.dimension(sh_it) == 1) - num_edges++; - else if (st.dimension(sh_it) == 2) - num_triangles++; - else if (st.dimension(sh_it) == 3) - num_tetrahedra++; - ofs << "Edges " << num_edges << "\n"; - for (auto sh_it : shr) { - if (st.dimension(sh_it) == 1) { - for (auto v_it : st.simplex_vertex_range(sh_it)) - ofs << landmarks_ind[v_it]+1 << " "; - ofs << "200\n"; - } - } - ofs << "Triangles " << num_triangles << "\n"; - for (unsigned i = 0; i < W.size(); ++i) - ofs << i << " " << i << " " << i << " " << "508\n"; - for (auto sh_it : shr) - { - if (st.dimension(sh_it) == 2) { - for (auto v_it : st.simplex_vertex_range(sh_it)) - ofs << landmarks_ind[v_it]+1 << " "; - ofs << "508\n"; - } - } - ofs << "Tetrahedra " << num_tetrahedra << "\n"; - for (auto sh_it : shr) - { - if (st.dimension(sh_it) == 3) { - for (auto v_it : st.simplex_vertex_range(sh_it)) - ofs << landmarks_ind[v_it]+1 << " "; - ofs << "250\n"; - } - } - } - else { - for (auto sh_it : shr) - if (st.dimension(sh_it) == 1) - num_edges++; - else if (st.dimension(sh_it) == 2) - num_triangles++; - else if (st.dimension(sh_it) == 3) - num_tetrahedra++; - ofs << "Edges " << num_edges << "\n"; - for (auto sh_it : shr) { - if (st.dimension(sh_it) == 1) { - for (auto v_it : st.simplex_vertex_range(sh_it)) - ofs << v_it+1 << " "; - ofs << "200\n"; - } - } - ofs << "Triangles " << num_triangles << "\n"; - for (auto sh_it : shr) - { - if (st.dimension(sh_it) == 2) { - for (auto v_it : st.simplex_vertex_range(sh_it)) - ofs << v_it+1 << " "; - ofs << "508\n"; - } - } - ofs << "Tetrahedra " << num_tetrahedra << "\n"; - for (auto sh_it : shr) - { - if (st.dimension(sh_it) == 3) { - for (auto v_it : st.simplex_vertex_range(sh_it)) - ofs << v_it+1 << " "; - ofs << "250\n"; - } - } - } - - ofs << "End\n"; - /* - else - { - ofs << "Tetrahedra " << t.number_of_finite_full_cells()+1 << "\n"; - for (auto fc_it = t.full_cells_begin(); fc_it != t.full_cells_end(); ++fc_it) - { - if (t.is_infinite(fc_it)) - continue; - for (auto vh_it = fc_it->vertices_begin(); vh_it != fc_it->vertices_end(); ++vh_it) - ofs << index_of_vertex[*vh_it] << " "; - ofs << "508\n"; - } - ofs << nbV << " " << nbV << " " << nbV << " " << nbV << " " << 208 << "\n"; - ofs << "End\n"; - } - */ - ofs.close(); -} - -void write_witness_mesh(Point_Vector& W, std::vector& landmarks_ind, Gudhi::Simplex_tree<>& st, bool is2d, bool l_is_v, std::string file_name = "witness.mesh") -{ - write_witness_mesh(W, landmarks_ind, st, st.complex_simplex_range(), is2d, l_is_v, file_name); -} - -/** \brief Write triangles (tetrahedra in 3d) of a Delaunay - * triangulation in a file, compatible with medit. - */ -void write_delaunay_mesh(Delaunay_triangulation& t, const Point_d& p, bool is2d) -{ - std::ofstream ofs ("delaunay.mesh", std::ofstream::out); - int nbV = t.number_of_vertices()+1; - if (is2d) - ofs << "MeshVersionFormatted 1\nDimension 2\n"; - else - ofs << "MeshVersionFormatted 1\nDimension 3\n"; - ofs << "Vertices\n" << nbV << "\n"; - int ind = 1; //index of a vertex - std::map index_of_vertex; - for (auto v_it = t.vertices_begin(); v_it != t.vertices_end(); ++v_it) - { - if (t.is_infinite(v_it)) - continue; - // Add maximum 3 coordinates - for (auto coord = v_it->point().cartesian_begin(); coord != v_it->point().cartesian_end() && coord != v_it->point().cartesian_begin()+3; ++coord) - ofs << *coord << " "; - ofs << "508\n"; - index_of_vertex[v_it] = ind++; - } - for (auto coord = p.cartesian_begin(); coord != p.cartesian_end(); ++coord) - ofs << *coord << " "; - ofs << "208\n"; - if (is2d) - { - ofs << "Triangles " << t.number_of_finite_full_cells()+1 << "\n"; - for (auto fc_it = t.full_cells_begin(); fc_it != t.full_cells_end(); ++fc_it) - { - if (t.is_infinite(fc_it)) - continue; - for (auto vh_it = fc_it->vertices_begin(); vh_it != fc_it->vertices_end(); ++vh_it) - ofs << index_of_vertex[*vh_it] << " "; - ofs << "508\n"; - } - ofs << nbV << " " << nbV << " " << nbV << " " << 208 << "\n"; - ofs << "End\n"; - } - else if (p.size() == 3) - { - ofs << "Tetrahedra " << t.number_of_finite_full_cells()+1 << "\n"; - for (auto fc_it = t.full_cells_begin(); fc_it != t.full_cells_end(); ++fc_it) - { - if (t.is_infinite(fc_it)) - continue; - for (auto vh_it = fc_it->vertices_begin(); vh_it != fc_it->vertices_end(); ++vh_it) - ofs << index_of_vertex[*vh_it] << " "; - ofs << "508\n"; - } - ofs << nbV << " " << nbV << " " << nbV << " " << nbV << " " << 208 << "\n"; - ofs << "End\n"; - } - else if (p.size() == 4) - { - ofs << "Tetrahedra " << 5*(t.number_of_finite_full_cells())+1 << "\n"; - for (auto fc_it = t.full_cells_begin(); fc_it != t.full_cells_end(); ++fc_it) - { - if (t.is_infinite(fc_it)) - continue; - for (auto vh_it = fc_it->vertices_begin(); vh_it != fc_it->vertices_end(); ++vh_it) - { - for (auto vh_it2 = fc_it->vertices_begin(); vh_it2 != fc_it->vertices_end(); ++vh_it2) - if (vh_it != vh_it2) - ofs << index_of_vertex[*vh_it2] << " "; - ofs << "508\n"; - } - } - ofs << nbV << " " << nbV << " " << nbV << " " << nbV << " " << 208 << "\n"; - ofs << "End\n"; - } - ofs.close(); -} - -/////////////////////////////////////////////////////////////////////// -// PRINT VECTOR -/////////////////////////////////////////////////////////////////////// - -template -void print_vector(std::vector v) -{ - std::cout << "["; - if (!v.empty()) - { - std::cout << *(v.begin()); - for (auto it = v.begin()+1; it != v.end(); ++it) - { - std::cout << ","; - std::cout << *it; - } - } - std::cout << "]"; -} - - -#endif diff --git a/src/Witness_complex/example/output_tikz.h b/src/Witness_complex/example/output_tikz.h deleted file mode 100644 index 281c65b7..00000000 --- a/src/Witness_complex/example/output_tikz.h +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef OUTPUT_TIKZ_H -#define OUTPUT_TIKZ_H - -#include -#include -#include -#include -#include - -typedef double FT; - - -//////////////////AUX///////////////////// - -void write_preamble(std::ofstream& ofs) -{ - ofs << "\\documentclass{standalone}\n" - << "\\usepackage{tikz}\n\n" - << "\\begin{document}\n" - << "\\begin{tikzpicture}\n"; -} - -void write_end(std::ofstream& ofs) -{ - ofs << "\\end{tikzpicture}\n" - << "\\end{document}"; -} - - -/////////////////MAIN////////////////////// - -void write_tikz_plot(std::vector data, std::string filename) -{ - int n = data.size(); - FT vmax = *(std::max_element(data.begin(), data.end())); - //std::cout << std::log10(vmax) << " " << std::floor(std::log10(vmax)); - - FT order10 = pow(10,std::floor(std::log10(vmax))); - int digit = std::floor( vmax / order10) + 1; - if (digit == 4 || digit == 6) digit = 5; - if (digit > 6) digit = 10; - FT plot_max = digit*order10; - std::cout << plot_max << " " << vmax; - FT hstep = 10.0/(n-1); - FT wstep = 10.0 / plot_max; - - std::cout << "(eps_max-eps_min)/(N-48) = " << (vmax-*data.begin())/(data.size()-48) << "\n"; - std::ofstream ofs(filename, std::ofstream::out); - - ofs << - "\\documentclass{standalone}\n" << - "\\usepackage[utf8]{inputenc}\n" << - "\\usepackage{amsmath}\n" << - "\\usepackage{tikz}\n\n" << - "\\begin{document}\n" << - "\\begin{tikzpicture}\n"; - - ofs << "\\draw[->] (0,0) -- (0,11);" << std::endl << - "\\draw[->] (0,0) -- (11,0);" << std::endl << - "\\foreach \\i in {1,...,10}" << std::endl << - "\\draw (0,\\i) -- (-0.05,\\i);" << std::endl << - "\\foreach \\i in {1,...,10}" << std::endl << - "\\draw (\\i,0) -- (\\i,-0.05);" << std::endl << std::endl << - - "\\foreach \\i in {1,...,10}" << std::endl << - "\\draw[dashed] (-0.05,\\i) -- (11,\\i);" << std::endl << std::endl << - - "\\node at (-0.5,11) {$*$}; " << std::endl << - "\\node at (11,-0.5) {$*$}; " << std::endl << - "\\node at (-0.5,-0.5) {0}; " << std::endl << - "\\node at (-0.5,10) {" << plot_max << "}; " << std::endl << - "%\\node at (10,-0.5) {2}; " << std::endl; - - ofs << "\\draw[red] (0," << wstep*data[0] << ")"; - for (int i = 1; i < n; ++i) - ofs << " -- (" << hstep*i << "," << wstep*data[i] << ")"; - ofs << ";\n"; - - ofs << - "\\end{tikzpicture}\n" << - "\\end{document}"; - - ofs.close(); -} - - -// A little script to make a tikz histogram of epsilon distribution -// Returns the average epsilon -void write_histogram(std::vector histo, std::string file_name = "histogram.tikz", std::string xaxis = "$\\epsilon/\\epsilon_{max}$", std::string yaxis = "$\\epsilon$", FT max_x = 1) -{ - int n = histo.size(); - - std::ofstream ofs (file_name, std::ofstream::out); - FT barwidth = 20.0/n; - FT max_value = *(std::max_element(histo.begin(), histo.end())); - std::cout << max_value << std::endl; - FT ten_power = pow(10, ceil(log10(max_value))); - FT max_histo = ten_power; - if (max_value/ten_power > 1) { - if (max_value/ten_power < 2) - max_histo = 0.2*ten_power; - else if (max_value/ten_power < 5) - max_histo = 0.5*ten_power; - } - std::cout << ceil(log10(max_value)) << std::endl << max_histo << std::endl; - FT unitht = max_histo/10.0; - write_preamble(ofs); - - ofs << "\\draw[->] (0,0) -- (0,11);\n" << - "\\draw[->] (0,0) -- (21,0);\n" << - "\\foreach \\i in {1,...,10}\n" << - "\\draw (0,\\i) -- (-0.1,\\i);\n" << - "\\foreach \\i in {1,...,20}\n" << - "\\draw (\\i,0) -- (\\i,-0.1);\n" << - - "\\node at (-1,11) {" << yaxis << "};\n" << - "\\node at (22,-1) {" << xaxis << "};\n" << - "\\node at (-0.5,-0.5) {0};\n" << - "\\node at (-0.5,10) {" << max_histo << "};\n" << - "\\node at (20,-0.5) {" << max_x << "};\n"; - - for (int i = 0; i < n; ++i) - ofs << "\\draw (" << barwidth*i << "," << histo[i]/unitht << ") -- (" - << barwidth*(i+1) << "," << histo[i]/unitht << ") -- (" - << barwidth*(i+1) << ",0) -- (" << barwidth*i << ",0) -- cycle;\n"; - - write_end(ofs); - ofs.close(); -} - -struct Pers_interval { - double alpha_start, alpha_end; - int dim; - Pers_interval(double alpha_start_, double alpha_end_, int dim_) - : alpha_start(alpha_start_), alpha_end(alpha_end_), dim(dim_) - {} -}; - -void write_barcodes(std::string in_file, double alpha2, std::string out_file = "barcodes.tikz.tex") -{ - std::ifstream ifs(in_file, std::ios::in); - std::string line; - std::vector pers_intervals; - while (getline(ifs, line)) { - int p, dim; - double alpha_start, alpha_end; - std::istringstream iss(line); - iss >> p >> dim >> alpha_start >> alpha_end; - if (alpha_start != alpha_end) { - if (alpha_end < alpha_start) - alpha_end = alpha2; - pers_intervals.push_back(Pers_interval(alpha_start, alpha_end, dim)); - } - } - ifs.close(); - std::ofstream ofs (out_file, std::ofstream::out); - write_preamble(ofs); - double barwidth = 0.01; - int i = 0; - for (auto interval: pers_intervals) { - std::string color = "black"; - switch (interval.dim) { - case 0: color = "orange"; break; - case 1: color = "red"; break; - case 2: color = "blue"; break; - case 3: color = "green"; break; - case 4: color = "yellow"; break; - default: color = "orange"; break; - } - ofs << "\\fill[" << color << "] (" << interval.alpha_start << "," << barwidth*i << ") rectangle (" - << interval.alpha_end << "," << barwidth*(i+1) <<");\n"; - i++; - } - write_end(ofs); - ofs.close(); -} - -#endif diff --git a/src/Witness_complex/example/witness_complex_from_file.cpp b/src/Witness_complex/example/witness_complex_from_file.cpp deleted file mode 100644 index e5859b2a..00000000 --- a/src/Witness_complex/example/witness_complex_from_file.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -typedef CGAL::Epick_d K; -typedef typename K::Point_d Point_d; -typedef typename Gudhi::witness_complex::Witness_complex Witness_complex; -typedef std::vector< Vertex_handle > typeVectorVertex; -typedef std::vector< Point_d > Point_vector; - -/** - * \brief Customized version of read_points - * which takes into account a possible nbP first line - * - */ -inline void -read_points_cust(std::string file_name, Point_vector & points) { - std::ifstream in_file(file_name.c_str(), std::ios::in); - if (!in_file.is_open()) { - std::cerr << "Unable to open file " << file_name << std::endl; - return; - } - std::string line; - double x; - while (getline(in_file, line)) { - std::vector< double > point; - std::istringstream iss(line); - while (iss >> x) { - point.push_back(x); - } - if (point.size() != 1) - points.push_back(Point_d(point)); - } - in_file.close(); -} - -int main(int argc, char * const argv[]) { - if (argc != 4) { - std::cerr << "Usage: " << argv[0] - << " path_to_point_file nbL alpha^2\n"; - return 0; - } - - std::string file_name = argv[1]; - int nbL = atoi(argv[2]); - double alpha2 = atof(argv[3]); - clock_t start, end; - - // Construct the Simplex Tree - Gudhi::Simplex_tree<> simplex_tree; - - // Read the point file - Point_vector point_vector, landmarks; - read_points_cust(file_name, point_vector); - std::cout << "Successfully read " << point_vector.size() << " points.\n"; - std::cout << "Ambient dimension is " << point_vector[0].dimension() << ".\n"; - - // Choose landmarks - Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks)); - - // Compute witness complex - start = clock(); - Witness_complex witness_complex(landmarks.begin(), - landmarks.end(), - point_vector.begin(), - point_vector.end()); - witness_complex.create_complex(simplex_tree, alpha2); - end = clock(); - std::cout << "Witness complex took " - << static_cast(end - start) / CLOCKS_PER_SEC << " s. \n"; - std::cout << "Number of simplices is: " << simplex_tree.num_simplices() << "\n"; -} diff --git a/src/Witness_complex/example/witness_complex_sphere.cpp b/src/Witness_complex/example/witness_complex_sphere.cpp deleted file mode 100644 index fe7f628f..00000000 --- a/src/Witness_complex/example/witness_complex_sphere.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#define BOOST_PARAMETER_MAX_ARITY 12 - - -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include "generators.h" - -/** Write a gnuplot readable file. - * Data range is a random access range of pairs (arg, value) - */ -template < typename Data_range > -void write_data(Data_range & data, std::string filename) { - std::ofstream ofs(filename, std::ofstream::out); - for (auto entry : data) - ofs << entry.first << ", " << entry.second << "\n"; - ofs.close(); -} - -int main(int argc, char * const argv[]) { - typedef Gudhi::witness_complex::Witness_complex> Witness_complex; - - if (argc != 2) { - std::cerr << "Usage: " << argv[0] - << " number_of_landmarks \n"; - return 0; - } - - int number_of_landmarks = atoi(argv[1]); - clock_t start, end; - - std::vector< std::pair > l_time; - - // Read the point file - for (int nbP = 500; nbP < 10000; nbP += 500) { - // Construct the Simplex Tree - Gudhi::Simplex_tree<> simplex_tree; - Point_Vector point_vector, landmarks; - generate_points_sphere(point_vector, nbP, 4); - std::cout << "Successfully generated " << point_vector.size() << " points.\n"; - std::cout << "Ambient dimension is " << point_vector[0].size() << ".\n"; - - // Choose landmarks - start = clock(); - Gudhi::subsampling::pick_n_random_points(point_vector, number_of_landmarks, std::back_inserter(landmarks)); - - // Compute witness complex - Witness_complex witness_complex(landmarks.begin(), - landmarks.end(), - point_vector.begin(), - point_vector.end()); - witness_complex.create_complex(simplex_tree, 0.1); - end = clock(); - double time = static_cast(end - start) / CLOCKS_PER_SEC; - std::cout << "Witness complex for " << number_of_landmarks << " landmarks took " - << time << " s. \n"; - //assert(1 == 0); - //std::cout << simplex_tree << "\n"; - std::cout << "Number of simplices is: " << simplex_tree.num_simplices() << "\n"; - l_time.push_back(std::make_pair(nbP, time)); - } - write_data(l_time, "w_time.dat"); -} diff --git a/src/Witness_complex/test/CMakeLists.txt b/src/Witness_complex/test/CMakeLists.txt index bb55b0f1..751f533c 100644 --- a/src/Witness_complex/test/CMakeLists.txt +++ b/src/Witness_complex/test/CMakeLists.txt @@ -10,14 +10,14 @@ if (GPROF_PATH) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") endif() -add_executable ( simple_witness_complexUT simple_witness_complex.cpp ) -target_link_libraries(simple_witness_complexUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +add_executable ( Witness_complex_test_simple_witness_complex test_simple_witness_complex.cpp ) +target_link_libraries(Witness_complex_test_simple_witness_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) # Unitary tests definition and xml result file generation -add_test(NAME simple_witness_complexUT - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/simple_witness_complexUT +add_test(NAME simple_witness_complex + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_test_simple_witness_complex # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/simple_witness_complexUT.xml --log_level=test_suite --report_level=no) + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_simple_witness_complex.xml --log_level=test_suite --report_level=no) add_executable ( witness_complex_pointsUT witness_complex_points.cpp ) target_link_libraries(witness_complex_pointsUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) diff --git a/src/Witness_complex/test/simple_witness_complex.cpp b/src/Witness_complex/test/simple_witness_complex.cpp deleted file mode 100644 index 0c2c3710..00000000 --- a/src/Witness_complex/test/simple_witness_complex.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2016 INRIA Sophia Antipolis-Méditerranée (France) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE "simple_witness_complex" -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include - -typedef Gudhi::Simplex_tree<> Simplex_tree; -typedef std::vector< Vertex_handle > typeVectorVertex; -typedef CGAL::Epick_d Kernel; -typedef typename Kernel::FT FT; -typedef typename Kernel::Point_d Point_d; -typedef Gudhi::witness_complex::Witness_complex WitnessComplex; -typedef Gudhi::witness_complex::Strong_witness_complex StrongWitnessComplex; - -/* All landmarks and witnesses are taken on the grid in the following manner. - LWLWL 2W4W7 - WW.WW WW.WW - L...L 1...6 - WW.WW WW.WW - LWLWL 0W3W5 - - Witness complex consists of 8 vertices, 12 edges and 4 triangles - */ - -BOOST_AUTO_TEST_CASE(simple_witness_complex) { - Simplex_tree complex, relaxed_complex, strong_relaxed_complex; - - std::vector witnesses, landmarks; - - landmarks.push_back(Point_d(std::vector{-2,-2})); - landmarks.push_back(Point_d(std::vector{-2, 0})); - landmarks.push_back(Point_d(std::vector{-2, 2})); - landmarks.push_back(Point_d(std::vector{ 0,-2})); - landmarks.push_back(Point_d(std::vector{ 0, 2})); - landmarks.push_back(Point_d(std::vector{ 2,-2})); - landmarks.push_back(Point_d(std::vector{ 2, 0})); - landmarks.push_back(Point_d(std::vector{ 2, 2})); - witnesses.push_back(Point_d(std::vector{-2,-1})); - witnesses.push_back(Point_d(std::vector{-2, 1})); - witnesses.push_back(Point_d(std::vector{-1,-2})); - witnesses.push_back(Point_d(std::vector{-1,-1})); - witnesses.push_back(Point_d(std::vector{-1, 1})); - witnesses.push_back(Point_d(std::vector{-1, 2})); - witnesses.push_back(Point_d(std::vector{ 1,-2})); - witnesses.push_back(Point_d(std::vector{ 1,-1})); - witnesses.push_back(Point_d(std::vector{ 1, 1})); - witnesses.push_back(Point_d(std::vector{ 1, 2})); - witnesses.push_back(Point_d(std::vector{ 2,-1})); - witnesses.push_back(Point_d(std::vector{ 2, 1})); - - // landmarks.push_back(Point_d(std::vector{1,0})); - // landmarks.push_back(Point_d(std::vector{0,0})); - // landmarks.push_back(Point_d(std::vector{0,1})); - // witnesses.push_back(Point_d(std::vector{1,0})); - - WitnessComplex witness_complex(landmarks.begin(), - landmarks.end(), - witnesses.begin(), - witnesses.end()); - // witness_complex.create_complex(complex, 0); - - //std::cout << complex << "\n"; - - // BOOST_CHECK(complex.num_simplices() == 24); - - // witness_complex.create_complex(relaxed_complex, 8.01); - - // std::cout << "Num_simplices: " << relaxed_complex.num_simplices() << "\n"; - // std::cout << relaxed_complex << "\n"; - - StrongWitnessComplex strong_witness_complex(landmarks.begin(), - landmarks.end(), - witnesses.begin(), - witnesses.end()); - - strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); - std::cout << "Num_simplices: " << strong_relaxed_complex.num_simplices() << "\n"; - std::cout << strong_relaxed_complex << "\n"; - - //BOOST_CHECK(relaxed_complex.num_simplices() == 24); - - //BOOST_CHECK(witnessComplex.is_witness_complex(knn, false)); - - -} diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp new file mode 100644 index 00000000..abd0a0dd --- /dev/null +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -0,0 +1,103 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2016 INRIA Sophia Antipolis-Méditerranée (France) + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE "simple_witness_complex" +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include + +typedef Gudhi::Simplex_tree<> Simplex_tree; +typedef std::vector< Vertex_handle > typeVectorVertex; +typedef CGAL::Epick_d Kernel; +typedef typename Kernel::FT FT; +typedef typename Kernel::Point_d Point_d; +typedef Gudhi::witness_complex::Witness_complex WitnessComplex; +typedef Gudhi::witness_complex::Strong_witness_complex StrongWitnessComplex; + +/* All landmarks and witnesses are taken on the grid in the following manner. + LWLWL + WW.WW + L...L + WW.WW + LWLWL + + Witness complex consists of 8 vertices, 12 edges and 4 triangles + */ + +BOOST_AUTO_TEST_CASE(simple_witness_complex) { + Simplex_tree complex, relaxed_complex, strong_relaxed_complex; + + std::vector witnesses, landmarks; + + landmarks.push_back(Point_d(std::vector{-2,-2})); + landmarks.push_back(Point_d(std::vector{-2, 0})); + landmarks.push_back(Point_d(std::vector{-2, 2})); + landmarks.push_back(Point_d(std::vector{ 0,-2})); + landmarks.push_back(Point_d(std::vector{ 0, 2})); + landmarks.push_back(Point_d(std::vector{ 2,-2})); + landmarks.push_back(Point_d(std::vector{ 2, 0})); + landmarks.push_back(Point_d(std::vector{ 2, 2})); + witnesses.push_back(Point_d(std::vector{-2,-1})); + witnesses.push_back(Point_d(std::vector{-2, 1})); + witnesses.push_back(Point_d(std::vector{-1,-2})); + witnesses.push_back(Point_d(std::vector{-1,-1})); + witnesses.push_back(Point_d(std::vector{-1, 1})); + witnesses.push_back(Point_d(std::vector{-1, 2})); + witnesses.push_back(Point_d(std::vector{ 1,-2})); + witnesses.push_back(Point_d(std::vector{ 1,-1})); + witnesses.push_back(Point_d(std::vector{ 1, 1})); + witnesses.push_back(Point_d(std::vector{ 1, 2})); + witnesses.push_back(Point_d(std::vector{ 2,-1})); + witnesses.push_back(Point_d(std::vector{ 2, 1})); + + WitnessComplex witness_complex(landmarks.begin(), + landmarks.end(), + witnesses.begin(), + witnesses.end()); + witness_complex.create_complex(complex, 0); + + BOOST_CHECK(complex.num_simplices() == 24); + + witness_complex.create_complex(relaxed_complex, 8.01); + + BOOST_CHECK(relaxed_complex.num_simplices() == 239); + + StrongWitnessComplex strong_witness_complex(landmarks.begin(), + landmarks.end(), + witnesses.begin(), + witnesses.end()); + + strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); + + BOOST_CHECK(strong_relaxed_complex.num_simplices() == 239); + +} -- cgit v1.2.3 From 724b438df782cd736c1a72f64a68a6c2e8d35026 Mon Sep 17 00:00:00 2001 From: skachano Date: Mon, 10 Oct 2016 08:11:57 +0000 Subject: Deleted a redundant test git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1681 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 1f9aad522de403b3554b3289c412ee9dea3e66bf --- src/Witness_complex/test/CMakeLists.txt | 10 ---- .../test/witness_complex_points.cpp | 58 ---------------------- 2 files changed, 68 deletions(-) delete mode 100644 src/Witness_complex/test/witness_complex_points.cpp (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/test/CMakeLists.txt b/src/Witness_complex/test/CMakeLists.txt index 751f533c..c616ccdf 100644 --- a/src/Witness_complex/test/CMakeLists.txt +++ b/src/Witness_complex/test/CMakeLists.txt @@ -18,13 +18,3 @@ add_test(NAME simple_witness_complex COMMAND ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_test_simple_witness_complex # XML format for Jenkins xUnit plugin --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_simple_witness_complex.xml --log_level=test_suite --report_level=no) - -add_executable ( witness_complex_pointsUT witness_complex_points.cpp ) -target_link_libraries(witness_complex_pointsUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - -# Unitary tests definition and xml result file generation -add_test(NAME witness_complex_pointsUT - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/witness_complex_pointsUT - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/witness_complex_pointsUT.xml --log_level=test_suite --report_level=no) - diff --git a/src/Witness_complex/test/witness_complex_points.cpp b/src/Witness_complex/test/witness_complex_points.cpp deleted file mode 100644 index d40bbf14..00000000 --- a/src/Witness_complex/test/witness_complex_points.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2016 INRIA Sophia Antipolis-Méditerranée (France) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE "witness_complex_points" -#include -#include - -#include -#include -#include -#include - -#include -#include - -typedef std::vector Point; -typedef std::vector< Vertex_handle > typeVectorVertex; -typedef Gudhi::Simplex_tree<> Simplex_tree; -typedef Gudhi::witness_complex::Witness_complex WitnessComplex; - -BOOST_AUTO_TEST_CASE(witness_complex_points) { - std::vector< typeVectorVertex > knn; - std::vector< Point > points, landmarks; - // Add grid points as witnesses - for (double i = 0; i < 10; i += 1.0) - for (double j = 0; j < 10; j += 1.0) - for (double k = 0; k < 10; k += 1.0) - points.push_back(Point({i, j, k})); - - bool b_print_output = false; - // First test: random choice - Simplex_tree complex1; - Gudhi::subsampling::pick_n_random_points(points, 100, std::back_inserter(landmarks)); - Gudhi::witness_complex::construct_closest_landmark_table(points, landmarks, knn); - assert(!knn.empty()); - WitnessComplex witnessComplex1(knn, 100, 3, complex1); - BOOST_CHECK(witnessComplex1.is_witness_complex(knn, b_print_output)); -} -- cgit v1.2.3 From d1ec002edb5b3e1d72770418e55665cca58131c9 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 10 Oct 2016 11:02:15 +0000 Subject: Fix cmake issues git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1682 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e2570097e2fe1091b9beb5ef7e44d6dbd01d0ced --- src/Witness_complex/example/CMakeLists.txt | 15 +++++++++++++-- src/Witness_complex/test/test_simple_witness_complex.cpp | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/example/CMakeLists.txt b/src/Witness_complex/example/CMakeLists.txt index 38cfa821..848239b5 100644 --- a/src/Witness_complex/example/CMakeLists.txt +++ b/src/Witness_complex/example/CMakeLists.txt @@ -7,12 +7,23 @@ if(CGAL_FOUND) if (EIGEN3_FOUND) add_executable( Witness_complex_example_off example_witness_complex_off.cpp ) add_executable ( Witness_complex_example_sphere example_witness_complex_sphere.cpp ) + add_executable ( Witness_complex_example_witness_persistence example_witness_complex_persistence.cpp ) target_link_libraries(Witness_complex_example_witness_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY}) - add_test(Witness_complex_test_torus_persistence src/Witness_complex/example/Witness_complex_example_witncess_complex_persistence ../data/points/tore3D_1307.off -l 20 -a 0.5) + add_executable ( Witness_complex_example_strong_witness_persistence example_strong_witness_persistence.cpp ) target_link_libraries(Witness_complex_example_strong_witness_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY}) - add_test(Witness_complex_test_torus_persistence src/Witness_complex/example/Witness_complex_example_strong_witness_persistence ../data/points/tore3D_1307.off -l 20 -a 0.5) + if (TBB_FOUND) + target_link_libraries(Witness_complex_example_witness_persistence ${TBB_LIBRARIES}) + target_link_libraries(Witness_complex_example_strong_witness_persistence ${TBB_LIBRARIES}) + endif() + + add_test(Witness_complex_test_torus_persistence + ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_witness_persistence + ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -l 20 -a 0.5) + add_test(Witness_complex_test_torus_persistence + ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_strong_witness_persistence + ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -l 20 -a 0.5) endif(EIGEN3_FOUND) endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) endif() diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index abd0a0dd..759ee14d 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -85,10 +85,12 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { witnesses.end()); witness_complex.create_complex(complex, 0); + std::cout << "complex.num_simplices() = " << complex.num_simplices() << std::endl; BOOST_CHECK(complex.num_simplices() == 24); witness_complex.create_complex(relaxed_complex, 8.01); + std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex.num_simplices() << std::endl; BOOST_CHECK(relaxed_complex.num_simplices() == 239); StrongWitnessComplex strong_witness_complex(landmarks.begin(), @@ -98,6 +100,7 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); + std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex.num_simplices() << std::endl; BOOST_CHECK(strong_relaxed_complex.num_simplices() == 239); } -- cgit v1.2.3 From 4473c9fd8d23097ed7b5570b800db245539e91d2 Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 18 Oct 2016 12:32:40 +0000 Subject: Removed Sophia Antipolis from copyrights git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1731 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: f97758e943397259712ad76c4db117df3d3415b6 --- src/Witness_complex/example/example_strong_witness_persistence.cpp | 2 +- src/Witness_complex/example/example_witness_complex_off.cpp | 2 +- src/Witness_complex/example/example_witness_complex_persistence.cpp | 2 +- src/Witness_complex/example/example_witness_complex_sphere.cpp | 2 +- src/Witness_complex/include/gudhi/Active_witness/Active_witness.h | 2 +- .../include/gudhi/Active_witness/Active_witness_iterator.h | 2 +- src/Witness_complex/include/gudhi/Strong_witness_complex.h | 2 +- src/Witness_complex/include/gudhi/Witness_complex.h | 2 +- src/Witness_complex/test/test_simple_witness_complex.cpp | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/example/example_strong_witness_persistence.cpp b/src/Witness_complex/example/example_strong_witness_persistence.cpp index 4e06867d..f43cba52 100644 --- a/src/Witness_complex/example/example_strong_witness_persistence.cpp +++ b/src/Witness_complex/example/example_strong_witness_persistence.cpp @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2016 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2016 INRIA (France) * * 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/Witness_complex/example/example_witness_complex_off.cpp b/src/Witness_complex/example/example_witness_complex_off.cpp index 37646faf..94088370 100644 --- a/src/Witness_complex/example/example_witness_complex_off.cpp +++ b/src/Witness_complex/example/example_witness_complex_off.cpp @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2015 INRIA (France) * * 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/Witness_complex/example/example_witness_complex_persistence.cpp b/src/Witness_complex/example/example_witness_complex_persistence.cpp index a4388047..b1b415fa 100644 --- a/src/Witness_complex/example/example_witness_complex_persistence.cpp +++ b/src/Witness_complex/example/example_witness_complex_persistence.cpp @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2016 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2016 INRIA (France) * * 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/Witness_complex/example/example_witness_complex_sphere.cpp b/src/Witness_complex/example/example_witness_complex_sphere.cpp index 8e2c5ff6..d21195fa 100644 --- a/src/Witness_complex/example/example_witness_complex_sphere.cpp +++ b/src/Witness_complex/example/example_witness_complex_sphere.cpp @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2015 INRIA (France) * * 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/Witness_complex/include/gudhi/Active_witness/Active_witness.h b/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h index c6113442..fce7d3d1 100644 --- a/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h +++ b/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2016 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2016 INRIA (France) * * 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/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h b/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h index 25897de6..ae051bea 100644 --- a/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h +++ b/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2016 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2016 INRIA (France) * * 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/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h index 73de580d..7ef8d3e5 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2015 INRIA (France) * * 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/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index e336dc4f..ac0e8f66 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2015 INRIA (France) * * 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/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index 759ee14d..90b6cfa2 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2016 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2016 INRIA (France) * * 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 -- cgit v1.2.3 From 2fbcf3afe9bf246774ace4ff8b3524b45b2a869b Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 18 Oct 2016 13:06:24 +0000 Subject: Added Doxygen names for Witness_complex_doc sections git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1734 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c860505be703779dccad23af24945b6298caf27e --- src/Witness_complex/doc/Witness_complex_doc.h | 6 +++--- src/Witness_complex/test/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/doc/Witness_complex_doc.h b/src/Witness_complex/doc/Witness_complex_doc.h index e17b0fa6..4f3671e5 100644 --- a/src/Witness_complex/doc/Witness_complex_doc.h +++ b/src/Witness_complex/doc/Witness_complex_doc.h @@ -8,7 +8,7 @@ \image html "Witness_complex_representation.png" "Witness complex representation" - \section Definitions + \section witnessdefinitions Definitions Witness complex is a simplicial complex defined on two sets of points in \f$\mathbb{R}^D\f$: @@ -34,7 +34,7 @@ which leads to definitions of **weak relaxed witness complex** (or just relaxed witness complex for short) and **strong relaxed witness complex** respectively. - \section Implementation + \section witnessimplementation Implementation The two complexes described above are implemented in the corresponding classes - Gudhi::witness_complex::Witness_complex @@ -47,7 +47,7 @@ The constructors take on the step 1, while the function 'create_complex' executes the steps 2 and 3. - \section Examples + \section witnessexamples Examples Here is an example of constructing a strong witness complex filtration and computing persistence on it: diff --git a/src/Witness_complex/test/CMakeLists.txt b/src/Witness_complex/test/CMakeLists.txt index c616ccdf..8d68ea1f 100644 --- a/src/Witness_complex/test/CMakeLists.txt +++ b/src/Witness_complex/test/CMakeLists.txt @@ -17,4 +17,4 @@ target_link_libraries(Witness_complex_test_simple_witness_complex ${Boost_SYSTEM add_test(NAME simple_witness_complex COMMAND ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_test_simple_witness_complex # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_simple_witness_complex.xml --log_level=test_suite --report_level=no) + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_simple_witness_complexUT.xml --log_level=test_suite --report_level=no) -- cgit v1.2.3 From fe79f2dcfd8b1540485d8a81fa7cedd07f5c8fac Mon Sep 17 00:00:00 2001 From: skachano Date: Wed, 19 Oct 2016 08:19:49 +0000 Subject: Clément's remarks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1735 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c3bc66a081a0bc73874246e1e12ab98c6bf2a53e --- src/Witness_complex/doc/Witness_complex_doc.h | 10 +++++-- .../example/example_strong_witness_persistence.cpp | 28 ++---------------- .../example/example_witness_complex_off.cpp | 28 ++---------------- .../example_witness_complex_persistence.cpp | 28 ++---------------- .../example/example_witness_complex_sphere.cpp | 27 ++--------------- .../include/gudhi/Strong_witness_complex.h | 27 ++++++++--------- .../include/gudhi/Witness_complex.h | 32 +++++++------------- .../test/test_simple_witness_complex.cpp | 34 +++------------------- 8 files changed, 43 insertions(+), 171 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/doc/Witness_complex_doc.h b/src/Witness_complex/doc/Witness_complex_doc.h index 4f3671e5..2831f107 100644 --- a/src/Witness_complex/doc/Witness_complex_doc.h +++ b/src/Witness_complex/doc/Witness_complex_doc.h @@ -17,7 +17,7 @@ Even though often the set of landmarks \f$L\f$ is a subset of the set of witnesses \f$ W\f$, it is not a requirement for the current implementation. - The simplices are based on landmarks + Landmarks are the vertices of the simplicial complex and witnesses help to decide on which simplices are inserted via a predicate "is witnessed". De Silva and Carlsson in their paper \cite de2004topological differentiate **weak witnessing** and **strong witnessing**: @@ -47,7 +47,13 @@ The constructors take on the step 1, while the function 'create_complex' executes the steps 2 and 3. - \section witnessexamples Examples + \section witnessexample1 Example 1: Constructing weak relaxed witness complex from an off file + + Let's start with a simple example, which reads an off point file and computes a weak witness complex. + + \include Witness_complex/example_witness_complex_off.cpp + + \section witnessexample2 Example2: Computing persistence using strong relaxed witness complex Here is an example of constructing a strong witness complex filtration and computing persistence on it: diff --git a/src/Witness_complex/example/example_strong_witness_persistence.cpp b/src/Witness_complex/example/example_strong_witness_persistence.cpp index f43cba52..a0563ee2 100644 --- a/src/Witness_complex/example/example_strong_witness_persistence.cpp +++ b/src/Witness_complex/example/example_strong_witness_persistence.cpp @@ -1,25 +1,3 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2016 INRIA (France) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - #include #include #include @@ -81,10 +59,8 @@ int main(int argc, char * argv[]) { Gudhi::subsampling::pick_n_random_points(witnesses, nbL, std::back_inserter(landmarks)); // Compute witness complex - Strong_witness_complex strong_witness_complex(landmarks.begin(), - landmarks.end(), - witnesses.begin(), - witnesses.end()); + Strong_witness_complex strong_witness_complex(landmarks, + witnesses); strong_witness_complex.create_complex(simplex_tree, max_squared_alpha); diff --git a/src/Witness_complex/example/example_witness_complex_off.cpp b/src/Witness_complex/example/example_witness_complex_off.cpp index 94088370..2677499a 100644 --- a/src/Witness_complex/example/example_witness_complex_off.cpp +++ b/src/Witness_complex/example/example_witness_complex_off.cpp @@ -1,25 +1,3 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2015 INRIA (France) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - #include #include @@ -72,10 +50,8 @@ int main(int argc, char * const argv[]) { // Compute witness complex start = clock(); - Witness_complex witness_complex(landmarks.begin(), - landmarks.end(), - point_vector.begin(), - point_vector.end()); + Witness_complex witness_complex(landmarks, + point_vector); witness_complex.create_complex(simplex_tree, alpha2, lim_dim); end = clock(); diff --git a/src/Witness_complex/example/example_witness_complex_persistence.cpp b/src/Witness_complex/example/example_witness_complex_persistence.cpp index b1b415fa..00f00aae 100644 --- a/src/Witness_complex/example/example_witness_complex_persistence.cpp +++ b/src/Witness_complex/example/example_witness_complex_persistence.cpp @@ -1,25 +1,3 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2016 INRIA (France) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - #include #include #include @@ -81,10 +59,8 @@ int main(int argc, char * argv[]) { Gudhi::subsampling::pick_n_random_points(witnesses, nbL, std::back_inserter(landmarks)); // Compute witness complex - Witness_complex witness_complex(landmarks.begin(), - landmarks.end(), - witnesses.begin(), - witnesses.end()); + Witness_complex witness_complex(landmarks, + witnesses); witness_complex.create_complex(simplex_tree, max_squared_alpha); diff --git a/src/Witness_complex/example/example_witness_complex_sphere.cpp b/src/Witness_complex/example/example_witness_complex_sphere.cpp index d21195fa..42fb9f8d 100644 --- a/src/Witness_complex/example/example_witness_complex_sphere.cpp +++ b/src/Witness_complex/example/example_witness_complex_sphere.cpp @@ -1,24 +1,3 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2015 INRIA (France) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ #define BOOST_PARAMETER_MAX_ARITY 12 @@ -80,10 +59,8 @@ int main(int argc, char * const argv[]) { Gudhi::subsampling::pick_n_random_points(point_vector, number_of_landmarks, std::back_inserter(landmarks)); // Compute witness complex - Witness_complex witness_complex(landmarks.begin(), - landmarks.end(), - point_vector.begin(), - point_vector.end()); + Witness_complex witness_complex(landmarks, + point_vector); witness_complex.create_complex(simplex_tree, 0); end = clock(); double time = static_cast(end - start) / CLOCKS_PER_SEC; diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h index 7ef8d3e5..c7b8c27b 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -94,22 +94,18 @@ private: /** * \brief Initializes member variables before constructing simplicial complex. - * \details Records landmarks from the range [landmarks_first, landmarks_last) into a - * table internally, as well as witnesses from the range [witnesses_first, witnesses_last). - * All iterator parameters should satisfy InputIterator - * C++ concept. + * \details Records landmarks from the range 'landmarks' into a + * table internally, as well as witnesses from the range 'witnesses'. */ - template< typename InputIteratorLandmarks, - typename InputIteratorWitnesses > - Strong_witness_complex(InputIteratorLandmarks landmarks_first, - InputIteratorLandmarks landmarks_last, - InputIteratorWitnesses witnesses_first, - InputIteratorWitnesses witnesses_last) - : witnesses_(witnesses_first, witnesses_last), landmarks_(landmarks_first, landmarks_last), landmark_tree_(landmarks_) + template< typename LandmarkRange, + typename WitnessRange > + Strong_witness_complex(const LandmarkRange & landmarks, + const WitnessRange & witnesses) + : witnesses_(witnesses), landmarks_(landmarks), landmark_tree_(landmarks_) { } + /** \brief Returns the point corresponding to the given vertex. */ template @@ -118,9 +114,10 @@ private: return landmarks_[vertex]; } - /** \brief Outputs the strong witness complex in a simplicial complex data structure. - * @param[out] complex Simplicial complex data structure compatible with 'find' and 'insert' operations. - * (Cf SimplicialComplexForWitness) + /** \brief Outputs the strong witness complex of relaxation 'max_alpha_square' + * in a simplicial complex data structure. + * @param[out] complex Simplicial complex data structure, which is a model of + * SimplicialComplexForWitness concept. * @param[in] max_alpha_square Maximal squared relaxation parameter. * @param[in] limit_dimension Represents the maximal dimension of the simplicial complex * (default value = no limit). diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index ac0e8f66..c1d402c6 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -46,12 +46,6 @@ namespace witness_complex { * \tparam Kernel_ requires a CGAL::Epick_d class, which * can be static if you know the ambiant dimension at compile-time, or dynamic if you don't. - * \tparam DimensionTag can be either Dimension_tag - * if you know the intrinsic dimension at compile-time, - * or CGAL::Dynamic_dimension_tag - * if you don't. */ template< class Kernel_ > class Witness_complex { @@ -94,19 +88,14 @@ private: /** * \brief Initializes member variables before constructing simplicial complex. - * \details Records landmarks from the range [landmarks_first, landmarks_last) into a - * table internally, as well as witnesses from the range [witnesses_first, witnesses_last). - * All iterator parameters should satisfy InputIterator - * C++ concept. + * \details Records landmarks from the range 'landmarks' into a + * table internally, as well as witnesses from the range 'witnesses'. */ - template< typename InputIteratorLandmarks, - typename InputIteratorWitnesses > - Witness_complex(InputIteratorLandmarks landmarks_first, - InputIteratorLandmarks landmarks_last, - InputIteratorWitnesses witnesses_first, - InputIteratorWitnesses witnesses_last) - : witnesses_(witnesses_first, witnesses_last), landmarks_(landmarks_first, landmarks_last), landmark_tree_(landmarks_) + template< typename LandmarkRange, + typename WitnessRange > + Witness_complex(const LandmarkRange & landmarks, + const WitnessRange & witnesses) + : witnesses_(witnesses), landmarks_(landmarks), landmark_tree_(landmarks_) { } @@ -118,9 +107,10 @@ private: return landmarks_[vertex]; } - /** \brief Outputs the (weak) witness complex in a simplicial complex data structure. - * @param[out] complex Simplicial complex data structure compatible with 'find' and 'insert' operations. - * (Cf SimplicialComplexForWitness) + /** \brief Outputs the (weak) witness complex of relaxation 'max_alpha_square' + * in a simplicial complex data structure. + * @param[out] complex Simplicial complex data structure compatible which is a model of + * SimplicialComplexForWitness concept. * @param[in] max_alpha_square Maximal squared relaxation parameter. * @param[in] limit_dimension Represents the maximal dimension of the simplicial complex * (default value = no limit). diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index 90b6cfa2..a0a1b36c 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -1,25 +1,3 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Siargey Kachanovich - * - * Copyright (C) 2016 INRIA (France) - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE "simple_witness_complex" #include @@ -79,10 +57,8 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { witnesses.push_back(Point_d(std::vector{ 2,-1})); witnesses.push_back(Point_d(std::vector{ 2, 1})); - WitnessComplex witness_complex(landmarks.begin(), - landmarks.end(), - witnesses.begin(), - witnesses.end()); + WitnessComplex witness_complex(landmarks, + witnesses); witness_complex.create_complex(complex, 0); std::cout << "complex.num_simplices() = " << complex.num_simplices() << std::endl; @@ -93,10 +69,8 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex.num_simplices() << std::endl; BOOST_CHECK(relaxed_complex.num_simplices() == 239); - StrongWitnessComplex strong_witness_complex(landmarks.begin(), - landmarks.end(), - witnesses.begin(), - witnesses.end()); + StrongWitnessComplex strong_witness_complex(landmarks, + witnesses); strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); -- cgit v1.2.3 From e36bb3953817d9aa3b1baaa61e51cee4099787b9 Mon Sep 17 00:00:00 2001 From: skachano Date: Fri, 16 Dec 2016 08:42:13 +0000 Subject: memory access violation: here we go again git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1892 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: fff0a693f83f8f0a0f93d2fe57640408e7b17c69 --- src/Witness_complex/include/gudhi/Strong_witness_complex.h | 13 +++++++------ src/Witness_complex/test/test_simple_witness_complex.cpp | 8 +++++--- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h index 3803980b..5f9db5a4 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -162,7 +162,8 @@ private: // continue inserting limD-faces of the following simplices typeVectorVertex& vertices = simplex; //'simplex' now will be called vertices while (aw_it != aw.end() && aw_it->second < lim_dist2) { - add_all_faces_of_dimension(limD, vertices, vertices.begin(), aw_it, typeVectorVertex({}), complex); + typeVectorVertex facet = {}; + add_all_faces_of_dimension(limit_dimension, vertices, vertices.begin(), aw_it, facet, complex); vertices.push_back(aw_it->first); aw_it++; } @@ -181,17 +182,17 @@ private: * The landmark pointed by aw_it is added to all formed simplices. */ template < typename SimplicialComplexForWitness > - void add_all_faces_of_dimension(int dim, - std::vector& vertices, + void add_all_faces_of_dimension(Landmark_id dim, + typeVectorVertex& vertices, typename typeVectorVertex::iterator curr_it, typename ActiveWitness::iterator aw_it, - std::vector& simplex, + typeVectorVertex& simplex, SimplicialComplexForWitness& sc) { if (dim > 0) while (curr_it != vertices.end()) { - simplex.push_back(curr_it->first); - typename ActiveWitness::iterator next_it = curr_it++; + simplex.push_back(*curr_it); + typename typeVectorVertex::iterator next_it = curr_it++; add_all_faces_of_dimension(dim-1, vertices, next_it, diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index a0a1b36c..dc7f3175 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -32,7 +32,7 @@ typedef Gudhi::witness_complex::Strong_witness_complex StrongWitnessComp */ BOOST_AUTO_TEST_CASE(simple_witness_complex) { - Simplex_tree complex, relaxed_complex, strong_relaxed_complex; + Simplex_tree complex, relaxed_complex, strong_relaxed_complex, strong_relaxed_complex2; std::vector witnesses, landmarks; @@ -73,8 +73,10 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { witnesses); strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); - + strong_witness_complex.create_complex(strong_relaxed_complex2, 9.1, 2); + std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex.num_simplices() << std::endl; BOOST_CHECK(strong_relaxed_complex.num_simplices() == 239); - + + std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2.num_simplices() << std::endl; } -- cgit v1.2.3 From 7f5d6edb13f0c15bf85552984f3f6930fb810711 Mon Sep 17 00:00:00 2001 From: skachano Date: Fri, 16 Dec 2016 16:58:38 +0000 Subject: I'm almost there... git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1908 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a3f2a7ccf38672e51462d2ce42056d82b675d45a --- src/Witness_complex/include/gudhi/Strong_witness_complex.h | 4 ++-- src/Witness_complex/test/CMakeLists.txt | 1 + src/Witness_complex/test/test_simple_witness_complex.cpp | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h index 5f9db5a4..4b39704e 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -192,7 +192,7 @@ private: if (dim > 0) while (curr_it != vertices.end()) { simplex.push_back(*curr_it); - typename typeVectorVertex::iterator next_it = curr_it++; + typename typeVectorVertex::iterator next_it = ++curr_it; add_all_faces_of_dimension(dim-1, vertices, next_it, @@ -209,7 +209,7 @@ private: } else if (dim == 0) { simplex.push_back(aw_it->first); - sc.insert_simplex(simplex, aw_it->second); + sc.insert_simplex_and_subfaces(simplex, aw_it->second); simplex.pop_back(); } } diff --git a/src/Witness_complex/test/CMakeLists.txt b/src/Witness_complex/test/CMakeLists.txt index 8d68ea1f..084761e2 100644 --- a/src/Witness_complex/test/CMakeLists.txt +++ b/src/Witness_complex/test/CMakeLists.txt @@ -12,6 +12,7 @@ endif() add_executable ( Witness_complex_test_simple_witness_complex test_simple_witness_complex.cpp ) target_link_libraries(Witness_complex_test_simple_witness_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +target_link_libraries(Witness_complex_test_simple_witness_complex ${TBB_LIBRARIES}) # Unitary tests definition and xml result file generation add_test(NAME simple_witness_complex diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index dc7f3175..299c7fd6 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -68,6 +68,10 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex.num_simplices() << std::endl; BOOST_CHECK(relaxed_complex.num_simplices() == 239); + // All edges but big diagonals are present. + // + // Simplex count (number:dimension): + StrongWitnessComplex strong_witness_complex(landmarks, witnesses); @@ -78,5 +82,7 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex.num_simplices() << std::endl; BOOST_CHECK(strong_relaxed_complex.num_simplices() == 239); - std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2.num_simplices() << std::endl; + std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2.num_simplices() << std::endl; + BOOST_CHECK(strong_relaxed_complex2.num_simplices() == 101); + std::cout << strong_relaxed_complex2 << std::endl; } -- cgit v1.2.3 From be4e9ebd24f48def07f6dfec1a46791321fbaee4 Mon Sep 17 00:00:00 2001 From: skachano Date: Fri, 16 Dec 2016 17:51:58 +0000 Subject: The bug with limit dimension in Strong witness is fixed git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1912 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 2229381ca73da7ebe6a8b22d9a9a8eab70f65eb5 --- src/Witness_complex/include/gudhi/Strong_witness_complex.h | 2 +- src/Witness_complex/test/test_simple_witness_complex.cpp | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h index a3f88aae..3bb39c61 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -154,7 +154,7 @@ private: typeVectorVertex simplex; typename ActiveWitness::iterator aw_it = aw.begin(); float lim_dist2 = aw.begin()->second + max_alpha_square; - while ((Landmark_id)simplex.size() <= limit_dimension + 1 && aw_it != aw.end() && aw_it->second < lim_dist2) { + while ((Landmark_id)simplex.size() < limit_dimension + 1 && aw_it != aw.end() && aw_it->second < lim_dist2) { simplex.push_back(aw_it->first); complex.insert_simplex_and_subfaces(simplex, aw_it->second - aw.begin()->second); aw_it++; diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index 299c7fd6..aff6949e 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -68,9 +68,7 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex.num_simplices() << std::endl; BOOST_CHECK(relaxed_complex.num_simplices() == 239); - // All edges but big diagonals are present. - // - // Simplex count (number:dimension): + // The corner simplex {0,2,5,7} and its cofaces are missing. StrongWitnessComplex strong_witness_complex(landmarks, @@ -83,6 +81,6 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { BOOST_CHECK(strong_relaxed_complex.num_simplices() == 239); std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2.num_simplices() << std::endl; - BOOST_CHECK(strong_relaxed_complex2.num_simplices() == 101); - std::cout << strong_relaxed_complex2 << std::endl; + BOOST_CHECK(strong_relaxed_complex2.num_simplices() == 92); + // 8 vertices, 28 edges, 56 triangles } -- cgit v1.2.3 From f6992f0e5eb53d67a567ee0f12d2c16099bcaf1b Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 17 Jan 2017 22:58:28 +0000 Subject: Added a non-Euclidean version of Witness. Compiles, but doesn't work git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1943 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a825e1ad183ae40170414038e70ce37d38e09689 --- .../include/gudhi/Witness_complex.h | 68 ++++++---------------- .../test/test_simple_witness_complex.cpp | 52 +++++++++++++---- 2 files changed, 61 insertions(+), 59 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index 56ea8613..22f0f590 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -47,37 +47,22 @@ namespace witness_complex { * href="http://doc.cgal.org/latest/Kernel_d/classCGAL_1_1Epick__d.html">CGAL::Epick_d class, which * can be static if you know the ambiant dimension at compile-time, or dynamic if you don't. */ -template< class Kernel_ > +template< class Nearest_landmark_table_ > class Witness_complex { private: - typedef Kernel_ K; - typedef typename K::Point_d Point_d; - typedef typename K::FT FT; - typedef std::vector Point_range; - typedef gss::Kd_tree_search Kd_tree; - typedef typename Kd_tree::INS_range Nearest_landmark_range; - //typedef typename std::vector Nearest_landmark_table; - //typedef typename Nearest_landmark_range::iterator Nearest_landmark_row_iterator; - - typedef std::vector< double > Point_t; - typedef std::vector< Point_t > Point_Vector; - - typedef FT Filtration_value; - - - typedef std::size_t Witness_id; - typedef typename Nearest_landmark_range::Point_with_transformed_distance Id_distance_pair; - typedef typename Id_distance_pair::first_type Landmark_id; - typedef Active_witness ActiveWitness; - typedef std::list< ActiveWitness > ActiveWitnessList; - typedef std::vector< Landmark_id > typeVectorVertex; - typedef std::pair< typeVectorVertex, Filtration_value> typeSimplex; + typedef typename Nearest_landmark_table_::value_type Nearest_landmark_range; + typedef std::size_t Witness_id; + typedef std::size_t Landmark_id; + typedef std::pair Id_distance_pair; + typedef Active_witness ActiveWitness; + typedef std::list< ActiveWitness > ActiveWitnessList; + typedef std::vector< Landmark_id > typeVectorVertex; + typedef std::pair< typeVectorVertex, Filtration_value> typeSimplex; typedef Landmark_id Vertex_handle; private: - Point_range witnesses_, landmarks_; - Kd_tree landmark_tree_; + Nearest_landmark_table_& nearest_landmark_table_; public: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -92,22 +77,13 @@ private: * table internally, as well as witnesses from the range 'witnesses'. * Both ranges should have value_type Kernel_::Point_d. */ - template< typename LandmarkRange, - typename WitnessRange > - Witness_complex(const LandmarkRange & landmarks, - const WitnessRange & witnesses) - : witnesses_(witnesses), landmarks_(landmarks), landmark_tree_(landmarks_) + + Witness_complex(Nearest_landmark_table_ & nearest_landmark_table) + : nearest_landmark_table_(nearest_landmark_table) { } - /** \brief Returns the point corresponding to the given vertex. - * @param[in] vertex Vertex handle of the point to retrieve. - */ - Point_d get_point( Vertex_handle vertex ) const - { - return landmarks_[vertex]; - } - + /** \brief Outputs the (weak) witness complex of relaxation 'max_alpha_square' * in a simplicial complex data structure. * \details The function returns true if the construction is successful and false otherwise. @@ -119,10 +95,10 @@ private: */ template < typename SimplicialComplexForWitness > bool create_complex(SimplicialComplexForWitness& complex, - FT max_alpha_square, + double max_alpha_square, Landmark_id limit_dimension = std::numeric_limits::max()) { - std::size_t nbL = landmarks_.size(); + // std::size_t nbL = landmarks_.size(); if (complex.num_vertices() > 0) { std::cerr << "Witness complex cannot create complex - complex is not empty.\n"; return false; @@ -137,15 +113,9 @@ private: } typeVectorVertex vv; ActiveWitnessList active_witnesses; - for (unsigned i = 0; i != nbL; ++i) { - // initial fill of 0-dimensional simplices - // by doing it we don't assume that landmarks are necessarily witnesses themselves anymore - vv = {i}; - complex.insert_simplex(vv, Filtration_value(0.0)); - } - Landmark_id k = 1; /* current dimension in iterative construction */ - for (auto w: witnesses_) - active_witnesses.push_back(ActiveWitness(landmark_tree_.query_incremental_nearest_neighbors(w))); + Landmark_id k = 0; /* current dimension in iterative construction */ + for (auto w: nearest_landmark_table_) + active_witnesses.push_back(ActiveWitness(w)); ActiveWitness aw_copy(active_witnesses.front()); while (!active_witnesses.empty() && k <= limit_dimension ) { typename ActiveWitnessList::iterator aw_it = active_witnesses.begin(); diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index aff6949e..c50e829a 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -6,8 +6,13 @@ #include #include + #include +#include #include +#include + +#include #include #include @@ -18,8 +23,15 @@ typedef std::vector< Vertex_handle > typeVectorVertex; typedef CGAL::Epick_d Kernel; typedef typename Kernel::FT FT; typedef typename Kernel::Point_d Point_d; -typedef Gudhi::witness_complex::Witness_complex WitnessComplex; -typedef Gudhi::witness_complex::Strong_witness_complex StrongWitnessComplex; +typedef Gudhi::witness_complex::Euclidean_witness_complex EuclideanWitnessComplex; +typedef Gudhi::witness_complex::Euclidean_strong_witness_complex EuclideanStrongWitnessComplex; + +typedef std::vector Point_range; +typedef Gudhi::spatial_searching::Kd_tree_search Kd_tree; +typedef Kd_tree::INS_range Nearest_landmark_range; +typedef std::vector Nearest_landmark_table; +typedef Gudhi::witness_complex::Witness_complex WitnessComplex; + /* All landmarks and witnesses are taken on the grid in the following manner. LWLWL @@ -33,8 +45,9 @@ typedef Gudhi::witness_complex::Strong_witness_complex StrongWitnessComp BOOST_AUTO_TEST_CASE(simple_witness_complex) { Simplex_tree complex, relaxed_complex, strong_relaxed_complex, strong_relaxed_complex2; - - std::vector witnesses, landmarks; + Simplex_tree complex_ne, relaxed_complex_ne, strong_relaxed_complex_ne, strong_relaxed_complex2_ne; + + Point_range witnesses, landmarks; landmarks.push_back(Point_d(std::vector{-2,-2})); landmarks.push_back(Point_d(std::vector{-2, 0})); @@ -56,22 +69,41 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { witnesses.push_back(Point_d(std::vector{ 1, 2})); witnesses.push_back(Point_d(std::vector{ 2,-1})); witnesses.push_back(Point_d(std::vector{ 2, 1})); - - WitnessComplex witness_complex(landmarks, - witnesses); - witness_complex.create_complex(complex, 0); + + Kd_tree landmark_tree(landmarks); + Nearest_landmark_table nearest_landmark_table; + for (auto w: witnesses) + nearest_landmark_table.push_back(landmark_tree.query_incremental_nearest_neighbors(w)); + + // Weak witness complex: Euclidean version + EuclideanWitnessComplex eucl_witness_complex(landmarks, + witnesses); + eucl_witness_complex.create_complex(complex, 0); std::cout << "complex.num_simplices() = " << complex.num_simplices() << std::endl; BOOST_CHECK(complex.num_simplices() == 24); - witness_complex.create_complex(relaxed_complex, 8.01); + eucl_witness_complex.create_complex(relaxed_complex, 8.01); std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex.num_simplices() << std::endl; BOOST_CHECK(relaxed_complex.num_simplices() == 239); // The corner simplex {0,2,5,7} and its cofaces are missing. + // Weak witness complex: non-Euclidean version + WitnessComplex witness_complex(nearest_landmark_table); + witness_complex.create_complex(complex_ne, 0); + + std::cout << "complex.num_simplices() = " << complex_ne.num_simplices() << std::endl; + BOOST_CHECK(complex_ne.num_simplices() == 24); + + witness_complex.create_complex(relaxed_complex_ne, 8.01); + + std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex_ne.num_simplices() << std::endl; + BOOST_CHECK(relaxed_complex_ne.num_simplices() == 239); + + - StrongWitnessComplex strong_witness_complex(landmarks, + EuclideanStrongWitnessComplex strong_witness_complex(landmarks, witnesses); strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); -- cgit v1.2.3 From eed110f1e5ec3842553051a421a76dd9d47877fe Mon Sep 17 00:00:00 2001 From: skachano Date: Wed, 18 Jan 2017 10:04:19 +0000 Subject: Added a file + fixed the bug git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1945 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a5acd7e920dfba1857ed1b71bfc1b33e5522cfc3 --- .../include/gudhi/Strong_witness_complex.h | 65 +++++----------------- .../include/gudhi/Witness_complex.h | 1 - .../test/test_simple_witness_complex.cpp | 26 +++++++-- 3 files changed, 36 insertions(+), 56 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h index 3bb39c61..164d8ffe 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -53,37 +53,21 @@ namespace witness_complex { * href="http://doc.cgal.org/latest/Kernel_23/classCGAL_1_1Dynamic__dimension__tag.html">CGAL::Dynamic_dimension_tag * if you don't. */ -template< class Kernel_ > +template< class Nearest_landmark_table_ > class Strong_witness_complex { private: - typedef Kernel_ K; - typedef typename K::Point_d Point_d; - typedef typename K::FT FT; - typedef std::vector Point_range; - typedef gss::Kd_tree_search Kd_tree; - typedef typename Kd_tree::INS_range Nearest_landmark_range; - typedef typename std::vector Nearest_landmark_table; - typedef typename Nearest_landmark_range::iterator Nearest_landmark_row_iterator; + typedef typename Nearest_landmark_table_::value_type Nearest_landmark_range; + typedef std::size_t Witness_id; + typedef std::size_t Landmark_id; + typedef std::pair Id_distance_pair; + typedef Active_witness ActiveWitness; + typedef std::list< ActiveWitness > ActiveWitnessList; + typedef std::vector< Landmark_id > typeVectorVertex; - typedef std::vector< double > Point_t; - typedef std::vector< Point_t > Point_Vector; - - typedef FT Filtration_value; - - - typedef std::size_t Witness_id; - typedef typename Nearest_landmark_range::Point_with_transformed_distance Id_distance_pair; - typedef typename Id_distance_pair::first_type Landmark_id; - typedef Active_witness ActiveWitness; - typedef std::list< ActiveWitness > ActiveWitnessList; - typedef std::vector< Landmark_id > typeVectorVertex; - typedef std::pair< typeVectorVertex, Filtration_value> typeSimplex; - typedef Landmark_id Vertex_handle; private: - Point_range witnesses_, landmarks_; - Kd_tree landmark_tree_; + Nearest_landmark_table_& nearest_landmark_table_; public: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -98,22 +82,10 @@ private: * table internally, as well as witnesses from the range 'witnesses'. * Both ranges should have value_type Kernel_::Point_d. */ - template< typename LandmarkRange, - typename WitnessRange > - Strong_witness_complex(const LandmarkRange & landmarks, - const WitnessRange & witnesses) - : witnesses_(witnesses), landmarks_(landmarks), landmark_tree_(landmarks_) + Strong_witness_complex(Nearest_landmark_table_ & nearest_landmark_table) + : nearest_landmark_table_(nearest_landmark_table) { } - - - /** \brief Returns the point corresponding to the given vertex. - */ - template - Point_d get_point( Vertex_handle vertex ) const - { - return landmarks_[vertex]; - } /** \brief Outputs the strong witness complex of relaxation 'max_alpha_square' * in a simplicial complex data structure. @@ -126,10 +98,9 @@ private: */ template < typename SimplicialComplexForWitness > bool create_complex(SimplicialComplexForWitness& complex, - FT max_alpha_square, + double max_alpha_square, Landmark_id limit_dimension = std::numeric_limits::max()-1) { - std::size_t nbL = landmarks_.size(); Landmark_id complex_dim = 0; if (complex.num_vertices() > 0) { std::cerr << "Strong witness complex cannot create complex - complex is not empty.\n"; @@ -143,14 +114,8 @@ private: std::cerr << "Strong witness complex cannot create complex - limit dimension must be non-negative.\n"; return false; } - typeVectorVertex vv; - for (unsigned i = 0; i != nbL; ++i) { - // initial fill of 0-dimensional simplices - vv = {i}; - complex.insert_simplex(vv, Filtration_value(0.0)); - } - for (auto w: witnesses_) { - ActiveWitness aw(landmark_tree_.query_incremental_nearest_neighbors(w)); + for (auto w: nearest_landmark_table_) { + ActiveWitness aw(w); typeVectorVertex simplex; typename ActiveWitness::iterator aw_it = aw.begin(); float lim_dist2 = aw.begin()->second + max_alpha_square; @@ -186,7 +151,7 @@ private: typeVectorVertex& vertices, typename typeVectorVertex::iterator curr_it, typename ActiveWitness::iterator aw_it, - FT filtration_value, + double filtration_value, typeVectorVertex& simplex, SimplicialComplexForWitness& sc) { diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index 73993900..2cd7a178 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -58,7 +58,6 @@ private: typedef Active_witness ActiveWitness; typedef std::list< ActiveWitness > ActiveWitnessList; typedef std::vector< Landmark_id > typeVectorVertex; - typedef std::pair< typeVectorVertex, Filtration_value> typeSimplex; typedef Landmark_id Vertex_handle; diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index c50e829a..2d4134f4 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -102,17 +102,33 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { BOOST_CHECK(relaxed_complex_ne.num_simplices() == 239); - - EuclideanStrongWitnessComplex strong_witness_complex(landmarks, - witnesses); + // Strong complex : Euclidean version + EuclideanStrongWitnessComplex eucl_strong_witness_complex(landmarks, + witnesses); - strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); - strong_witness_complex.create_complex(strong_relaxed_complex2, 9.1, 2); + eucl_strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); + eucl_strong_witness_complex.create_complex(strong_relaxed_complex2, 9.1, 2); std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex.num_simplices() << std::endl; BOOST_CHECK(strong_relaxed_complex.num_simplices() == 239); std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2.num_simplices() << std::endl; BOOST_CHECK(strong_relaxed_complex2.num_simplices() == 92); + + + // Strong complex : non-Euclidean version + EuclideanStrongWitnessComplex strong_witness_complex(landmarks, + witnesses); + + strong_witness_complex.create_complex(strong_relaxed_complex_ne, 9.1); + strong_witness_complex.create_complex(strong_relaxed_complex2_ne, 9.1, 2); + + std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex_ne.num_simplices() << std::endl; + BOOST_CHECK(strong_relaxed_complex_ne.num_simplices() == 239); + + std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2_ne.num_simplices() << std::endl; + BOOST_CHECK(strong_relaxed_complex2_ne.num_simplices() == 92); + + // 8 vertices, 28 edges, 56 triangles } -- cgit v1.2.3 From db1398bcf173f372fc3ef7a410e4e72b0192f8cc Mon Sep 17 00:00:00 2001 From: skachano Date: Fri, 20 Jan 2017 15:24:36 +0000 Subject: non-Euclidean example works, but the test not anymore git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1975 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 251638e6417f1059529d57a8a87364a17cf9f5a2 --- src/Witness_complex/example/example_nearest_landmark_table.cpp | 10 ++++------ .../include/gudhi/Active_witness/Active_witness.h | 2 +- .../include/gudhi/Active_witness/Active_witness_iterator.h | 5 +++-- src/Witness_complex/include/gudhi/Witness_complex.h | 2 +- src/Witness_complex/test/test_simple_witness_complex.cpp | 4 ++-- 5 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/example/example_nearest_landmark_table.cpp b/src/Witness_complex/example/example_nearest_landmark_table.cpp index 00ec17e0..becf74e7 100644 --- a/src/Witness_complex/example/example_nearest_landmark_table.cpp +++ b/src/Witness_complex/example/example_nearest_landmark_table.cpp @@ -17,6 +17,7 @@ #include #include #include +#include int main(int argc, char * const argv[]) { typedef std::vector> Nearest_landmark_range; @@ -26,21 +27,18 @@ int main(int argc, char * const argv[]) { Gudhi::Simplex_tree<> simplex_tree; Nearest_landmark_table nlt; - // Example contains 10 witnesses and 5 landmarks + // Example contains 5 witnesses and 5 landmarks Nearest_landmark_range w0 = {std::make_pair(0,0), std::make_pair(1,1), std::make_pair(2,2), std::make_pair(3,3), std::make_pair(4,4)}; nlt.push_back(w0); Nearest_landmark_range w1 = {std::make_pair(1,0), std::make_pair(2,1), std::make_pair(3,2), std::make_pair(4,3), std::make_pair(0,4)}; nlt.push_back(w1); Nearest_landmark_range w2 = {std::make_pair(2,0), std::make_pair(3,1), std::make_pair(4,2), std::make_pair(0,3), std::make_pair(1,4)}; nlt.push_back(w2); Nearest_landmark_range w3 = {std::make_pair(3,0), std::make_pair(4,1), std::make_pair(0,2), std::make_pair(1,3), std::make_pair(2,4)}; nlt.push_back(w3); Nearest_landmark_range w4 = {std::make_pair(4,0), std::make_pair(0,1), std::make_pair(1,2), std::make_pair(2,3), std::make_pair(3,4)}; nlt.push_back(w4); - Nearest_landmark_range x0 = {std::make_pair(0,0), std::make_pair(4,1), std::make_pair(3,2), std::make_pair(2,3), std::make_pair(1,4)}; nlt.push_back(x0); - Nearest_landmark_range x1 = {std::make_pair(1,0), std::make_pair(0,1), std::make_pair(4,2), std::make_pair(3,3), std::make_pair(2,4)}; nlt.push_back(x1); - Nearest_landmark_range x2 = {std::make_pair(2,0), std::make_pair(1,1), std::make_pair(0,2), std::make_pair(4,3), std::make_pair(3,4)}; nlt.push_back(x2); - Nearest_landmark_range x3 = {std::make_pair(3,0), std::make_pair(2,1), std::make_pair(1,2), std::make_pair(0,3), std::make_pair(4,4)}; nlt.push_back(x3); - Nearest_landmark_range x4 = {std::make_pair(4,0), std::make_pair(3,1), std::make_pair(2,2), std::make_pair(1,3), std::make_pair(0,4)}; nlt.push_back(x4); Witness_complex witness_complex(nlt); witness_complex.create_complex(simplex_tree, 4.1); + std::cout << "Number of simplices: " << simplex_tree.num_simplices() << std::endl; + Gudhi::persistent_cohomology::Persistent_cohomology, Gudhi::persistent_cohomology::Field_Zp > pcoh(simplex_tree); // initializes the coefficient field for homology pcoh.init_coefficients(11); diff --git a/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h b/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h index debbd286..c3edc0b7 100644 --- a/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h +++ b/src/Witness_complex/include/gudhi/Active_witness/Active_witness.h @@ -50,7 +50,7 @@ public: INS_iterator iterator_end_; Active_witness(INS_range search_range) - : search_range_(search_range), iterator_last_(search_range.begin()), iterator_end_(search_range.end()) + : search_range_(search_range), iterator_last_(search_range_.begin()), iterator_end_(search_range_.end()) { nearest_landmark_table_.push_back(*iterator_last_); } diff --git a/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h b/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h index 5b040914..b0a88662 100644 --- a/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h +++ b/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h @@ -86,12 +86,13 @@ private : // if the id of the current landmark is the same as the last one if (lh_->first == aw_->iterator_last_->first) { // if the next iterator is end, lh_it = end pointer - if (++(aw_->iterator_last_) == aw_->iterator_end_) { + INS_iterator next_it = aw_->iterator_last_; next_it++; + if (next_it == aw_->iterator_end_) { is_end_ = true; return; } else { - //aw_->iterator_last_ = ++(aw_->iterator_last_); + ++(aw_->iterator_last_); aw_->nearest_landmark_table_.push_back(*(aw_->iterator_last_)); } } diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index 3305a8e2..576b8b0d 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -62,7 +62,7 @@ private: typedef Landmark_id Vertex_handle; private: - Nearest_landmark_table_& nearest_landmark_table_; + Nearest_landmark_table_ nearest_landmark_table_; public: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index 2d4134f4..b47ebe4d 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -31,6 +31,7 @@ typedef Gudhi::spatial_searching::Kd_tree_search Kd_tree; typedef Kd_tree::INS_range Nearest_landmark_range; typedef std::vector Nearest_landmark_table; typedef Gudhi::witness_complex::Witness_complex WitnessComplex; +typedef Gudhi::witness_complex::Strong_witness_complex StrongWitnessComplex; /* All landmarks and witnesses are taken on the grid in the following manner. @@ -117,8 +118,7 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { // Strong complex : non-Euclidean version - EuclideanStrongWitnessComplex strong_witness_complex(landmarks, - witnesses); + StrongWitnessComplex strong_witness_complex(nearest_landmark_table); strong_witness_complex.create_complex(strong_relaxed_complex_ne, 9.1); strong_witness_complex.create_complex(strong_relaxed_complex2_ne, 9.1, 2); -- cgit v1.2.3