summaryrefslogtreecommitdiff
path: root/src/Nerve_GIC
diff options
context:
space:
mode:
authormcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-01-25 15:26:58 +0000
committermcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-01-25 15:26:58 +0000
commit497f2e8edff6d44689dff5ecdf945caadd439993 (patch)
tree8c62bf84a7ee2c028853417a43e8fd3547b0fe55 /src/Nerve_GIC
parentcafbe7d63d0e16e27721864a1ffa1a67d8f0374f (diff)
Small changes suggested by Marc
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3157 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 011f3638ca7b0c51cdd0d0983bb9e2f6fd256ad9
Diffstat (limited to 'src/Nerve_GIC')
-rw-r--r--src/Nerve_GIC/include/gudhi/GIC.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Nerve_GIC/include/gudhi/GIC.h b/src/Nerve_GIC/include/gudhi/GIC.h
index 27030723..642b88b0 100644
--- a/src/Nerve_GIC/include/gudhi/GIC.h
+++ b/src/Nerve_GIC/include/gudhi/GIC.h
@@ -50,6 +50,7 @@
#include <algorithm> // for std::max
#include <random>
#include <cassert>
+#include <cmath>
namespace Gudhi {
@@ -1044,9 +1045,7 @@ class Cover_complex {
}
for (auto const& simplex : simplices) {
- // Add simplices
- st.insert_simplex_and_subfaces(simplex);
- // Add cone on simplices
+ // Add a simplex and a cone on it
std::vector<int> splx = simplex;
splx.push_back(-2);
st.insert_simplex_and_subfaces(splx);
@@ -1070,7 +1069,7 @@ class Cover_complex {
else
st.assign_filtration(simplex, filts);
}
- std::vector<int> magic = {-2};
+ int magic[] = {-2};
st.assign_filtration(st.find(magic), -3);
// Compute PD
@@ -1084,7 +1083,7 @@ class Cover_complex {
for (int i = 0; i < max_dim; i++) {
std::vector<std::pair<double, double> > bars = pcoh.intervals_in_dimension(i);
int num_bars = bars.size();
- std::cout << num_bars << " interval(s) in dimension " << i << ":" << std::endl;
+ if(verbose) std::cout << num_bars << " interval(s) in dimension " << i << ":" << std::endl;
for (int j = 0; j < num_bars; j++) {
double birth = bars[j].first;
double death = bars[j].second;
@@ -1212,8 +1211,8 @@ class Cover_complex {
}
if (type == "Nerve") {
- for (std::map<int, std::vector<int> >::iterator it = cover.begin(); it != cover.end(); it++)
- simplices.push_back(it->second);
+ for(auto& simplex : cover)
+ simplices.push_back(simplex.second);
std::sort(simplices.begin(), simplices.end());
std::vector<std::vector<int> >::iterator it = std::unique(simplices.begin(), simplices.end());
simplices.resize(std::distance(simplices.begin(), it));