summaryrefslogtreecommitdiff
path: root/src/Nerve_GIC
diff options
context:
space:
mode:
Diffstat (limited to 'src/Nerve_GIC')
-rw-r--r--src/Nerve_GIC/include/gudhi/GIC.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Nerve_GIC/include/gudhi/GIC.h b/src/Nerve_GIC/include/gudhi/GIC.h
index aa6478e5..8834858c 100644
--- a/src/Nerve_GIC/include/gudhi/GIC.h
+++ b/src/Nerve_GIC/include/gudhi/GIC.h
@@ -25,6 +25,7 @@
#ifdef GUDHI_USE_TBB
#include <tbb/parallel_for.h>
+#include <tbb/task_scheduler_init.h>
#include <tbb/mutex.h>
#endif
@@ -62,6 +63,7 @@ namespace Gudhi {
namespace cover_complex {
using Simplex_tree = Gudhi::Simplex_tree<>;
+using Simplex_handle = Simplex_tree::Simplex_handle;
using Filtration_value = Simplex_tree::Filtration_value;
using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
using Persistence_diagram = std::vector<std::pair<double, double> >;
@@ -267,7 +269,7 @@ class Cover_complex {
point.assign(std::istream_iterator<double>(iss), std::istream_iterator<double>());
point_cloud.emplace_back(point.begin(), point.begin() + data_dimension);
boost::add_vertex(one_skeleton_OFF);
- vertices.push_back(boost::add_vertex(one_skeleton));
+ vertices.push_back(boost::add_vertex(one_skeleton)); cover.emplace_back();
cover.emplace_back();
i++;
}
@@ -414,9 +416,7 @@ class Cover_complex {
template <typename Distance>
double set_graph_from_automatic_rips(Distance distance, int N = 100) {
int m = floor(n / std::exp((1 + rate_power) * std::log(std::log(n) / std::log(rate_constant))));
- m = std::min(m, n - 1);
- std::vector<int> samples(m);
- double delta = 0;
+ m = std::min(m, n - 1); std::vector<int> samples(m); double delta = 0;
if (verbose) std::cout << n << " points in R^" << data_dimension << std::endl;
if (verbose) std::cout << "Subsampling " << m << " points" << std::endl;
@@ -485,6 +485,8 @@ class Cover_complex {
*/
void set_function_from_coordinate(int k) {
for (int i = 0; i < n; i++) func.push_back(point_cloud[i][k]);
+ char coordinate[100];
+ sprintf(coordinate, "coordinate %d", k);
functional_cover = true;
cover_name = "coordinate " + std::to_string(k);
}
@@ -839,6 +841,7 @@ class Cover_complex {
std::vector<double> mindist(n);
for (int j = 0; j < n; j++) mindist[j] = std::numeric_limits<double>::max();
+
// Compute the geodesic distances to subsamples with Dijkstra
#ifdef GUDHI_USE_TBB
if (verbose) std::cout << "Computing geodesic distances (parallelized)..." << std::endl;
@@ -1107,8 +1110,9 @@ class Cover_complex {
for (std::map<int, double>::iterator it = cover_std.begin(); it != cover_std.end(); it++) {
int vertex = it->first; float val = it->second;
int vert[] = {vertex}; int edge[] = {vertex, -2};
- st.assign_filtration(st.find(vert), -2 + (val - minf)/(maxf - minf));
- st.assign_filtration(st.find(edge), 2 - (val - minf)/(maxf - minf));
+ Simplex_handle shv = st.find(vert); Simplex_handle she = st.find(edge);
+ if(shv != st.null_simplex()) st.assign_filtration(shv, -2 + (val - minf)/(maxf - minf));
+ if(she != st.null_simplex()) st.assign_filtration(she, 2 - (val - minf)/(maxf - minf));
}
st.make_filtration_non_decreasing();
@@ -1163,7 +1167,7 @@ class Cover_complex {
Cboot.point_cloud.push_back(this->point_cloud[id]); Cboot.cover.emplace_back(); Cboot.func.push_back(this->func[id]);
boost::add_vertex(Cboot.one_skeleton_OFF); Cboot.vertices.push_back(boost::add_vertex(Cboot.one_skeleton));
}
- Cboot.set_color_from_vector(Cboot.func);
+ Cboot.set_color_from_vector(Cboot.func);
for (int j = 0; j < n; j++) {
std::vector<double> dist(n);