summaryrefslogtreecommitdiff
path: root/src/Witness_complex
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-03-25 15:36:42 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-03-25 15:36:42 +0000
commit932b79f06816cf9425f9ff37e09ee5daf2c65597 (patch)
tree33dab227b2323c343db1133d88533bca9e4389fa /src/Witness_complex
parent9280807119434e1ca4dd90267233ba01dfb0eeb6 (diff)
witness_complex worked on a small example
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@506 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 77a0284610e0376a827adfe516aeedfcd634348d
Diffstat (limited to 'src/Witness_complex')
-rw-r--r--src/Witness_complex/include/gudhi/Witness_complex1.h47
1 files changed, 37 insertions, 10 deletions
diff --git a/src/Witness_complex/include/gudhi/Witness_complex1.h b/src/Witness_complex/include/gudhi/Witness_complex1.h
index 49ba7529..5333e5a8 100644
--- a/src/Witness_complex/include/gudhi/Witness_complex1.h
+++ b/src/Witness_complex/include/gudhi/Witness_complex1.h
@@ -313,6 +313,8 @@ private:
* The only purpose is to test if the witness is still active or not.
* Assuming here that the list of the first k witnessed landmarks is sorted
*/
+
+ /*
template< typename KNearestNeighbours >
bool all_faces_in(KNearestNeighbours &knn, int witness_id, int k, VertexHandle inserted_vertex)
{
@@ -334,19 +336,17 @@ private:
if (j != i)
{
std::cout << "+++ We are at vertex=" << knn[witness_id][j] << std::endl;
- if (curr_sibl->members().find(knn[witness_id][j]) == null_simplex())
+ if (curr_sibl->find(knn[witness_id][j]) == null_simplex())
return false;
std::cout << "++++ the simplex is there\n";
- curr_sh = curr_sibl->members().find(knn[witness_id][j]);
+ curr_sh = curr_sibl->find(knn[witness_id][j]);
std::cout << "++++ curr_sh affectation is OK\n";
- if (has_children(curr_sh))
- curr_sibl = curr_sh->second.children();
- else
- if (j < k || (j < k-1 && i == k))
- {
- std::cout << "++++ the values: j=" << j << ", k=" << k << std::endl;
- return false;
- }
+ if (!has_children(curr_sh) && (j < k || (j < k-1 && i == k)))
+ {
+ std::cout << "++++ the values: j=" << j << ", k=" << k << std::endl;
+ return false;
+ }
+ curr_sibl = curr_sh->second.children();
std::cout << "++++ finished loop safely\n";
}//endif j!=i
}//endfor
@@ -354,6 +354,33 @@ private:
} //endfor
return true;
}
+ */
+ template <typename KNearestNeighbours>
+ bool all_faces_in(KNearestNeighbours &knn, int witness_id, int k, VertexHandle inserted_vertex)
+ {
+ std::cout << "All face in with the landmark " << inserted_vertex << std::endl;
+ std::vector< VertexHandle > facet;
+ //VertexHandle curr_vh = curr_sh->first;
+ // CHECK ALL THE FACETS
+ for (int i = 0; i != k+1; ++i)
+ {
+ if (knn[witness_id][i] != inserted_vertex)
+ {
+ facet = {};
+ for (int j = 0; j != k+1; ++j)
+ {
+ if (j != i)
+ {
+ facet.push_back(knn[witness_id][j]);
+ }
+ }//endfor
+ if (find(facet) == null_simplex())
+ return false;
+ std::cout << "++++ finished loop safely\n";
+ }//endif
+ } //endfor
+ return true;
+ }
/**
* \brief Permutes the vector in such a way that the landmarks appear first