summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Witness_complex/concept/Simplicial_complex.h83
-rw-r--r--src/Witness_complex/include/gudhi/Landmark_choice_by_furthest_point.h5
-rw-r--r--src/Witness_complex/include/gudhi/Landmark_choice_by_random_point.h5
-rw-r--r--src/Witness_complex/include/gudhi/Witness_complex.h4
-rw-r--r--src/Witness_complex/include/gudhi/Witness_complex_doc.h4
5 files changed, 93 insertions, 8 deletions
diff --git a/src/Witness_complex/concept/Simplicial_complex.h b/src/Witness_complex/concept/Simplicial_complex.h
new file mode 100644
index 00000000..6b0df212
--- /dev/null
+++ b/src/Witness_complex/concept/Simplicial_complex.h
@@ -0,0 +1,83 @@
+ /* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Siargey Kachanovich
+ *
+ * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \brief The concept Simplicial_Complex describes the requirements
+ * for a type to implement a simplicial complex,
+ * used for example to build a 'Witness_complex'.
+ */
+struct Simplicial_complex
+{
+/** Handle to specify a simplex. */
+ typedef unspecified Simplex_handle;
+/** Handle to specify a vertex. Must be a non-negative integer. */
+ typedef unspecified Vertex_handle;
+
+/** Returns a Simplex_hanlde that is different from all simplex handles
+ * of the simplices. */
+ Simplex_handle null_simplex();
+/** \brief Returns the number of simplices in the complex.
+ *
+ * Does not count the empty simplex. */
+ size_t num_simplices();
+
+/** \brief Iterator over the simplices of the complex,
+ * in an arbitrary order.
+ *
+ * 'value_type' must be 'Simplex_handle'.*/
+typedef unspecified Complex_simplex_iterator;
+typedef unspecified Complex_simplex_range;
+
+/**
+* \brief Returns a range over all the simplices of a
+* complex.
+*/
+Complex_simplex_range complex_simplex_range();
+
+/** \brief Iterator over vertices of a simplex.
+ *
+ * 'value type' must be 'Vertex_handle'.*/
+ typedef unspecified Simplex_vertex_range;
+
+/** \brief Returns a range over vertices of a given
+ * simplex. */
+ Simplex_vertex_range simplex_vertex_range(Simplex_handle const & simplex);
+
+/** \brief Return type of an insertion of a simplex
+ */
+ typedef unspecified Insertion_result_type;
+
+/** \brief Input range of vertices.
+ * 'value_type' must be 'Vertex_handle'. */
+ typedef unspecified Input_vertex_range;
+
+/** \brief Inserts a simplex with vertices from a given range
+ * 'vertex_range' in the simplicial complex.
+ * */
+ Insertion_result_type insert_simplex(Input_vertex_range const & vertex_range);
+
+/** \brief Finds a simplex with vertices given by a range
+ *
+ * If a simplex exists, its Simplex_handle is returned.
+ * Otherwise null_simplex() is returned. */
+ Simplex_handle find(Input_vertex_range const & vertex_range);
+
+};
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 163975c9..8dfec99c 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
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef GUDHI_LANDMARK_CHOICE_BY_FURTHEST_POINT_H_
-#define GUDHI_LANDMARK_CHOICE_BY_FURTHEST_POINT_H_
+#ifndef LANDMARK_CHOICE_BY_FURTHEST_POINT_H_
+#define LANDMARK_CHOICE_BY_FURTHEST_POINT_H_
namespace Gudhi {
@@ -56,6 +56,7 @@ public:
KNearestNeighbours &knn)
{
int nb_points = points.end() - points.begin();
+ assert(nb_points >= nbL);
std::vector<std::vector<double>> wit_land_dist(nb_points, std::vector<double>()); // distance matrix witness x landmarks
typeVectorVertex chosen_landmarks; // landmark list
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 a54f3848..3f8a8d32 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
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef GUDHI_LANDMARK_CHOICE_BY_RANDOM_POINT_H_
-#define GUDHI_LANDMARK_CHOICE_BY_RANDOM_POINT_H_
+#ifndef LANDMARK_CHOICE_BY_RANDOM_POINT_H_
+#define LANDMARK_CHOICE_BY_RANDOM_POINT_H_
namespace Gudhi {
@@ -51,6 +51,7 @@ public:
KNearestNeighbours &knn)
{
int nbP = points.end() - points.begin();
+ assert(nbP >= nbL);
std::set<int> landmarks;
int current_number_of_landmarks=0; // counter for landmarks
diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h
index 90b2e094..819a0583 100644
--- a/src/Witness_complex/include/gudhi/Witness_complex.h
+++ b/src/Witness_complex/include/gudhi/Witness_complex.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef GUDHI_WITNESS_COMPLEX_H_
-#define GUDHI_WITNESS_COMPLEX_H_
+#ifndef WITNESS_COMPLEX_H_
+#define WITNESS_COMPLEX_H_
#include <boost/container/flat_map.hpp>
#include <boost/iterator/transform_iterator.hpp>
diff --git a/src/Witness_complex/include/gudhi/Witness_complex_doc.h b/src/Witness_complex/include/gudhi/Witness_complex_doc.h
index 71c8776b..dbe9e7ce 100644
--- a/src/Witness_complex/include/gudhi/Witness_complex_doc.h
+++ b/src/Witness_complex/include/gudhi/Witness_complex_doc.h
@@ -1,5 +1,5 @@
-#ifndef WITNESS_COMPLEX_DOC_
-#define WITNESS_COMPLEX_DOC_
+#ifndef WITNESS_COMPLEX_DOC_H_
+#define WITNESS_COMPLEX_DOC_H_
/**
\defgroup witness_complex Witness complex