summaryrefslogtreecommitdiff
path: root/src/Witness_complex/example/witness_complex_perturbations.cpp
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-06-12 09:44:31 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-06-12 09:44:31 +0000
commit81d222a2222bb7a4e6304ed1ce708598a8e29dc6 (patch)
treeff295afb187d134c7ccf842eff25897d9ea81699 /src/Witness_complex/example/witness_complex_perturbations.cpp
parent2bfa55d843580497f00376ede3dddf5c106dc12f (diff)
Added grid witnesses for flat torus
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@610 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 34d0bfe869ee04bd0dfa832e0e36b245f33b062f
Diffstat (limited to 'src/Witness_complex/example/witness_complex_perturbations.cpp')
-rw-r--r--src/Witness_complex/example/witness_complex_perturbations.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Witness_complex/example/witness_complex_perturbations.cpp b/src/Witness_complex/example/witness_complex_perturbations.cpp
index ec7a5abe..88a7510a 100644
--- a/src/Witness_complex/example/witness_complex_perturbations.cpp
+++ b/src/Witness_complex/example/witness_complex_perturbations.cpp
@@ -194,7 +194,7 @@ void write_edges_gnuplot(std::string file_name, Witness_complex<>& witness_compl
/** Function that chooses landmarks from W and place it in the kd-tree L.
* Note: nbL hould be removed if the code moves to Witness_complex
*/
-
+/*
void landmark_choice(Point_Vector &W, int nbP, int nbL, Point_Vector& landmarks, std::vector<int>& landmarks_ind)
{
std::cout << "Enter landmark choice to kd tree\n";
@@ -216,12 +216,13 @@ void landmark_choice(Point_Vector &W, int nbP, int nbL, Point_Vector& landmarks,
//std::cout << "Added landmark " << chosen_landmark << std::endl;
}
}
-/*
+*/
+
void landmark_choice(Point_Vector &W, int nbP, int nbL, Point_Vector& landmarks, std::vector<int>& landmarks_ind)
{
std::cout << "Enter landmark choice to kd tree\n";
//std::vector<Point_d> landmarks;
- int chosen_landmark;
+ int chosen_landmark = 0;
//std::pair<Point_etiquette_map::iterator,bool> res = std::make_pair(L_i.begin(),false);
Point_d* p;
CGAL::Random rand;
@@ -229,9 +230,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)
- chosen_landmark = rand.get_int(0,nbP);
- //rand++;
+ do chosen_landmark = rand.uniform_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];
//L_i.emplace(chosen_landmark,i);
@@ -241,7 +242,7 @@ void landmark_choice(Point_Vector &W, int nbP, int nbL, Point_Vector& landmarks,
//std::cout << "Added landmark " << chosen_landmark << std::endl;
}
}
-*/
+
int landmark_perturbation(Point_Vector &W, Point_Vector& landmarks, std::vector<int>& landmarks_ind)
{
@@ -417,7 +418,8 @@ int main (int argc, char * const argv[])
}
//write_points("landmarks/initial_pointset",point_vector);
write_points("landmarks/initial_landmarks",L);
- for (int i = 0; bl != 0; i++)
+ //for (int i = 0; bl != 0; i++)
+ for (int i = 0; i < 1; i++)
{
std::cout << "========== Start iteration " << i << " ========\n";
bl = landmark_perturbation(point_vector, L, chosen_landmarks);