From 00c36cb49bc55d93edadad6b865ffc42118ea148 Mon Sep 17 00:00:00 2001 From: pdlotko Date: Thu, 6 Apr 2017 19:39:35 +0000 Subject: Answer to MG4 comments. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@2314 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e59312ce2c58d4ac19f2e9d46b7ca4dd29ed8e6e --- src/Gudhi_stat/doc/gudhi_stat_doc.h | 2 +- .../Persistence_heat_maps.h | 41 ++++++++++++++++------ .../Persistence_landscape.h | 7 ++-- .../Persistence_landscape_on_grid.h | 2 +- .../Vector_distances_in_diagram.h | 5 +-- 5 files changed, 38 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/Gudhi_stat/doc/gudhi_stat_doc.h b/src/Gudhi_stat/doc/gudhi_stat_doc.h index 3eb4dff1..cbff56d6 100644 --- a/src/Gudhi_stat/doc/gudhi_stat_doc.h +++ b/src/Gudhi_stat/doc/gudhi_stat_doc.h @@ -43,7 +43,7 @@ namespace Gudhi_stat { * are different by performing a permutation test. *First of all, we compute averages of those two collections: C average of \f$ c_1,\ldots,c_n \f$ and D average of \f$d_1,\ldots,d_n\f$. Note that both C and D are of a type A. Then we compute \f$d(C,D)\f$, * a distance between C and D. - *Later we put the two collections into one bin:\ + *Later we put the two collections into one bin: *\f[B = \{ c_1,...,c_n,d_1,...,d_n \}\f] *Then we shuffle B, and we divide the shuffled version of B into two classes: \f$B_1\f$ and \f$B_2\f$ (in this case, of the same cardinality). Then we compute averages \f$\hat{B_1}\f$ and \f$\hat{B_2}\f$ * of elements in \f$B_1\f$ and \f$B_2\f$. Note that again, \f$\hat{B_1}\f$ and \f$\hat{B_2}\f$ are of a type A. diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_heat_maps.h b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_heat_maps.h index d12f37fa..219349cb 100644 --- a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_heat_maps.h +++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_heat_maps.h @@ -113,14 +113,19 @@ std::vector< std::vector > create_Gaussian_filter( size_t pixel_radius , } +/* +* There are various options to scale the poits depending on their location. One can for instance: +* (1) do nothing (scale all of them with the weight 1), as in the function constant_function +* (2) Scale them by the distance to the diagonal. This is implemented in function +* (3) Scale them with the square of their distance to diagonal. This is implemented in function +* (4) Scale them with +*/ + + /** - * There are various options to scale the poits depending on their location. One can for instance: - * (1) do nothing (scale all of them with the weight 1), as in the function constant_function - * (2) Scale them by the distance to the diagonal. This is implemented in function - * (3) Scale them with the square of their distance to diagonal. This is implemented in function - * (4) Scale them with + * This is one of a scaling functions used to weight poits depending on their persistence and/or location in the diagram. + * This particular functiona is a finction which always assign value 1 to a point in the diagram. **/ - class constant_scaling_function { public: @@ -130,6 +135,11 @@ public: } }; + +/** + * This is one of a scaling functions used to weight poits depending on their persistence and/or location in the diagram. + * The scaling given by this function to a point (b,d) is Euclidean distance of (b,d) from diagonal. +**/ class distance_from_diagonal_scaling { public: @@ -140,6 +150,10 @@ public: } }; +/** + * This is one of a scaling functions used to weight poits depending on their persistence and/or location in the diagram. + * The scaling given by this function to a point (b,d) is a square of Euclidean distance of (b,d) from diagonal. +**/ class squared_distance_from_diagonal_scaling { public: @@ -149,6 +163,10 @@ public: } }; +/** + * This is one of a scaling functions used to weight poits depending on their persistence and/or location in the diagram. + * The scaling given by this function to a point (b,d) is an arctan of a persistence of a point (i.e. arctan( b-d ). +**/ class arc_tan_of_persistence_of_point { public: @@ -158,6 +176,12 @@ public: } }; +/** + * This is one of a scaling functions used to weight poits depending on their persistence and/or location in the diagram. + * This scaling function do not only depend on a point (p,d) in the diagram, but it depends on the whole diagram. + * The longest persistence pair get a scaling 1. Any other pair get a scaling belong to [0,1], which is proportional + * to the persistence of that pair. +**/ class weight_by_setting_maximal_interval_to_have_length_one { public: @@ -327,10 +351,7 @@ public: **/ void plot( const char* filename )const; - - /** - * Binary (arythmetic) operation on two Persistence_heat_maps. - **/ + template friend Persistence_heat_maps operation_on_pair_of_heat_maps( const Persistence_heat_maps& first , const Persistence_heat_maps& second , Operation_type operation ) { diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h index a0f8cbd2..9b968b01 100644 --- a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h +++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h @@ -128,7 +128,9 @@ public: friend std::ostream& operator<<(std::ostream& out, Persistence_landscape& land ); - +protected: + template < typename oper > friend Persistence_landscape operation_on_pair_of_landscapes ( const Persistence_landscape& land1 , const Persistence_landscape& land2 ); +public: /** @@ -521,8 +523,7 @@ protected: void construct_persistence_landscape_from_barcode( const std::vector< std::pair< double , double > > & p ); Persistence_landscape multiply_lanscape_by_real_number_not_overwrite( double x )const; - void multiply_lanscape_by_real_number_overwrite( double x ); - template < typename oper > friend Persistence_landscape operation_on_pair_of_landscapes ( const Persistence_landscape& land1 , const Persistence_landscape& land2 ); + void multiply_lanscape_by_real_number_overwrite( double x ); friend double compute_maximal_distance_non_symmetric( const Persistence_landscape& pl1, const Persistence_landscape& pl2 ); void set_up_numbers_of_functions_for_vectorization_and_projections_to_reals() diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape_on_grid.h b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape_on_grid.h index 07e80447..422699ef 100644 --- a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape_on_grid.h +++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape_on_grid.h @@ -415,7 +415,7 @@ public: bool operator == ( const Persistence_landscape_on_grid& rhs )const { bool dbg = true; - if ( ! this->values_of_landscapes.size() == rhs.values_of_landscapes.size() ) + if ( this->values_of_landscapes.size() != rhs.values_of_landscapes.size() ) { if (dbg) std::cerr << "values_of_landscapes of incompatable sizes\n"; return false; diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/Vector_distances_in_diagram.h b/src/Gudhi_stat/include/gudhi/persistence_representations/Vector_distances_in_diagram.h index 0e512bd3..83402d0f 100644 --- a/src/Gudhi_stat/include/gudhi/persistence_representations/Vector_distances_in_diagram.h +++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Vector_distances_in_diagram.h @@ -281,10 +281,7 @@ public: return std::make_pair( this->sorted_vector_of_distances[0] , 0); } - //arythmetic operations: - /** - * This is a generic function that allows to perform binary operations on two Vector_distances_in_diagram. It will be used later to defien sums and differences of Vector_distances_in_diagram. - **/ + //arythmetic operations: template < typename Operation_type > friend Vector_distances_in_diagram operation_on_pair_of_vectors( const Vector_distances_in_diagram& first , const Vector_distances_in_diagram& second , Operation_type opertion ) { -- cgit v1.2.3