From 8df595a525b21fdd49816f312411814b3b894c21 Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 31 Mar 2015 14:52:37 +0000 Subject: Fixed bug in landmark_choice_by_furthest_points. Stay tuned for one more bug git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@521 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e8f0a0b7122fd180b92fa3ba58e33dbec49f29ea --- src/Witness_complex/include/gudhi/Witness_complex.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index d5a35801..4b65e8a2 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -219,7 +219,7 @@ namespace Gudhi { void witness_complex_from_points(Point_Vector point_vector) { std::vector > WL; - landmark_choice_by_random_points(point_vector, point_vector.size(), WL); + landmark_choice_by_furthest_points(point_vector, point_vector.size(), WL); witness_complex(WL); } @@ -357,7 +357,6 @@ private: { //curr_max_w at this point is the next landmark chosen_landmarks.push_back(curr_max_w); - curr_max_dist = 0; //std::cout << "**********Entered loop with current number of landmarks = " << current_number_of_landmarks << std::endl; //std::cout << "WL="; print_vvector(WL); //std::cout << "WLD="; print_vvector(wit_land_dist); @@ -377,11 +376,6 @@ private: //std::cout << "Push't back\n"; if (curr_dist < dist_to_L[i]) dist_to_L[i] = curr_dist; - if (dist_to_L[i] > curr_max_dist) - { - curr_max_dist = curr_dist; - curr_max_w = i; - } j = current_number_of_landmarks; //std::cout << "First half complete\n"; while (j > 0 && wit_land_dist[i][j-1] > wit_land_dist[i][j]) @@ -400,6 +394,17 @@ private: //std::cout << "result distL="; print_vector(dist_to_L); std::cout << std::endl; //std::cout << "End loop\n"; } + std::cout << "Distance to landmarks="; print_vector(dist_to_L); std::cout << std::endl; + curr_max_dist = 0; + for (int i = 0; i < nbP; ++i) { + if (dist_to_L[i] > curr_max_dist) + { + curr_max_dist = dist_to_L[i]; + curr_max_w = i; + std::cout << "hop curr_max_w is now " << curr_max_w << std::endl; + } + } + std::cout << "Chose " << curr_max_w << " as new landmark\n"; } //std::cout << endl; } -- cgit v1.2.3