summaryrefslogtreecommitdiff
path: root/src/Witness_complex
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-04-15 13:48:51 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-04-15 13:48:51 +0000
commitd3cef9245dcff1ea585142ef0b711bb35b6f9338 (patch)
tree89254add67ca6651d572b6b5c274942520ec0331 /src/Witness_complex
parent5a60fe7321538379d0910166620c1b8c3655f53a (diff)
Landmark selection: now it's faster
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@567 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 24292a17b98074b7aff4693630829b636ba3d67a
Diffstat (limited to 'src/Witness_complex')
-rw-r--r--src/Witness_complex/include/gudhi/Witness_complex.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h
index e2dcdf79..c633691b 100644
--- a/src/Witness_complex/include/gudhi/Witness_complex.h
+++ b/src/Witness_complex/include/gudhi/Witness_complex.h
@@ -510,22 +510,25 @@ private:
//std::cout << "Push't back\n";
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])
- {
- // sort the closest landmark vector for every witness
- temp_swap_int = WL[i][j];
- WL[i][j] = WL[i][j-1];
- WL[i][j-1] = temp_swap_int;
- temp_swap_double = wit_land_dist[i][j];
- wit_land_dist[i][j] = wit_land_dist[i][j-1];
- wit_land_dist[i][j-1] = temp_swap_double;
- --j;
- }
//std::cout << "result WL="; print_vvector(WL);
//std::cout << "result WLD="; print_vvector(wit_land_dist);
//std::cout << "End loop\n";
}
}
+ for (int i = 0; i < nbP; i++)
+ {
+ // sort the closest landmark vector for every witness
+ sort(WL[i].begin(), WL[i].end(), [&](int j1, int j2){return wit_land_dist[i][j1] < wit_land_dist[i][j2];});
+ /*
+ temp_swap_int = WL[i][j];
+ WL[i][j] = WL[i][j-1];
+ WL[i][j-1] = temp_swap_int;
+ temp_swap_double = wit_land_dist[i][j];
+ wit_land_dist[i][j] = wit_land_dist[i][j-1];
+ wit_land_dist[i][j-1] = temp_swap_double;
+ --j;
+ */
+ }
//std::cout << endl;
}