diff options
Diffstat (limited to 'src/Witness_complex')
6 files changed, 18 insertions, 14 deletions
diff --git a/src/Witness_complex/example/witness_complex_from_file.cpp b/src/Witness_complex/example/witness_complex_from_file.cpp index bb641b3c..5dd18d0a 100644 --- a/src/Witness_complex/example/witness_complex_from_file.cpp +++ b/src/Witness_complex/example/witness_complex_from_file.cpp @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2015 INRIA * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +36,8 @@ #include <string> #include <vector> -typedef std::vector< Vertex_handle > typeVectorVertex; +typedef Gudhi::Simplex_tree<> Simplex_tree; +typedef std::vector< Simplex_tree::Vertex_handle > typeVectorVertex; typedef std::vector< std::vector <double> > Point_Vector; int main(int argc, char * const argv[]) { @@ -51,7 +52,7 @@ int main(int argc, char * const argv[]) { clock_t start, end; // Construct the Simplex Tree - Gudhi::Simplex_tree<> simplex_tree; + Simplex_tree simplex_tree; // Read the OFF file (input file name given as parameter) and triangulate points Gudhi::Points_off_reader<std::vector <double>> off_reader(off_file_name); @@ -69,7 +70,7 @@ int main(int argc, char * const argv[]) { std::vector<std::vector< int > > knn; Point_Vector landmarks; Gudhi::subsampling::pick_n_random_points(point_vector, 100, std::back_inserter(landmarks)); - Gudhi::witness_complex::construct_closest_landmark_table(point_vector, landmarks, knn); + Gudhi::witness_complex::construct_closest_landmark_table<Simplex_tree::Filtration_value>(point_vector, landmarks, knn); end = clock(); std::cout << "Landmark choice for " << nbL << " landmarks took " << static_cast<double>(end - start) / CLOCKS_PER_SEC << " s. \n"; diff --git a/src/Witness_complex/example/witness_complex_sphere.cpp b/src/Witness_complex/example/witness_complex_sphere.cpp index e6f88274..60e02225 100644 --- a/src/Witness_complex/example/witness_complex_sphere.cpp +++ b/src/Witness_complex/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 * * 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 @@ -40,6 +40,8 @@ #include "generators.h" +typedef Gudhi::Simplex_tree<> Simplex_tree; + /** Write a gnuplot readable file. * Data range is a random access range of pairs (arg, value) */ @@ -62,7 +64,7 @@ int main(int argc, char * const argv[]) { clock_t start, end; // Construct the Simplex Tree - Gudhi::Simplex_tree<> simplex_tree; + Simplex_tree simplex_tree; std::vector< std::pair<int, double> > l_time; @@ -77,7 +79,7 @@ int main(int argc, char * const argv[]) { start = clock(); std::vector<std::vector< int > > knn; Gudhi::subsampling::pick_n_random_points(point_vector, 100, std::back_inserter(landmarks)); - Gudhi::witness_complex::construct_closest_landmark_table(point_vector, landmarks, knn); + Gudhi::witness_complex::construct_closest_landmark_table<Simplex_tree::Filtration_value>(point_vector, landmarks, knn); // Compute witness complex Gudhi::witness_complex::witness_complex(knn, number_of_landmarks, point_vector[0].size(), simplex_tree); diff --git a/src/Witness_complex/include/gudhi/Construct_closest_landmark_table.h b/src/Witness_complex/include/gudhi/Construct_closest_landmark_table.h index ef711c34..a8cdd096 100644 --- a/src/Witness_complex/include/gudhi/Construct_closest_landmark_table.h +++ b/src/Witness_complex/include/gudhi/Construct_closest_landmark_table.h @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) + * Copyright (C) 2015 INRIA * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,7 +51,8 @@ namespace witness_complex { * Closest_landmark_range needs to have push_back operation. */ - template <typename WitnessContainer, + template <typename FiltrationValue, + typename WitnessContainer, typename LandmarkContainer, typename KNearestNeighbours> void construct_closest_landmark_table(WitnessContainer const &points, @@ -72,7 +73,8 @@ namespace witness_complex { int landmarks_i = 0; for (landmarks_it = landmarks.begin(), landmarks_i = 0; landmarks_it != landmarks.end(); ++landmarks_it, landmarks_i++) { - dist_i dist = std::make_pair(euclidean_distance(points[points_i], *landmarks_it), landmarks_i); + dist_i dist = std::make_pair(Euclidean_distance()(points[points_i], *landmarks_it), + landmarks_i); l_heap.push(dist); } for (int i = 0; i < dim + 1; i++) { diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index 489cdf11..1eb126f1 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -72,7 +72,6 @@ class Witness_complex { typedef std::vector< Point_t > Point_Vector; typedef std::vector< Vertex_handle > typeVectorVertex; - typedef std::pair< typeVectorVertex, Filtration_value> typeSimplex; typedef std::pair< Simplex_handle, bool > typePairSimplexBool; typedef int Witness_id; diff --git a/src/Witness_complex/test/simple_witness_complex.cpp b/src/Witness_complex/test/simple_witness_complex.cpp index 03df78ee..6be39f58 100644 --- a/src/Witness_complex/test/simple_witness_complex.cpp +++ b/src/Witness_complex/test/simple_witness_complex.cpp @@ -33,7 +33,7 @@ #include <vector> typedef Gudhi::Simplex_tree<> Simplex_tree; -typedef std::vector< Vertex_handle > typeVectorVertex; +typedef std::vector< Simplex_tree::Vertex_handle > typeVectorVertex; typedef Gudhi::witness_complex::Witness_complex<Simplex_tree> WitnessComplex; BOOST_AUTO_TEST_CASE(simple_witness_complex) { diff --git a/src/Witness_complex/test/witness_complex_points.cpp b/src/Witness_complex/test/witness_complex_points.cpp index d40bbf14..92f53417 100644 --- a/src/Witness_complex/test/witness_complex_points.cpp +++ b/src/Witness_complex/test/witness_complex_points.cpp @@ -34,8 +34,8 @@ #include <vector> typedef std::vector<double> Point; -typedef std::vector< Vertex_handle > typeVectorVertex; typedef Gudhi::Simplex_tree<> Simplex_tree; +typedef std::vector< Simplex_tree::Vertex_handle > typeVectorVertex; typedef Gudhi::witness_complex::Witness_complex<Simplex_tree> WitnessComplex; BOOST_AUTO_TEST_CASE(witness_complex_points) { @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(witness_complex_points) { // 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); + Gudhi::witness_complex::construct_closest_landmark_table<Simplex_tree::Filtration_value>(points, landmarks, knn); assert(!knn.empty()); WitnessComplex witnessComplex1(knn, 100, 3, complex1); BOOST_CHECK(witnessComplex1.is_witness_complex(knn, b_print_output)); |