diff options
author | mcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-10-30 21:07:52 +0000 |
---|---|---|
committer | mcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-10-30 21:07:52 +0000 |
commit | 230eac46395aeb406ca79280a8d62fc35b6f41a3 (patch) | |
tree | 21d1feab9f3d090cba3313b73dead9db5fc0a6bc /src/Persistence_representations/example | |
parent | 8f9e4f64a2df82205a3a4551e0443b9e2a45edae (diff) |
removed template Kernel2D
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/kernels@3965 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 0cfdece6eb19cb8601371bc96e1dbb66ae41a086
Diffstat (limited to 'src/Persistence_representations/example')
-rw-r--r-- | src/Persistence_representations/example/persistence_heat_maps.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Persistence_representations/example/persistence_heat_maps.cpp b/src/Persistence_representations/example/persistence_heat_maps.cpp index c177c009..0beb1052 100644 --- a/src/Persistence_representations/example/persistence_heat_maps.cpp +++ b/src/Persistence_representations/example/persistence_heat_maps.cpp @@ -27,9 +27,13 @@ #include <vector> #include <utility> -using Gaussian_kernel = Gudhi::Persistence_representations::Gaussian_kernel_2D; + +std::function<double(std::pair<double, double>, std::pair<double, double>)> Gaussian_function(double sigma){ + return [=](std::pair<double, double> p, std::pair<double, double> q){return std::exp( -( (p.first-q.first)*(p.first-q.first) + (p.second-q.second)*(p.second-q.second) )/(sigma) );}; +} + using constant_scaling_function = Gudhi::Persistence_representations::constant_scaling_function; -using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps<constant_scaling_function, Gaussian_kernel>; +using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps<constant_scaling_function>; int main(int argc, char** argv) { // create two simple vectors with birth--death pairs: @@ -79,10 +83,10 @@ int main(int argc, char** argv) { std::cout << "Scalar product is : " << hm1.compute_scalar_product(hm2) << std::endl; // Mathieu's code ************************************************************************************************************ - Persistence_heat_maps hm1k(persistence1); - Persistence_heat_maps hm2k(persistence2); - Persistence_heat_maps hm1i(persistence1, 20, 20, 0, 11, 0, 11); - Persistence_heat_maps hm2i(persistence2, 20, 20, 0, 11, 0, 11); + 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::endl; std::cout << "Scalar product computed with exact 2D kernel is : " << hm1k.compute_scalar_product(hm2k) << std::endl; // *************************************************************************************************************************** |