summaryrefslogtreecommitdiff
path: root/src/Persistence_representations/example
diff options
context:
space:
mode:
authormcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-03-29 15:27:31 +0000
committermcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-03-29 15:27:31 +0000
commit4e80b66cf5d4e6121149a12f3137e372e04d8588 (patch)
tree5f27e327d2ebacb273014e7bb40ff545755452b2 /src/Persistence_representations/example
parent784697ab263e30c062e92aacfce36d1ed4070c6f (diff)
added doc + cython
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/kernels@3319 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: cffc2e28ebf6fae46246c5abaac52b7328adf490
Diffstat (limited to 'src/Persistence_representations/example')
-rw-r--r--src/Persistence_representations/example/persistence_weighted_gaussian.cpp16
-rw-r--r--src/Persistence_representations/example/sliced_wasserstein.cpp12
2 files changed, 14 insertions, 14 deletions
diff --git a/src/Persistence_representations/example/persistence_weighted_gaussian.cpp b/src/Persistence_representations/example/persistence_weighted_gaussian.cpp
index a0e820ea..d447f165 100644
--- a/src/Persistence_representations/example/persistence_weighted_gaussian.cpp
+++ b/src/Persistence_representations/example/persistence_weighted_gaussian.cpp
@@ -57,11 +57,11 @@ int main(int argc, char** argv) {
// Linear PWG
- std::cout << PWG1.compute_scalar_product (PWG2) << std::endl;
- std::cout << PWGex1.compute_scalar_product (PWGex2) << std::endl;
+ std::cout << "Approx PWG kernel: " << PWG1.compute_scalar_product (PWG2) << std::endl;
+ std::cout << "Exact PWG kernel: " << PWGex1.compute_scalar_product (PWGex2) << std::endl;
- std::cout << PWG1.distance (PWG2) << std::endl;
- std::cout << PWGex1.distance (PWGex2) << std::endl;
+ std::cout << "Distance induced by approx PWG kernel: " << PWG1.distance (PWG2) << std::endl;
+ std::cout << "Distance induced by exact PWG kernel: " << PWGex1.distance (PWGex2) << std::endl;
@@ -71,8 +71,8 @@ int main(int argc, char** argv) {
// Gaussian PWG
- std::cout << std::exp( -PWG1.distance (PWG2, 2) ) / (2*tau*tau) << std::endl;
- std::cout << std::exp( -PWGex1.distance (PWGex2, 2) ) / (2*tau*tau) << std::endl;
+ std::cout << "Approx Gaussian PWG kernel: " << std::exp( -PWG1.distance (PWG2) ) / (2*tau*tau) << std::endl;
+ std::cout << "Exact Gaussian PWG kernel: " << std::exp( -PWGex1.distance (PWGex2) ) / (2*tau*tau) << std::endl;
@@ -91,8 +91,8 @@ int main(int argc, char** argv) {
PWG pwgex1(pd1, 2*std::sqrt(sigma), -1, PWG::pss_weight);
PWG pwgex2(pd2, 2*std::sqrt(sigma), -1, PWG::pss_weight);
- std::cout << pwg1.compute_scalar_product (pwg2) / (16*pi*sigma) << std::endl;
- std::cout << pwgex1.compute_scalar_product (pwgex2) / (16*pi*sigma) << std::endl;
+ std::cout << "Approx PSS kernel: " << pwg1.compute_scalar_product (pwg2) / (16*pi*sigma) << std::endl;
+ std::cout << "Exact PSS kernel: " << pwgex1.compute_scalar_product (pwgex2) / (16*pi*sigma) << std::endl;
diff --git a/src/Persistence_representations/example/sliced_wasserstein.cpp b/src/Persistence_representations/example/sliced_wasserstein.cpp
index 2470029b..f1aeea5c 100644
--- a/src/Persistence_representations/example/sliced_wasserstein.cpp
+++ b/src/Persistence_representations/example/sliced_wasserstein.cpp
@@ -32,8 +32,6 @@ int main(int argc, char** argv) {
std::vector<std::pair<double, double> > persistence1;
std::vector<std::pair<double, double> > persistence2;
- std::vector<std::vector<std::pair<double, double> > > set1;
- std::vector<std::vector<std::pair<double, double> > > set2;
persistence1.push_back(std::make_pair(1, 2));
persistence1.push_back(std::make_pair(6, 8));
@@ -52,10 +50,12 @@ int main(int argc, char** argv) {
SW swex1(persistence1, 1, -1);
SW swex2(persistence2, 1, -1);
- std::cout << sw1.compute_sliced_wasserstein_distance(sw2) << std::endl;
- std::cout << swex1.compute_sliced_wasserstein_distance(swex2) << std::endl;
- std::cout << sw1.compute_scalar_product(sw2) << std::endl;
- std::cout << swex1.distance(swex2) << std::endl;
+ std::cout << "Approx SW distance: " << sw1.compute_sliced_wasserstein_distance(sw2) << std::endl;
+ std::cout << "Exact SW distance: " << swex1.compute_sliced_wasserstein_distance(swex2) << std::endl;
+ 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;
return 0;
}