summaryrefslogtreecommitdiff
path: root/src/Witness_complex/example
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-05-30 15:36:35 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-05-30 15:36:35 +0000
commit3efbb8c26aecc9f88dae4ec69d3149a4f5f1bd40 (patch)
tree7425d42c49d1d67ee56d92775ee9df9b0b3874e4 /src/Witness_complex/example
parent5cae0e771c7d4603d25ccf06c782fe383f91e74a (diff)
witness: Testing continues
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@600 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 57d8d66a90e9839887289e4efd7fbddabe009d94
Diffstat (limited to 'src/Witness_complex/example')
-rw-r--r--src/Witness_complex/example/witness_complex_perturbations.cpp2
-rw-r--r--src/Witness_complex/example/witness_complex_sphere.cpp15
2 files changed, 13 insertions, 4 deletions
diff --git a/src/Witness_complex/example/witness_complex_perturbations.cpp b/src/Witness_complex/example/witness_complex_perturbations.cpp
index 07b1eb8d..9d39906b 100644
--- a/src/Witness_complex/example/witness_complex_perturbations.cpp
+++ b/src/Witness_complex/example/witness_complex_perturbations.cpp
@@ -328,7 +328,7 @@ int landmark_perturbation(Point_Vector &W, Point_Vector& landmarks, std::vector<
for (auto u: perturbL)
{
- Random_point_iterator rp(D,sqrt(lambda)/2);
+ Random_point_iterator rp(D,sqrt(lambda)/4);
//std::cout << landmarks[u] << std::endl;
std::vector<FT> point;
diff --git a/src/Witness_complex/example/witness_complex_sphere.cpp b/src/Witness_complex/example/witness_complex_sphere.cpp
index c9a9119a..7ba1dd61 100644
--- a/src/Witness_complex/example/witness_complex_sphere.cpp
+++ b/src/Witness_complex/example/witness_complex_sphere.cpp
@@ -489,8 +489,9 @@ void landmark_choice(Point_Vector &W, int nbP, int nbL, Point_Vector& landmarks,
{
// while (!res.second)
// {
- while (std::count(landmarks_ind.begin(),landmarks_ind.end(),chosen_landmark)!=0)
+ do
chosen_landmark = rand.get_int(0,nbP);
+ while (std::find(landmarks_ind.begin(), landmarks_ind.end(), chosen_landmark) != landmarks_ind.end());
//rand++;
//std::cout << "Chose " << chosen_landmark << std::endl;
p = &W[chosen_landmark];
@@ -546,7 +547,7 @@ int landmark_perturbation(Point_Vector &W, Point_Vector& landmarks, std::vector<
if (w[0]>0.95)
std::cout << i << std::endl;
*/
- K_neighbor_search search(L, w, D+1, FT(0), true,
+ K_neighbor_search search(L, w, D, FT(0), true,
//CGAL::Distance_adapter<std::ptrdiff_t,Point_d*,Euclidean_distance>(&(landmarks[0])) );
CGAL::Distance_adapter<std::ptrdiff_t,Point_d*,Euclidean_distance>(&(landmarks[0])) );
//std::cout << "Safely found nearest landmarks\n";
@@ -583,8 +584,10 @@ int landmark_perturbation(Point_Vector &W, Point_Vector& landmarks, std::vector<
std::set< int > perturbL;
int count_badlinks = 0;
//std::cout << "Bad links around ";
+ std::vector< int > count_bad(D+3);
+ std::vector< int > count_good(D+3);
for (auto u: witnessComplex.complex_vertex_range())
- if (!witnessComplex.has_good_link(u))
+ if (!witnessComplex.has_good_link(u, count_bad, count_good))
{
//std::cout << "Landmark " << u << " start!" << std::endl;
//perturbL.insert(u);
@@ -600,6 +603,12 @@ int landmark_perturbation(Point_Vector &W, Point_Vector& landmarks, std::vector<
//L.search(std::ostream_iterator<int>(std::cout,"\n"),fs);
//std::cout << "PerturbL size is " << perturbL.size() << std::endl;
}
+ for (unsigned int i = 0; i != count_good.size(); i++)
+ if (count_good[i] != 0)
+ std::cout << "count_good[" << i << "] = " << count_good[i] << std::endl;
+ for (unsigned int i = 0; i != count_bad.size(); i++)
+ if (count_bad[i] != 0)
+ std::cout << "count_bad[" << i << "] = " << count_bad[i] << std::endl;
std::cout << "\nBad links total: " << count_badlinks << " Points to perturb: " << perturbL.size() << std::endl;
//std::cout << "landmark[0][0] before" << landmarks[0][0] << std::endl;
//*********************** Perturb bad link landmarks