summaryrefslogtreecommitdiff
path: root/src/Persistence_representations
diff options
context:
space:
mode:
authormcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-06-27 01:03:45 +0000
committermcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-06-27 01:03:45 +0000
commitd221f79cfb7d84941d791835e52fa4a596269cc6 (patch)
treecde0df00ef5e7ec21c6a9e123e5d35bd7f5968f3 /src/Persistence_representations
parent0741c3eabbfece1c73ac76aa44adbe2904b6124d (diff)
parent5645e9fcbe5730462b2befb8685d3bb6857279be (diff)
merged trunk
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/kernels@3644 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 2be9ba6b6a381e677081a751e7d8f8c1d79385b0
Diffstat (limited to 'src/Persistence_representations')
-rw-r--r--src/Persistence_representations/example/CMakeLists.txt1
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_landscape.h59
-rw-r--r--src/Persistence_representations/include/gudhi/read_persistence_from_file.h6
-rw-r--r--src/Persistence_representations/test/CMakeLists.txt1
-rw-r--r--src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt1
-rw-r--r--src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt1
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt1
-rw-r--r--src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt1
-rw-r--r--src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt1
9 files changed, 36 insertions, 36 deletions
diff --git a/src/Persistence_representations/example/CMakeLists.txt b/src/Persistence_representations/example/CMakeLists.txt
index d236c3a6..a7c6ef39 100644
--- a/src/Persistence_representations/example/CMakeLists.txt
+++ b/src/Persistence_representations/example/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 2.6)
project(Persistence_representations_example)
add_executable ( Persistence_representations_example_landscape_on_grid persistence_landscape_on_grid.cpp )
diff --git a/src/Persistence_representations/include/gudhi/Persistence_landscape.h b/src/Persistence_representations/include/gudhi/Persistence_landscape.h
index 4381a55b..9cab0166 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_landscape.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_landscape.h
@@ -734,7 +734,7 @@ double Persistence_landscape::compute_integral_of_landscape(double p) const {
double Persistence_landscape::compute_value_at_a_given_point(unsigned level, double x) const {
bool compute_value_at_a_given_pointDbg = false;
// in such a case lambda_level = 0.
- if (level > this->land.size()) return 0;
+ if (level >= this->land.size()) return 0;
// we know that the points in this->land[level] are ordered according to x coordinate. Therefore, we can find the
// point by using bisection:
@@ -1235,40 +1235,43 @@ double compute_inner_product(const Persistence_landscape& l1, const Persistence_
std::cerr << "Computing inner product for a level : " << level << std::endl;
getchar();
}
- if (l1.land[level].size() * l2.land[level].size() == 0) continue;
+ auto&& l1_land_level = l1.land[level];
+ auto&& l2_land_level = l2.land[level];
+
+ if (l1_land_level.size() * l2_land_level.size() == 0) continue;
// endpoints of the interval on which we will compute the inner product of two locally linear functions:
double x1 = -std::numeric_limits<int>::max();
double x2;
- if (l1.land[level][1].first < l2.land[level][1].first) {
- x2 = l1.land[level][1].first;
+ if (l1_land_level[1].first < l2_land_level[1].first) {
+ x2 = l1_land_level[1].first;
} else {
- x2 = l2.land[level][1].first;
+ x2 = l2_land_level[1].first;
}
// iterators for the landscapes l1 and l2
size_t l1It = 0;
size_t l2It = 0;
- while ((l1It < l1.land[level].size() - 1) && (l2It < l2.land[level].size() - 1)) {
+ while ((l1It < l1_land_level.size() - 1) && (l2It < l2_land_level.size() - 1)) {
// compute the value of a inner product on a interval [x1,x2]
double a, b, c, d;
- if (l1.land[level][l1It + 1].first != l1.land[level][l1It].first) {
- a = (l1.land[level][l1It + 1].second - l1.land[level][l1It].second) /
- (l1.land[level][l1It + 1].first - l1.land[level][l1It].first);
+ if (l1_land_level[l1It + 1].first != l1_land_level[l1It].first) {
+ a = (l1_land_level[l1It + 1].second - l1_land_level[l1It].second) /
+ (l1_land_level[l1It + 1].first - l1_land_level[l1It].first);
} else {
a = 0;
}
- b = l1.land[level][l1It].second - a * l1.land[level][l1It].first;
- if (l2.land[level][l2It + 1].first != l2.land[level][l2It].first) {
- c = (l2.land[level][l2It + 1].second - l2.land[level][l2It].second) /
- (l2.land[level][l2It + 1].first - l2.land[level][l2It].first);
+ b = l1_land_level[l1It].second - a * l1_land_level[l1It].first;
+ if (l2_land_level[l2It + 1].first != l2_land_level[l2It].first) {
+ c = (l2_land_level[l2It + 1].second - l2_land_level[l2It].second) /
+ (l2_land_level[l2It + 1].first - l2_land_level[l2It].first);
} else {
c = 0;
}
- d = l2.land[level][l2It].second - c * l2.land[level][l2It].first;
+ d = l2_land_level[l2It].second - c * l2_land_level[l2It].first;
double contributionFromThisPart = (a * c * x2 * x2 * x2 / 3 + (a * d + b * c) * x2 * x2 / 2 + b * d * x2) -
(a * c * x1 * x1 * x1 / 3 + (a * d + b * c) * x1 * x1 / 2 + b * d * x1);
@@ -1276,10 +1279,10 @@ double compute_inner_product(const Persistence_landscape& l1, const Persistence_
result += contributionFromThisPart;
if (dbg) {
- std::cerr << "[l1.land[level][l1It].first,l1.land[level][l1It+1].first] : " << l1.land[level][l1It].first
- << " , " << l1.land[level][l1It + 1].first << std::endl;
- std::cerr << "[l2.land[level][l2It].first,l2.land[level][l2It+1].first] : " << l2.land[level][l2It].first
- << " , " << l2.land[level][l2It + 1].first << std::endl;
+ std::cerr << "[l1_land_level[l1It].first,l1_land_level[l1It+1].first] : " << l1_land_level[l1It].first
+ << " , " << l1_land_level[l1It + 1].first << std::endl;
+ std::cerr << "[l2_land_level[l2It].first,l2_land_level[l2It+1].first] : " << l2_land_level[l2It].first
+ << " , " << l2_land_level[l2It + 1].first << std::endl;
std::cerr << "a : " << a << ", b : " << b << " , c: " << c << ", d : " << d << std::endl;
std::cerr << "x1 : " << x1 << " , x2 : " << x2 << std::endl;
std::cerr << "contributionFromThisPart : " << contributionFromThisPart << std::endl;
@@ -1288,14 +1291,14 @@ double compute_inner_product(const Persistence_landscape& l1, const Persistence_
}
// we have two intervals in which functions are constant:
- // [l1.land[level][l1It].first , l1.land[level][l1It+1].first]
+ // [l1_land_level[l1It].first , l1_land_level[l1It+1].first]
// and
- // [l2.land[level][l2It].first , l2.land[level][l2It+1].first]
+ // [l2_land_level[l2It].first , l2_land_level[l2It+1].first]
// We also have an interval [x1,x2]. Since the intervals in the landscapes cover the whole R, then it is clear
// that x2
- // is either l1.land[level][l1It+1].first of l2.land[level][l2It+1].first or both. Lets test it.
- if (x2 == l1.land[level][l1It + 1].first) {
- if (x2 == l2.land[level][l2It + 1].first) {
+ // is either l1_land_level[l1It+1].first of l2_land_level[l2It+1].first or both. Lets test it.
+ if (x2 == l1_land_level[l1It + 1].first) {
+ if (x2 == l2_land_level[l2It + 1].first) {
// in this case, we increment both:
++l2It;
if (dbg) {
@@ -1314,12 +1317,16 @@ double compute_inner_product(const Persistence_landscape& l1, const Persistence_
std::cerr << "Incrementing second \n";
}
}
+
+ if ( l1It + 1 >= l1_land_level.size() )break;
+ if ( l2It + 1 >= l2_land_level.size() )break;
+
// Now, we shift x1 and x2:
x1 = x2;
- if (l1.land[level][l1It + 1].first < l2.land[level][l2It + 1].first) {
- x2 = l1.land[level][l1It + 1].first;
+ if (l1_land_level[l1It + 1].first < l2_land_level[l2It + 1].first) {
+ x2 = l1_land_level[l1It + 1].first;
} else {
- x2 = l2.land[level][l2It + 1].first;
+ x2 = l2_land_level[l2It + 1].first;
}
}
}
diff --git a/src/Persistence_representations/include/gudhi/read_persistence_from_file.h b/src/Persistence_representations/include/gudhi/read_persistence_from_file.h
index e0fc7107..4a2b9d68 100644
--- a/src/Persistence_representations/include/gudhi/read_persistence_from_file.h
+++ b/src/Persistence_representations/include/gudhi/read_persistence_from_file.h
@@ -57,7 +57,7 @@ std::vector<std::pair<double, double> > read_persistence_intervals_in_one_dimens
std::string line;
std::vector<std::pair<double, double> > barcode_initial =
- read_persistence_intervals_in_dimension(filename, (int)dimension);
+ read_persistence_intervals_in_dimension(filename, static_cast<int>(dimension));
std::vector<std::pair<double, double> > final_barcode;
final_barcode.reserve(barcode_initial.size());
@@ -92,8 +92,8 @@ std::vector<std::pair<double, double> > read_persistence_intervals_in_one_dimens
if ((barcode_initial[i].second == std::numeric_limits<double>::infinity()) &&
(what_to_substitute_for_infinite_bar != -1)) {
- if (barcode_initial[i].first < what_to_substitute_for_infinite_bar) // if only birth < death.
- {
+ if (barcode_initial[i].first < what_to_substitute_for_infinite_bar) {
+ // if only birth < death.
final_barcode.push_back(
std::pair<double, double>(barcode_initial[i].first, what_to_substitute_for_infinite_bar));
}
diff --git a/src/Persistence_representations/test/CMakeLists.txt b/src/Persistence_representations/test/CMakeLists.txt
index ca1713c3..fb650485 100644
--- a/src/Persistence_representations/test/CMakeLists.txt
+++ b/src/Persistence_representations/test/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 2.6)
project(Persistence_representations_test)
include(GUDHI_test_coverage)
diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt
index 386e9fa5..89ef232f 100644
--- a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 2.6)
project(Persistence_representations_heat_maps_utilities)
add_persistence_representation_creation_utility(create_pssk "10" "-1" "-1" "4" "-1")
diff --git a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt
index 875ff45e..649b72cb 100644
--- a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 2.6)
project(Persistence_representations_intervals_utilities)
diff --git a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt
index d7087ed8..6b24d032 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 2.6)
project(Persistence_representations_landscapes_utilities)
add_persistence_representation_creation_utility(create_landscapes "-1")
diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt
index c5ea4bbf..36f3196b 100644
--- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 2.6)
project(Persistence_representations_lanscapes_on_grid_utilities)
# Need to set grid min and max for further average, distance and scalar_product
diff --git a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt
index a401c955..bc982094 100644
--- a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt
+++ b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 2.6)
project(Persistence_vectors_utilities)
add_persistence_representation_creation_utility(create_persistence_vectors "-1")