From 28fd0e09e42425b12929990542f739f8334c13f0 Mon Sep 17 00:00:00 2001 From: pdlotko Date: Mon, 5 Dec 2016 13:07:14 +0000 Subject: adding arytmetic operations to heat maps and persistence vectors. Now any representation for which arythmetic operations make sense have them defined. This can be used for interpolation and extrapolation (among many others). git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@1818 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 257abd97dfdb7725dabd7d04558268ceec389004 --- src/Gudhi_stat/test/persistence_heat_maps_test.cpp | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/Gudhi_stat/test/persistence_heat_maps_test.cpp') diff --git a/src/Gudhi_stat/test/persistence_heat_maps_test.cpp b/src/Gudhi_stat/test/persistence_heat_maps_test.cpp index e46e45d3..d1f4da76 100644 --- a/src/Gudhi_stat/test/persistence_heat_maps_test.cpp +++ b/src/Gudhi_stat/test/persistence_heat_maps_test.cpp @@ -235,3 +235,31 @@ BOOST_AUTO_TEST_CASE(check_scalar_products_for_heat_maps) BOOST_CHECK( fabs( r.compute_scalar_product( r ) - 0.672907)< 0.0005); } + + + +BOOST_AUTO_TEST_CASE(check_arythmetic_operations_for_heat_maps) +{ + std::vector< std::vector > filter = create_Gaussian_filter(30,1); + Persistence_heat_maps p( "data/file_with_diagram" , filter , false , 1000 , 0 , 1 ); + Persistence_heat_maps q( "data/file_with_diagram_1" , filter , false , 1000 , 0 , 1 ); + + Persistence_heat_maps sum = p + q; + Persistence_heat_maps difference = p - q; + Persistence_heat_maps multiply_by_scalar = 2*p; + + //sum.print_to_file( "sum" ); + //difference.print_to_file( "difference" ); + //multiply_by_scalar.print_to_file( "multiply_by_scalar" ); + + Persistence_heat_maps sum_template; + sum_template.load_from_file( "data/heat_map_sum" ); + Persistence_heat_maps difference_template; + difference_template.load_from_file( "data/heat_map_difference" ); + Persistence_heat_maps multiply_by_scalar_template; + multiply_by_scalar_template.load_from_file( "data/heat_map_multiply_by_scalar" ); + + BOOST_CHECK( sum == sum_template ); + +} + -- cgit v1.2.3