summaryrefslogtreecommitdiff
path: root/src/Persistence_representations/example
diff options
context:
space:
mode:
authorGard Spreemann <gspr@nonempty.org>2020-05-20 08:42:23 +0200
committerGard Spreemann <gspr@nonempty.org>2020-05-20 08:42:23 +0200
commit9b3079646ee3f6a494b83e864b3e10b8a93597d0 (patch)
tree63ecae8cf0d09b72907805e68f19765c7dd9694a /src/Persistence_representations/example
parent81816dae256a9f3c0653b1d21443c3c32da7a974 (diff)
parent97e889f34e929f3c2306803b6c37b57926bd1245 (diff)
Merge tag 'tags/gudhi-release-3.2.0' into dfsg/latest
Diffstat (limited to 'src/Persistence_representations/example')
-rw-r--r--src/Persistence_representations/example/persistence_heat_maps.cpp8
-rw-r--r--src/Persistence_representations/example/persistence_intervals.cpp40
-rw-r--r--src/Persistence_representations/example/persistence_landscape.cpp24
-rw-r--r--src/Persistence_representations/example/persistence_landscape_on_grid.cpp22
-rw-r--r--src/Persistence_representations/example/persistence_vectors.cpp10
-rw-r--r--src/Persistence_representations/example/sliced_wasserstein.cpp8
6 files changed, 56 insertions, 56 deletions
diff --git a/src/Persistence_representations/example/persistence_heat_maps.cpp b/src/Persistence_representations/example/persistence_heat_maps.cpp
index 1bf3a637..9fd6779a 100644
--- a/src/Persistence_representations/example/persistence_heat_maps.cpp
+++ b/src/Persistence_representations/example/persistence_heat_maps.cpp
@@ -65,7 +65,7 @@ int main(int argc, char** argv) {
median.compute_median(vector_of_maps);
// to compute L^1 distance between hm1 and hm2:
- std::cout << "The L^1 distance is : " << hm1.distance(hm2, 1) << std::endl;
+ std::clog << "The L^1 distance is : " << hm1.distance(hm2, 1) << std::endl;
// to average of hm1 and hm2:
std::vector<Persistence_heat_maps*> to_average;
@@ -75,15 +75,15 @@ int main(int argc, char** argv) {
av.compute_average(to_average);
// to compute scalar product of hm1 and hm2:
- std::cout << "Scalar product is : " << hm1.compute_scalar_product(hm2) << std::endl;
+ std::clog << "Scalar product is : " << hm1.compute_scalar_product(hm2) << std::endl;
Persistence_heat_maps hm1k(persistence1, Gaussian_function(1.0));
Persistence_heat_maps hm2k(persistence2, Gaussian_function(1.0));
Persistence_heat_maps hm1i(persistence1, Gaussian_function(1.0), 20, 20, 0, 11, 0, 11);
Persistence_heat_maps hm2i(persistence2, Gaussian_function(1.0), 20, 20, 0, 11, 0, 11);
- std::cout << "Scalar product computed with exact 2D kernel on grid is : " << hm1i.compute_scalar_product(hm2i)
+ std::clog << "Scalar product computed with exact 2D kernel on grid is : " << hm1i.compute_scalar_product(hm2i)
<< std::endl;
- std::cout << "Scalar product computed with exact 2D kernel is : " << hm1k.compute_scalar_product(hm2k) << std::endl;
+ std::clog << "Scalar product computed with exact 2D kernel is : " << hm1k.compute_scalar_product(hm2k) << std::endl;
return 0;
}
diff --git a/src/Persistence_representations/example/persistence_intervals.cpp b/src/Persistence_representations/example/persistence_intervals.cpp
index c908581c..748b9ae4 100644
--- a/src/Persistence_representations/example/persistence_intervals.cpp
+++ b/src/Persistence_representations/example/persistence_intervals.cpp
@@ -18,59 +18,59 @@ using Persistence_intervals = Gudhi::Persistence_representations::Persistence_in
int main(int argc, char** argv) {
if (argc != 2) {
- std::cout << "To run this program, please provide the name of a file with persistence diagram \n";
+ std::clog << "To run this program, please provide the name of a file with persistence diagram \n";
return 1;
}
Persistence_intervals p(argv[1]);
std::pair<double, double> min_max_ = p.get_x_range();
- std::cout << "Birth-death range : " << min_max_.first << " " << min_max_.second << std::endl;
+ std::clog << "Birth-death range : " << min_max_.first << " " << min_max_.second << std::endl;
std::vector<double> dominant_ten_intervals_length = p.length_of_dominant_intervals(10);
- std::cout << "Length of ten dominant intervals : " << std::endl;
+ std::clog << "Length of ten dominant intervals : " << std::endl;
for (size_t i = 0; i != dominant_ten_intervals_length.size(); ++i) {
- std::cout << dominant_ten_intervals_length[i] << std::endl;
+ std::clog << dominant_ten_intervals_length[i] << std::endl;
}
std::vector<std::pair<double, double> > ten_dominant_intervals = p.dominant_intervals(10);
- std::cout << "Here are the dominant intervals : " << std::endl;
+ std::clog << "Here are the dominant intervals : " << std::endl;
for (size_t i = 0; i != ten_dominant_intervals.size(); ++i) {
- std::cout << "( " << ten_dominant_intervals[i].first << "," << ten_dominant_intervals[i].second << std::endl;
+ std::clog << "( " << ten_dominant_intervals[i].first << "," << ten_dominant_intervals[i].second << std::endl;
}
std::vector<size_t> histogram = p.histogram_of_lengths(10);
- std::cout << "Here is the histogram of barcode's length : " << std::endl;
+ std::clog << "Here is the histogram of barcode's length : " << std::endl;
for (size_t i = 0; i != histogram.size(); ++i) {
- std::cout << histogram[i] << " ";
+ std::clog << histogram[i] << " ";
}
- std::cout << std::endl;
+ std::clog << std::endl;
std::vector<size_t> cumulative_histogram = p.cumulative_histogram_of_lengths(10);
- std::cout << "Cumulative histogram : " << std::endl;
+ std::clog << "Cumulative histogram : " << std::endl;
for (size_t i = 0; i != cumulative_histogram.size(); ++i) {
- std::cout << cumulative_histogram[i] << " ";
+ std::clog << cumulative_histogram[i] << " ";
}
- std::cout << std::endl;
+ std::clog << std::endl;
std::vector<double> char_funct_diag = p.characteristic_function_of_diagram(min_max_.first, min_max_.second);
- std::cout << "Characteristic function of diagram : " << std::endl;
+ std::clog << "Characteristic function of diagram : " << std::endl;
for (size_t i = 0; i != char_funct_diag.size(); ++i) {
- std::cout << char_funct_diag[i] << " ";
+ std::clog << char_funct_diag[i] << " ";
}
- std::cout << std::endl;
+ std::clog << std::endl;
std::vector<double> cumul_char_funct_diag =
p.cumulative_characteristic_function_of_diagram(min_max_.first, min_max_.second);
- std::cout << "Cumulative characteristic function of diagram : " << std::endl;
+ std::clog << "Cumulative characteristic function of diagram : " << std::endl;
for (size_t i = 0; i != cumul_char_funct_diag.size(); ++i) {
- std::cout << cumul_char_funct_diag[i] << " ";
+ std::clog << cumul_char_funct_diag[i] << " ";
}
- std::cout << std::endl;
+ std::clog << std::endl;
- std::cout << "Persistence Betti numbers \n";
+ std::clog << "Persistence Betti numbers \n";
std::vector<std::pair<double, size_t> > pbns = p.compute_persistent_betti_numbers();
for (size_t i = 0; i != pbns.size(); ++i) {
- std::cout << pbns[i].first << " " << pbns[i].second << std::endl;
+ std::clog << pbns[i].first << " " << pbns[i].second << std::endl;
}
return 0;
diff --git a/src/Persistence_representations/example/persistence_landscape.cpp b/src/Persistence_representations/example/persistence_landscape.cpp
index ff18d105..d39ae0b8 100644
--- a/src/Persistence_representations/example/persistence_landscape.cpp
+++ b/src/Persistence_representations/example/persistence_landscape.cpp
@@ -37,35 +37,35 @@ int main(int argc, char** argv) {
Persistence_landscape l2(persistence2);
// This is how to compute integral of landscapes:
- std::cout << "Integral of the first landscape : " << l1.compute_integral_of_landscape() << std::endl;
- std::cout << "Integral of the second landscape : " << l2.compute_integral_of_landscape() << std::endl;
+ std::clog << "Integral of the first landscape : " << l1.compute_integral_of_landscape() << std::endl;
+ std::clog << "Integral of the second landscape : " << l2.compute_integral_of_landscape() << std::endl;
// And here how to write landscapes to stream:
- std::cout << "l1 : " << l1 << std::endl;
- std::cout << "l2 : " << l2 << std::endl;
+ std::clog << "l1 : " << l1 << std::endl;
+ std::clog << "l2 : " << l2 << std::endl;
// Arithmetic operations on landscapes:
Persistence_landscape sum = l1 + l2;
- std::cout << "sum : " << sum << std::endl;
+ std::clog << "sum : " << sum << std::endl;
// here are the maxima of the functions:
- std::cout << "Maximum of l1 : " << l1.compute_maximum() << std::endl;
- std::cout << "Maximum of l2 : " << l2.compute_maximum() << std::endl;
+ std::clog << "Maximum of l1 : " << l1.compute_maximum() << std::endl;
+ std::clog << "Maximum of l2 : " << l2.compute_maximum() << std::endl;
// here are the norms of landscapes:
- std::cout << "L^1 Norm of l1 : " << l1.compute_norm_of_landscape(1.) << std::endl;
- std::cout << "L^1 Norm of l2 : " << l2.compute_norm_of_landscape(1.) << std::endl;
+ std::clog << "L^1 Norm of l1 : " << l1.compute_norm_of_landscape(1.) << std::endl;
+ std::clog << "L^1 Norm of l2 : " << l2.compute_norm_of_landscape(1.) << std::endl;
// here is the average of landscapes:
Persistence_landscape average;
average.compute_average({&l1, &l2});
- std::cout << "average : " << average << std::endl;
+ std::clog << "average : " << average << std::endl;
// here is the distance of landscapes:
- std::cout << "Distance : " << l1.distance(l2) << std::endl;
+ std::clog << "Distance : " << l1.distance(l2) << std::endl;
// here is the scalar product of landscapes:
- std::cout << "Scalar product : " << l1.compute_scalar_product(l2) << std::endl;
+ std::clog << "Scalar product : " << l1.compute_scalar_product(l2) << std::endl;
// here is how to create a file which is suitable for visualization via gnuplot:
average.plot("average_landscape");
diff --git a/src/Persistence_representations/example/persistence_landscape_on_grid.cpp b/src/Persistence_representations/example/persistence_landscape_on_grid.cpp
index 16a58e1d..6d58e167 100644
--- a/src/Persistence_representations/example/persistence_landscape_on_grid.cpp
+++ b/src/Persistence_representations/example/persistence_landscape_on_grid.cpp
@@ -37,31 +37,31 @@ int main(int argc, char** argv) {
Persistence_landscape_on_grid l2(persistence2, 0, 11, 20);
// This is how to compute integral of landscapes:
- std::cout << "Integral of the first landscape : " << l1.compute_integral_of_landscape() << std::endl;
- std::cout << "Integral of the second landscape : " << l2.compute_integral_of_landscape() << std::endl;
+ std::clog << "Integral of the first landscape : " << l1.compute_integral_of_landscape() << std::endl;
+ std::clog << "Integral of the second landscape : " << l2.compute_integral_of_landscape() << std::endl;
// And here how to write landscapes to stream:
- std::cout << "l1 : " << l1 << std::endl;
- std::cout << "l2 : " << l2 << std::endl;
+ std::clog << "l1 : " << l1 << std::endl;
+ std::clog << "l2 : " << l2 << std::endl;
// here are the maxima of the functions:
- std::cout << "Maximum of l1 : " << l1.compute_maximum() << std::endl;
- std::cout << "Maximum of l2 : " << l2.compute_maximum() << std::endl;
+ std::clog << "Maximum of l1 : " << l1.compute_maximum() << std::endl;
+ std::clog << "Maximum of l2 : " << l2.compute_maximum() << std::endl;
// here are the norms of landscapes:
- std::cout << "L^1 Norm of l1 : " << l1.compute_norm_of_landscape(1.) << std::endl;
- std::cout << "L^1 Norm of l2 : " << l2.compute_norm_of_landscape(1.) << std::endl;
+ std::clog << "L^1 Norm of l1 : " << l1.compute_norm_of_landscape(1.) << std::endl;
+ std::clog << "L^1 Norm of l2 : " << l2.compute_norm_of_landscape(1.) << std::endl;
// here is the average of landscapes:
Persistence_landscape_on_grid average;
average.compute_average({&l1, &l2});
- std::cout << "average : " << average << std::endl;
+ std::clog << "average : " << average << std::endl;
// here is the distance of landscapes:
- std::cout << "Distance : " << l1.distance(l2) << std::endl;
+ std::clog << "Distance : " << l1.distance(l2) << std::endl;
// here is the scalar product of landscapes:
- std::cout << "Scalar product : " << l1.compute_scalar_product(l2) << std::endl;
+ std::clog << "Scalar product : " << l1.compute_scalar_product(l2) << std::endl;
// here is how to create a file which is suitable for visualization via gnuplot:
average.plot("average_landscape");
diff --git a/src/Persistence_representations/example/persistence_vectors.cpp b/src/Persistence_representations/example/persistence_vectors.cpp
index b27e52d2..89e2fb83 100644
--- a/src/Persistence_representations/example/persistence_vectors.cpp
+++ b/src/Persistence_representations/example/persistence_vectors.cpp
@@ -41,19 +41,19 @@ int main(int argc, char** argv) {
Vector_distances_in_diagram v2(persistence2, std::numeric_limits<size_t>::max());
// writing to a stream:
- std::cout << "v1 : " << v1 << std::endl;
- std::cout << "v2 : " << v2 << std::endl;
+ std::clog << "v1 : " << v1 << std::endl;
+ std::clog << "v2 : " << v2 << std::endl;
// averages:
Vector_distances_in_diagram average;
average.compute_average({&v1, &v2});
- std::cout << "Average : " << average << std::endl;
+ std::clog << "Average : " << average << std::endl;
// computations of distances:
- std::cout << "l^1 distance : " << v1.distance(v2) << std::endl;
+ std::clog << "l^1 distance : " << v1.distance(v2) << std::endl;
// computations of scalar product:
- std::cout << "Scalar product of l1 and l2 : " << v1.compute_scalar_product(v2) << std::endl;
+ std::clog << "Scalar product of l1 and l2 : " << v1.compute_scalar_product(v2) << std::endl;
// create a file with a gnuplot script:
v1.plot("plot_of_vector_representation");
diff --git a/src/Persistence_representations/example/sliced_wasserstein.cpp b/src/Persistence_representations/example/sliced_wasserstein.cpp
index d5414d00..d4e31ebf 100644
--- a/src/Persistence_representations/example/sliced_wasserstein.cpp
+++ b/src/Persistence_representations/example/sliced_wasserstein.cpp
@@ -38,10 +38,10 @@ int main(int argc, char** argv) {
SW swex1(persistence1, 1, -1);
SW swex2(persistence2, 1, -1);
- std::cout << "Approx SW kernel: " << sw1.compute_scalar_product(sw2) << std::endl;
- std::cout << "Exact SW kernel: " << swex1.compute_scalar_product(swex2) << std::endl;
- std::cout << "Distance induced by approx SW kernel: " << sw1.distance(sw2) << std::endl;
- std::cout << "Distance induced by exact SW kernel: " << swex1.distance(swex2) << std::endl;
+ std::clog << "Approx SW kernel: " << sw1.compute_scalar_product(sw2) << std::endl;
+ std::clog << "Exact SW kernel: " << swex1.compute_scalar_product(swex2) << std::endl;
+ std::clog << "Distance induced by approx SW kernel: " << sw1.distance(sw2) << std::endl;
+ std::clog << "Distance induced by exact SW kernel: " << swex1.distance(swex2) << std::endl;
return 0;
}