diff options
author | pdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-24 20:22:47 +0000 |
---|---|---|
committer | pdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-24 20:22:47 +0000 |
commit | ee086a78f61f1ac6dd14ecab6e34d6710c971f64 (patch) | |
tree | 91d7bec2f0d8bca9b84f31d523a82240d79cd12a /src/Gudhi_stat/example | |
parent | 5b6290423812b24cc3f67a4a8e9c9027b9d95cd6 (diff) |
Answer to Marc's comments.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@2240 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 20c02d536373553322a3e10eb4aacc2959db654a
Diffstat (limited to 'src/Gudhi_stat/example')
-rw-r--r-- | src/Gudhi_stat/example/persistence_heat_maps.cpp | 120 | ||||
-rw-r--r-- | src/Gudhi_stat/example/persistence_intervals.cpp | 2 | ||||
-rw-r--r-- | src/Gudhi_stat/example/persistence_landscape.cpp | 128 | ||||
-rw-r--r-- | src/Gudhi_stat/example/persistence_landscape_on_grid.cpp | 109 | ||||
-rw-r--r-- | src/Gudhi_stat/example/vector_representation.cpp | 32 |
5 files changed, 5 insertions, 386 deletions
diff --git a/src/Gudhi_stat/example/persistence_heat_maps.cpp b/src/Gudhi_stat/example/persistence_heat_maps.cpp index c8dde3cd..0e5f7b79 100644 --- a/src/Gudhi_stat/example/persistence_heat_maps.cpp +++ b/src/Gudhi_stat/example/persistence_heat_maps.cpp @@ -23,7 +23,7 @@ #include <gudhi/reader_utils.h> -#include <gudhi/concretizations/Persistence_heat_maps.h> +#include <gudhi/persistence_representations/Persistence_heat_maps.h> #include <iostream> #include <vector> @@ -91,121 +91,3 @@ int main( int argc , char** argv ) - - - -//Below I am storing the code used to generate tests for that functionality. -/* - std::vector< std::pair< double,double > > intervals; - intervals.push_back( std::make_pair(0.5,0.5) ); - std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1); - Persistence_heat_maps p( intervals , filter , constant_function, false , 100 , 0 , 1 ); - p.plot( "heat_map_1" ); - - - std::vector< std::pair< double,double > > intervals2; - intervals2.push_back( std::make_pair(7,12) ); - Persistence_heat_maps q( intervals2 , filter , constant_function, false , 100 , 0 , 10 ); - q.plot( "heat_map_2" ); -*/ -/* - std::vector< std::pair< double,double > > intervals; - intervals.push_back( std::make_pair(0.5,0.5) ); - std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1); - Persistence_heat_maps p( intervals , filter , constant_function, false , 10 , 0 , 1 ); - p.write_to_file( "aaa" ); - - Persistence_heat_maps q; - q.load_from_file( "aaa" ); - - cerr << ( p == q ) << endl; - */ - -/* - std::vector< std::vector<double> > filter = create_Gaussian_filter(30,1); - Persistence_heat_maps p( "file_with_diagram" , filter , constant_function, false , 100 , 0 , 1 ); - p.plot( "heat_map_1" ); -*/ - -/* - //test to construct persistence heat map: - std::vector< std::vector<double> > filter = create_Gaussian_filter(100,1); - Persistence_heat_maps p( "file_with_diagram" , filter , constant_function, false , 1000 , 0 , 1 ); - p.print_to_file( "persistence_heat_map_from_file_with_diagram" ); - - Persistence_heat_maps q; - q.load_from_file( "persistence_heat_map_from_file_with_diagram" ); - - cerr << (p == q) << endl; -*/ -/* - //test of computations of a mean: - std::vector< std::pair< double,double > > intervals; - intervals.push_back( std::make_pair(5,5) ); - std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1); - Persistence_heat_maps p( intervals , filter , constant_function, false , 100 , 0 , 10 ); - p.plot( "heat_map_1" ); - - - std::vector< std::pair< double,double > > intervals2; - intervals2.push_back( std::make_pair(7,7) ); - Persistence_heat_maps q( intervals2 , filter , constant_function, false , 100 , 0 , 10 ); - q.plot( "heat_map_2" ); - - - Persistence_heat_maps av; - av.compute_average( { &P , &q } ); - av.plot( "average" ); -*/ - -/* - std::vector< std::vector<double> > filter = create_Gaussian_filter(30,1); - Persistence_heat_maps p( "file_with_diagram" , filter , constant_function, false , 1000 , 0 , 10 ); - Persistence_heat_maps q( "file_with_diagram_1" , filter , constant_function, false , 1000 , 0 , 10 ); - Persistence_heat_maps r( "file_with_diagram_2" , filter , constant_function, false , 1000 , 0 , 10 ); - Persistence_heat_maps av; - av.compute_average( {&p,&q,&r} ); - - av.print_to_file( "template_average_of_heat_maps" ); -*/ - -/* - std::vector< std::pair< double,double > > intervals; - intervals.push_back( std::make_pair(5,5) ); - std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1); - Persistence_heat_maps p( intervals , filter , constant_function, false , 10 , 0 , 10 ); - p.plot( "heat_map_1" ); - - std::vector< std::pair< double,double > > intervals2; - intervals2.push_back( std::make_pair(7,7) ); - Persistence_heat_maps q( intervals2 , filter , constant_function, false , 10 , 0 , 10 ); - q.plot( "heat_map_2" ); - - Persistence_heat_maps median; - median.compute_median( {&p,&q} ); - median.plot( "median" ); -*/ - -/* - std::vector< std::vector<double> > filter = create_Gaussian_filter(30,1); - Persistence_heat_maps p( "file_with_diagram" , filter , constant_function, false , 1000 , 0 , 1 ); - Persistence_heat_maps q( "file_with_diagram_1" , filter , constant_function, false , 1000 , 0 , 1 ); - Persistence_heat_maps r( "file_with_diagram_2" , filter , constant_function, false , 1000 , 0 , 1 ); - Persistence_heat_maps median; - median.compute_median( {&p,&q,&r} ); - median.print_to_file( "template_median_of_heat_maps" ); -*/ - - -/* - std::vector< std::vector<double> > filter = create_Gaussian_filter(30,1); - Persistence_heat_maps p( "file_with_diagram" , filter , constant_function, false , 1000 , 0 , 1 ); - Persistence_heat_maps q( "file_with_diagram_1" , filter , constant_function, false , 1000 , 0 , 1 ); - Persistence_heat_maps r( "file_with_diagram_2" , filter , constant_function, false , 1000 , 0 , 1 ); - - Persistence_heat_maps percentage_of_active; - percentage_of_active.compute_percentage_of_active( {&p,&q,&r} , 0.1 ); - - percentage_of_active.print_to_file( "template_percentage_of_active_of_heat_maps" ); - //percentage_of_active.plot( "template_percentage_of_active_of_heat_maps" ); -*/ diff --git a/src/Gudhi_stat/example/persistence_intervals.cpp b/src/Gudhi_stat/example/persistence_intervals.cpp index 044ba3c3..04c758e6 100644 --- a/src/Gudhi_stat/example/persistence_intervals.cpp +++ b/src/Gudhi_stat/example/persistence_intervals.cpp @@ -23,7 +23,7 @@ #include <gudhi/reader_utils.h> -#include <gudhi/concretizations/Persistence_intervals.h> +#include <gudhi/persistence_representations/Persistence_intervals.h> #include <iostream> diff --git a/src/Gudhi_stat/example/persistence_landscape.cpp b/src/Gudhi_stat/example/persistence_landscape.cpp index bb1cecea..9385c408 100644 --- a/src/Gudhi_stat/example/persistence_landscape.cpp +++ b/src/Gudhi_stat/example/persistence_landscape.cpp @@ -22,7 +22,7 @@ -#include <gudhi/concretizations/Persistence_landscape.h> +#include <gudhi/persistence_representations/Persistence_landscape.h> @@ -90,129 +90,3 @@ int main( int argc , char** argv ) return 0; } - -//Below I am storing the code used to generate tests for that functionality. -/* -if ( argc != 2 ) - { - std::cerr << "To run this program, please provide a name of a file with persistence landscape \n"; - //return 1; - } - Persistence_landscape p("../test/data/file_with_diagram"); - - Persistence_landscape q; - q.load_landscape_from_file( "file_with_landscape_from_file_with_diagram" ); - - if ( p != q ) - { - cout << "Not equal \n"; - } - - double integral = p.compute_integral_of_landscape(); - cout << "integral : " << integral <<endl; - - //compute integral for each level separatelly - for ( size_t level = 0 ; level != p.size() ; ++level ) - { - cout << p.compute_integral_of_landscape( level ) << endl; - } - - //compute integral of p-th power of landscspe - for ( size_t power = 0 ; power != 5 ; ++power ) - { - cout << p.compute_integral_of_landscape( power ) << endl; - } - - cout << "Value of level 1 at 0 : " << p.compute_value_at_a_given_point(1,0.0) << endl; - cout << "Value of level 1 at 1 : " << p.compute_value_at_a_given_point(1,0.1) << endl; - cout << "Value of level 1 at 2 : " << p.compute_value_at_a_given_point(1,0.2) << endl; - cout << "Value of level 1 at 3 : " << p.compute_value_at_a_given_point(1,0.3) << endl; - - - cout << "Value of level 2 at 0 : " << p.compute_value_at_a_given_point(2,0.0) << endl; - cout << "Value of level 2 at 1 : " << p.compute_value_at_a_given_point(2,0.1) << endl; - cout << "Value of level 2 at 2 : " << p.compute_value_at_a_given_point(2,0.2) << endl; - cout << "Value of level 2 at 3 : " << p.compute_value_at_a_given_point(2,0.3) << endl; - - - cout << "Value of level 3 at 0 : " << p.compute_value_at_a_given_point(3,0.0) << endl; - cout << "Value of level 3 at 1 : " << p.compute_value_at_a_given_point(3,0.1) << endl; - cout << "Value of level 3 at 2 : " << p.compute_value_at_a_given_point(3,0.2) << endl; - cout << "Value of level 3 at 3 : " << p.compute_value_at_a_given_point(3,0.3) << endl; - - - - Persistence_landscape second; - second.load_landscape_from_file("file_with_landscape_from_file_with_diagram_1" ); - - Persistence_landscape sum = p + second; - Persistence_landscape difference = p - second; - Persistence_landscape multiply_by_scalar = 10*p; - - //sum.print_to_file("sum"); - //difference.print_to_file("difference"); - //multiply_by_scalar.print_to_file("multiply_by_scalar"); - - Persistence_landscape template_sum; - template_sum.load_landscape_from_file( "sum" ); - Persistence_landscape template_difference; - template_difference.load_landscape_from_file( "difference" ); - Persistence_landscape template_multiply_by_scalar; - template_multiply_by_scalar.load_landscape_from_file( "multiply_by_scalar" ); - - if ( sum != template_sum ) - { - cerr << "Problem with sums \n"; - } - if ( difference != template_difference ) - { - cerr << "Problem with differences \n"; - } - if ( multiply_by_scalar != template_multiply_by_scalar ) - { - cerr << "Problem with multiplication by scalar \n"; - } - - - - cout << "Maximum : " << p.compute_maximum() << endl; - - cout << "L^1 norm : " << p.compute_norm_of_landscape(1) << endl; - cout << "L^2 norm : " << p.compute_norm_of_landscape(2) << endl; - cout << "L^3 norm : " << p.compute_norm_of_landscape(3) << endl; - - - cout << "L^1 distance : " << compute_distance_of_landscapes(p,sum,1) << endl; - cout << "L^2 distance : " << compute_distance_of_landscapes(p,sum,2) << endl; - cout << "L^infty distance : " << compute_distance_of_landscapes(p,sum,std::numeric_limits<double>::max() ) << endl; - - { - Persistence_landscape p( "../test/data/file_with_diagram" ); - Persistence_landscape q( "../test/data/file_with_diagram_1" ); - Persistence_landscape av; - av.compute_average( {&p,&q} ); - - Persistence_landscape template_average; - template_average.load_landscape_from_file( "average" ); - if ( template_average != av ) - { - cerr << "We have a problem with average \n"; - } - } - - - { - Persistence_landscape p( "../test/data/file_with_diagram" ); - Persistence_landscape q( "../test/data/file_with_diagram_1" ); - cout << "L^1 distance : " << p.distance( &q ) << endl; - cout << "L^2 distance : " << p.distance( &q , 2) << endl; - cout << "L^infty distance : " << p.distance( &q , std::numeric_limits<double>::max() ) << endl; - } - - - { - Persistence_landscape p( "../test/data/file_with_diagram" ); - Persistence_landscape q( "../test/data/file_with_diagram_1" ); - cout << "Scalar product : " << p.compute_scalar_product( &q ) << endl; - } -*/ diff --git a/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp b/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp index 9133944d..d432d757 100644 --- a/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp +++ b/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp @@ -22,7 +22,7 @@ -#include <gudhi/concretizations/Persistence_landscape_on_grid.h> +#include <gudhi/persistence_representations/Persistence_landscape_on_grid.h> @@ -86,110 +86,3 @@ int main( int argc , char** argv ) return 0; } - - -//Below I am storing the code used to generate tests for that functionality. -/* - Persistence_landscape_on_grid l( "file_with_diagram_1" , 100 ); - l.print_to_file( "landscape_from_file_with_diagram_1" ); - - Persistence_landscape_on_grid g; - g.load_landscape_from_file( "landscape_from_file_with_diagram_1" ); - - cerr << ( l == g ); - */ - - /* - Persistence_landscape_on_grid l( "file_with_diagram_1" , 100 ); - cerr << l << endl; - cerr << l.compute_integral_of_landscape() << endl; - */ - - /* - Persistence_landscape_on_grid p( "file_with_diagram_1" , 100 ); - for ( size_t level = 0 ; level != 30 ; ++level ) - { - double integral = p.compute_integral_of_landscape( level ); - cerr << integral << endl; - } - */ - - /* - Persistence_landscape_on_grid p( "file_with_diagram_1" , 100 ); - for ( size_t power = 0 ; power != 5 ; ++power ) - { - double integral = p.compute_integral_of_landscape( (double)power ); - cerr << integral << endl; - } - */ - - /* - Persistence_landscape_on_grid p( "file_with_diagram_1" , 100 ); - double x = 0.0012321; - double dx = 0.05212; - for ( size_t i = 0 ; i != 10 ; ++i ) - { - cerr << p.compute_value_at_a_given_point(10,x) << endl; - x += dx; - } - */ - - /* - Persistence_landscape_on_grid p( "file_with_diagram_1",100 ); - Persistence_landscape_on_grid second("file_with_diagram_1",100 ); - Persistence_landscape_on_grid sum = p + second; - Persistence_landscape_on_grid difference = p - second; - Persistence_landscape_on_grid multiply_by_scalar = 10*p; - sum.print_to_file( "sum_on_grid_test" ); - difference.print_to_file( "difference_on_grid_test" ); - multiply_by_scalar.print_to_file( "multiply_by_scalar_on_grid_test" ); - */ - - - /* - Persistence_landscape_on_grid p( "file_with_diagram_1" , 0 , 1 , 100 ); - Persistence_landscape_on_grid second("file_with_diagram_1", 0 , 1 , 100 ); - Persistence_landscape_on_grid sum = p + second; - - cerr << "max : " << p.compute_maximum() << endl; - cerr << "1-norm : " << p.compute_norm_of_landscape(1) << endl; - cerr << "2-norm : " << p.compute_norm_of_landscape(2) << endl; - cerr << "3-norm : " << p.compute_norm_of_landscape(3) << endl; - - cerr << compute_distance_of_landscapes_on_grid(p,sum,1) << endl; - cerr << compute_distance_of_landscapes_on_grid(p,sum,2) << endl; - cerr << compute_distance_of_landscapes_on_grid(p,sum,-1) << endl; - */ - - /* - Persistence_landscape_on_grid p( "file_with_diagram", 0,1,100 ); - Persistence_landscape_on_grid q( "file_with_diagram_1", 0,1,100 ); - Persistence_landscape_on_grid av; - av.compute_average( {&p,&q} ); - av.print_to_file("average_on_a_grid"); - - Persistence_landscape_on_grid template_average; - template_average.load_landscape_from_file( "average_on_a_grid" ); - if ( template_average == av ) - { - cerr << "OK OK \n"; - }*/ - - /* - Persistence_landscape_on_grid p( "file_with_diagram" , 0,1,10000); - Persistence_landscape_on_grid q( "file_with_diagram_1" , 0,1,10000); - cerr << p.distance( &q )<< endl; - cerr << p.distance( &q , 2 ) << endl; - cerr << p.distance( &q , std::numeric_limits<double>::max() ) << endl; - */ - -/* - Persistence_landscape_on_grid p( "file_with_diagram", 0,1,10000 ); - Persistence_landscape_on_grid q( "file_with_diagram_1", 0,1,10000 ); - - //std::vector< std::pair< double,double > > aa; - //aa.push_back( std::make_pair( 0,1 ) ); - //Persistence_landscape_on_grid p( aa, 0,1,10 ); - //Persistence_landscape_on_grid q( aa, 0,1,10 ); - cerr << p.compute_scalar_product( &q ) << endl; -*/ diff --git a/src/Gudhi_stat/example/vector_representation.cpp b/src/Gudhi_stat/example/vector_representation.cpp index 981e63de..476deeba 100644 --- a/src/Gudhi_stat/example/vector_representation.cpp +++ b/src/Gudhi_stat/example/vector_representation.cpp @@ -22,7 +22,7 @@ -#include <gudhi/concretizations/Vector_distances_in_diagram.h> +#include <gudhi/persistence_representations/Vector_distances_in_diagram.h> #include <iostream> @@ -78,33 +78,3 @@ int main( int argc , char** argv ) return 0; } - - - - -/* - if ( argc < 2 ) - { - cout << "To run this program, please provide the name of a file with persistence diagram. If you provide two files, we will do distance, scalar produc and average computations \n"; - return 1; - } - - Vector_distances_in_diagram< Euclidean_distance<double> > p( argv[1] , 100 ); - cout << "This is a vector corresponding to the input persistence diagram : \n"; - cout << p << endl; - - - - if ( argc == 3 ) - { - Vector_distances_in_diagram< Euclidean_distance<double> > p_prime( argv[2] , 100); - - cout << "p_prime : " <<p_prime << endl; - - cout << "Distance between input persistence diagrams : " << p.distance( &p_prime ) << endl; - Vector_distances_in_diagram< Euclidean_distance<double> > average; - average.compute_average( {&p,&p_prime} ); - - cout << "Here is an average : " << average << endl; - } -*/ |