summaryrefslogtreecommitdiff
path: root/src/Witness_complex/include/gudhi/Strong_witness_complex.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Witness_complex/include/gudhi/Strong_witness_complex.h')
-rw-r--r--src/Witness_complex/include/gudhi/Strong_witness_complex.h54
1 files changed, 24 insertions, 30 deletions
diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h
index ad741794..3fbbb366 100644
--- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h
+++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h
@@ -23,20 +23,19 @@
#ifndef STRONG_WITNESS_COMPLEX_H_
#define STRONG_WITNESS_COMPLEX_H_
+#include <gudhi/Active_witness/Active_witness.h>
+#include <gudhi/Kd_tree_search.h>
+
#include <utility>
#include <vector>
#include <list>
#include <limits>
-#include <gudhi/Active_witness/Active_witness.h>
-#include <gudhi/Kd_tree_search.h>
-
namespace Gudhi {
-
+
namespace witness_complex {
-/**
- * \private
+/* \private
* \class Strong_witness_complex
* \brief Constructs strong witness complex for a given table of nearest landmarks with respect to witnesses.
* \ingroup witness_complex
@@ -48,7 +47,7 @@ namespace witness_complex {
*/
template< class Nearest_landmark_table_ >
class Strong_witness_complex {
-private:
+ private:
typedef typename Nearest_landmark_table_::value_type Nearest_landmark_range;
typedef std::size_t Witness_id;
typedef std::size_t Landmark_id;
@@ -57,12 +56,11 @@ private:
typedef std::list< ActiveWitness > ActiveWitnessList;
typedef std::vector< Landmark_id > typeVectorVertex;
typedef std::vector<Nearest_landmark_range> Nearest_landmark_table_internal;
-
typedef Landmark_id Vertex_handle;
-
+
protected:
Nearest_landmark_table_internal nearest_landmark_table_;
-
+
public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* @name Constructor
@@ -70,11 +68,9 @@ private:
//@{
- Strong_witness_complex()
- {
+ Strong_witness_complex() {
}
-
/**
* \brief Initializes member variables before constructing simplicial complex.
* \details Records nearest landmark table.
@@ -84,10 +80,9 @@ private:
* of the pair range iterator needs to be 'std::pair<std::size_t, double>'.
*/
Strong_witness_complex(Nearest_landmark_table_ const & nearest_landmark_table)
- : nearest_landmark_table_(std::begin(nearest_landmark_table), std::end(nearest_landmark_table))
- {
+ : nearest_landmark_table_(std::begin(nearest_landmark_table), std::end(nearest_landmark_table)) {
}
-
+
/** \brief Outputs the strong witness complex of relaxation 'max_alpha_square'
* in a simplicial complex data structure.
* \details The function returns true if the construction is successful and false otherwise.
@@ -100,15 +95,15 @@ private:
template < typename SimplicialComplexForWitness >
bool create_complex(SimplicialComplexForWitness& complex,
double max_alpha_square,
- Landmark_id limit_dimension = std::numeric_limits<Landmark_id>::max()) const
- {
+ Landmark_id limit_dimension = std::numeric_limits<Landmark_id>::max()) const {
Landmark_id complex_dim = 0;
if (complex.num_vertices() > 0) {
std::cerr << "Strong witness complex cannot create complex - complex is not empty.\n";
return false;
}
if (max_alpha_square < 0) {
- std::cerr << "Strong witness complex cannot create complex - squared relaxation parameter must be non-negative.\n";
+ std::cerr << "Strong witness complex cannot create complex - squared relaxation parameter must be "
+ << "non-negative.\n";
return false;
}
if (limit_dimension < 0) {
@@ -129,7 +124,8 @@ private:
typeVectorVertex& vertices = simplex; //'simplex' now will be called vertices
while (aw_it != aw.end() && aw_it->second < lim_dist2) {
typeVectorVertex facet = {};
- add_all_faces_of_dimension(limit_dimension, vertices, vertices.begin(), aw_it, aw_it->second - aw.begin()->second, facet, complex);
+ add_all_faces_of_dimension(limit_dimension, vertices, vertices.begin(), aw_it,
+ aw_it->second - aw.begin()->second, facet, complex);
vertices.push_back(aw_it->first);
aw_it++;
}
@@ -140,13 +136,12 @@ private:
return true;
}
-private:
-
+ private:
/* \brief Adds recursively all the faces of a certain dimension dim-1 witnessed by the same witness.
- * Iterator is needed to know until how far we can take landmarks to form simplexes.
- * simplex is the prefix of the simplexes to insert.
- * The landmark pointed by aw_it is added to all formed simplices.
- */
+ * Iterator is needed to know until how far we can take landmarks to form simplexes.
+ * simplex is the prefix of the simplexes to insert.
+ * The landmark pointed by aw_it is added to all formed simplices.
+ */
template < typename SimplicialComplexForWitness >
void add_all_faces_of_dimension(Landmark_id dim,
typeVectorVertex& vertices,
@@ -154,9 +149,8 @@ private:
typename ActiveWitness::iterator aw_it,
double filtration_value,
typeVectorVertex& simplex,
- SimplicialComplexForWitness& sc) const
- {
- if (dim > 0)
+ SimplicialComplexForWitness& sc) const {
+ if (dim > 0) {
while (curr_it != vertices.end()) {
simplex.push_back(*curr_it);
++curr_it;
@@ -176,7 +170,7 @@ private:
simplex,
sc);
}
- else if (dim == 0) {
+ } else if (dim == 0) {
simplex.push_back(aw_it->first);
sc.insert_simplex_and_subfaces(simplex, filtration_value);
simplex.pop_back();