summaryrefslogtreecommitdiff
path: root/src/Witness_complex/include
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-12-16 08:24:02 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-12-16 08:24:02 +0000
commit0c26001efc086657ab46aeb2a1b7746f3e8bbfcf (patch)
tree77f1f398390212897defc4236127e6d4ad74e51b /src/Witness_complex/include
parentea13c32806f38e1436a13425a18b93c8cfabfa69 (diff)
Attempted to fix the bug in Strong witness complex with limited dimension
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1891 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 8dbe379ae908813ccfaeced316f5d82b6cd91360
Diffstat (limited to 'src/Witness_complex/include')
-rw-r--r--src/Witness_complex/include/gudhi/Strong_witness_complex.h47
-rw-r--r--src/Witness_complex/include/gudhi/Witness_complex.h4
2 files changed, 49 insertions, 2 deletions
diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h
index 03cdbcca..3803980b 100644
--- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h
+++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h
@@ -159,6 +159,13 @@ private:
complex.insert_simplex_and_subfaces(simplex, aw_it->second - aw.begin()->second);
aw_it++;
}
+ // continue inserting limD-faces of the following simplices
+ typeVectorVertex& vertices = simplex; //'simplex' now will be called vertices
+ while (aw_it != aw.end() && aw_it->second < lim_dist2) {
+ add_all_faces_of_dimension(limD, vertices, vertices.begin(), aw_it, typeVectorVertex({}), complex);
+ vertices.push_back(aw_it->first);
+ aw_it++;
+ }
if ((Landmark_id)simplex.size() - 1 > complex_dim)
complex_dim = simplex.size() - 1;
}
@@ -166,6 +173,46 @@ private:
return true;
}
+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.
+ */
+ template < typename SimplicialComplexForWitness >
+ void add_all_faces_of_dimension(int dim,
+ std::vector<Landmark_id>& vertices,
+ typename typeVectorVertex::iterator curr_it,
+ typename ActiveWitness::iterator aw_it,
+ std::vector<Landmark_id>& simplex,
+ SimplicialComplexForWitness& sc)
+ {
+ if (dim > 0)
+ while (curr_it != vertices.end()) {
+ simplex.push_back(curr_it->first);
+ typename ActiveWitness::iterator next_it = curr_it++;
+ add_all_faces_of_dimension(dim-1,
+ vertices,
+ next_it,
+ aw_it,
+ simplex,
+ sc);
+ simplex.pop_back();
+ add_all_faces_of_dimension(dim,
+ vertices,
+ next_it,
+ aw_it,
+ simplex,
+ sc);
+ }
+ else if (dim == 0) {
+ simplex.push_back(aw_it->first);
+ sc.insert_simplex(simplex, aw_it->second);
+ simplex.pop_back();
+ }
+ }
+
//@}
};
diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h
index 36aad7c3..56ea8613 100644
--- a/src/Witness_complex/include/gudhi/Witness_complex.h
+++ b/src/Witness_complex/include/gudhi/Witness_complex.h
@@ -56,8 +56,8 @@ private:
typedef std::vector<Point_d> Point_range;
typedef gss::Kd_tree_search<Kernel_, Point_range> Kd_tree;
typedef typename Kd_tree::INS_range Nearest_landmark_range;
- typedef typename std::vector<Nearest_landmark_range> Nearest_landmark_table;
- typedef typename Nearest_landmark_range::iterator Nearest_landmark_row_iterator;
+ //typedef typename std::vector<Nearest_landmark_range> Nearest_landmark_table;
+ //typedef typename Nearest_landmark_range::iterator Nearest_landmark_row_iterator;
typedef std::vector< double > Point_t;
typedef std::vector< Point_t > Point_Vector;