summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-02-02 14:49:56 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-02-02 14:49:56 +0000
commit7e667b71d937f83b82240afbf90b8cde7225eb8a (patch)
tree6e816ab5a2a9290a365fb9f52e2418d4c94d142c /src
parentdb2c9248e50cd4eb91ec39802a2b2bce9565030d (diff)
landmark choice functions are now static
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@994 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: f83d337feab944e2c823b8e127f1a8d612d0a1bd
Diffstat (limited to 'src')
-rw-r--r--src/Witness_complex/example/witness_complex_from_file.cpp2
-rw-r--r--src/Witness_complex/example/witness_complex_sphere.cpp2
-rw-r--r--src/Witness_complex/include/gudhi/Landmark_choice_by_furthest_point.h22
-rw-r--r--src/Witness_complex/include/gudhi/Landmark_choice_by_random_point.h23
-rw-r--r--src/Witness_complex/test/witness_complex_points.cpp6
5 files changed, 15 insertions, 40 deletions
diff --git a/src/Witness_complex/example/witness_complex_from_file.cpp b/src/Witness_complex/example/witness_complex_from_file.cpp
index d94502b1..77109512 100644
--- a/src/Witness_complex/example/witness_complex_from_file.cpp
+++ b/src/Witness_complex/example/witness_complex_from_file.cpp
@@ -102,7 +102,7 @@ int main(int argc, char * const argv[]) {
// Choose landmarks
start = clock();
std::vector<std::vector< int > > knn;
- Landmark_choice_by_random_point(point_vector, nbL, knn);
+ Gudhi::witness_complex::landmark_choice_by_random_point(point_vector, nbL, 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 36f63437..1ff35bff 100644
--- a/src/Witness_complex/example/witness_complex_sphere.cpp
+++ b/src/Witness_complex/example/witness_complex_sphere.cpp
@@ -82,7 +82,7 @@ int main(int argc, char * const argv[]) {
// Choose landmarks
start = clock();
std::vector<std::vector< int > > knn;
- Landmark_choice_by_random_point(point_vector, nbL, knn);
+ Gudhi::witness_complex::landmark_choice_by_random_point(point_vector, nbL, knn);
// Compute witness complex
WitnessComplex(knn, simplex_tree, nbL, point_vector[0].size());
diff --git a/src/Witness_complex/include/gudhi/Landmark_choice_by_furthest_point.h b/src/Witness_complex/include/gudhi/Landmark_choice_by_furthest_point.h
index bb7e87f5..47cd888d 100644
--- a/src/Witness_complex/include/gudhi/Landmark_choice_by_furthest_point.h
+++ b/src/Witness_complex/include/gudhi/Landmark_choice_by_furthest_point.h
@@ -31,20 +31,9 @@ namespace Gudhi {
namespace witness_complex {
-/**
- * \class Landmark_choice_by_furthest_point
- * \brief The class `Landmark_choice_by_furthest_point` allows to construct the matrix
- * of closest landmarks per witness by iteratively choosing the furthest witness
- * from the set of already chosen landmarks as the new landmark.
- * \ingroup witness_complex
- */
-
-class Landmark_choice_by_furthest_point {
- private:
- typedef std::vector<int> typeVectorVertex;
+ typedef std::vector<int> typeVectorVertex;
- public:
- /**
+ /**
* \brief Landmark choice strategy by iteratively adding the furthest witness from the
* current landmark set as the new landmark.
* \details It chooses nbL landmarks from a random access range `points` and
@@ -53,9 +42,9 @@ class Landmark_choice_by_furthest_point {
template <typename KNearestNeighbours,
typename Point_random_access_range>
- Landmark_choice_by_furthest_point(Point_random_access_range const &points,
- int nbL,
- KNearestNeighbours &knn) {
+ void landmark_choice_by_furthest_point(Point_random_access_range const &points,
+ int nbL,
+ KNearestNeighbours &knn) {
int nb_points = points.end() - points.begin();
assert(nb_points >= nbL);
// distance matrix witness x landmarks
@@ -98,7 +87,6 @@ class Landmark_choice_by_furthest_point {
[&wit_land_dist, i](int a, int b) {
return wit_land_dist[i][a] < wit_land_dist[i][b]; });
}
-};
} // namespace witness_complex
diff --git a/src/Witness_complex/include/gudhi/Landmark_choice_by_random_point.h b/src/Witness_complex/include/gudhi/Landmark_choice_by_random_point.h
index 4747dd73..dc364007 100644
--- a/src/Witness_complex/include/gudhi/Landmark_choice_by_random_point.h
+++ b/src/Witness_complex/include/gudhi/Landmark_choice_by_random_point.h
@@ -32,26 +32,16 @@ namespace Gudhi {
namespace witness_complex {
-/**
- * \class Landmark_choice_by_random_point
- * \brief The class `Landmark_choice_by_random_point` allows to construct the matrix
- * of closest landmarks per witness by iteratively choosing a random non-chosen witness
- * as a new landmark.
- * \ingroup witness_complex
- */
-
-class Landmark_choice_by_random_point {
- public:
/** \brief Landmark choice strategy by taking random vertices for landmarks.
* \details It chooses nbL distinct landmarks from a random access range `points`
* and outputs a matrix {witness}*{closest landmarks} in knn.
*/
template <typename KNearestNeighbours,
- typename Point_random_access_range>
- Landmark_choice_by_random_point(Point_random_access_range const &points,
- int nbL,
- KNearestNeighbours &knn) {
+ typename Point_random_access_range>
+ void landmark_choice_by_random_point(Point_random_access_range const &points,
+ int nbL,
+ KNearestNeighbours &knn) {
int nbP = points.end() - points.begin();
assert(nbP >= nbL);
std::set<int> landmarks;
@@ -71,8 +61,8 @@ class Landmark_choice_by_random_point {
knn = KNearestNeighbours(nbP);
for (int points_i = 0; points_i < nbP; points_i++) {
std::priority_queue<dist_i, std::vector<dist_i>, comp> l_heap([&](dist_i j1, dist_i j2) {
- return j1.first > j2.first;
- });
+ return j1.first > j2.first;
+ });
std::set<int>::iterator landmarks_it;
int landmarks_i = 0;
for (landmarks_it = landmarks.begin(), landmarks_i = 0; landmarks_it != landmarks.end();
@@ -87,7 +77,6 @@ class Landmark_choice_by_random_point {
}
}
}
-};
} // namespace witness_complex
diff --git a/src/Witness_complex/test/witness_complex_points.cpp b/src/Witness_complex/test/witness_complex_points.cpp
index 300b2ac5..cb1639e1 100644
--- a/src/Witness_complex/test/witness_complex_points.cpp
+++ b/src/Witness_complex/test/witness_complex_points.cpp
@@ -37,8 +37,6 @@ typedef std::vector<double> Point;
typedef std::vector< Vertex_handle > typeVectorVertex;
typedef Gudhi::Simplex_tree<> Simplex_tree;
typedef Gudhi::witness_complex::Witness_complex<Simplex_tree> WitnessComplex;
-typedef Gudhi::witness_complex::Landmark_choice_by_random_point Landmark_choice_by_random_point;
-typedef Gudhi::witness_complex::Landmark_choice_by_furthest_point Landmark_choice_by_furthest_point;
BOOST_AUTO_TEST_CASE(witness_complex_points) {
std::vector< typeVectorVertex > knn;
@@ -52,7 +50,7 @@ BOOST_AUTO_TEST_CASE(witness_complex_points) {
bool b_print_output = false;
// First test: random choice
Simplex_tree complex1;
- Landmark_choice_by_random_point lcrp(points, 100, knn);
+ Gudhi::witness_complex::landmark_choice_by_random_point(points, 100, knn);
assert(!knn.empty());
WitnessComplex witnessComplex1(knn, complex1, 100, 3);
BOOST_CHECK(witnessComplex1.is_witness_complex(knn, b_print_output));
@@ -60,7 +58,7 @@ BOOST_AUTO_TEST_CASE(witness_complex_points) {
// Second test: furthest choice
knn.clear();
Simplex_tree complex2;
- Landmark_choice_by_furthest_point lcfp(points, 100, knn);
+ Gudhi::witness_complex::landmark_choice_by_furthest_point(points, 100, knn);
WitnessComplex witnessComplex2(knn, complex2, 100, 3);
BOOST_CHECK(witnessComplex2.is_witness_complex(knn, b_print_output));
}