Loading...
Searching...
No Matches
Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels > Class Template Reference

A class implementing persistence heat maps. More...

#include <gudhi/Persistence_heat_maps.h>

Public Member Functions

 Persistence_heat_maps ()
 
 Persistence_heat_maps (const std::vector< std::pair< double, double > > &interval, std::vector< std::vector< double > > filter=create_Gaussian_filter(5, 1), bool erase_below_diagonal=false, size_t number_of_pixels=1000, double min_=std::numeric_limits< double >::max(), double max_=std::numeric_limits< double >::max())
 
 Persistence_heat_maps (const char *filename, std::vector< std::vector< double > > filter=create_Gaussian_filter(5, 1), bool erase_below_diagonal=false, size_t number_of_pixels=1000, double min_=std::numeric_limits< double >::max(), double max_=std::numeric_limits< double >::max(), unsigned dimension=std::numeric_limits< unsigned >::max())
 
 Persistence_heat_maps (const std::vector< std::pair< double, double > > &interval, const std::function< double(std::pair< double, double >, std::pair< double, double >)> &kernel, size_t number_of_x_pixels, size_t number_of_y_pixels, double min_x=0, double max_x=1, double min_y=0, double max_y=1)
 
 Persistence_heat_maps (const std::vector< std::pair< double, double > > &interval, const std::function< double(std::pair< double, double >, std::pair< double, double >)> &kernel)
 
void compute_mean (const std::vector< Persistence_heat_maps * > &maps)
 
void compute_median (const std::vector< Persistence_heat_maps * > &maps)
 
void compute_percentage_of_active (const std::vector< Persistence_heat_maps * > &maps, size_t cutoff=1)
 
void print_to_file (const char *filename) const
 
void load_from_file (const char *filename)
 
bool check_if_the_same (const Persistence_heat_maps &second) const
 
double get_min () const
 
double get_max () const
 
bool operator== (const Persistence_heat_maps &rhs) const
 
bool operator!= (const Persistence_heat_maps &rhs) const
 
void plot (const char *filename) const
 
Persistence_heat_maps multiply_by_scalar (double scalar) const
 
Persistence_heat_maps operator* (double scalar)
 
Persistence_heat_maps operator+= (const Persistence_heat_maps &rhs)
 
Persistence_heat_maps operator-= (const Persistence_heat_maps &rhs)
 
Persistence_heat_maps operator*= (double x)
 
Persistence_heat_maps operator/= (double x)
 
std::vector< double > vectorize (int number_of_function) const
 
size_t number_of_vectorize_functions () const
 
double project_to_R (int number_of_function) const
 
size_t number_of_projections_to_R () const
 
double distance (const Persistence_heat_maps &second_, double power=1) const
 
void compute_average (const std::vector< Persistence_heat_maps * > &to_average)
 
double compute_scalar_product (const Persistence_heat_maps &second_) const
 
std::pair< double, double > get_x_range () const
 
std::pair< double, double > get_y_range () const
 

Friends

Persistence_heat_maps operator+ (const Persistence_heat_maps &first, const Persistence_heat_maps &second)
 
Persistence_heat_maps operator- (const Persistence_heat_maps &first, const Persistence_heat_maps &second)
 
Persistence_heat_maps operator* (double scalar, const Persistence_heat_maps &A)
 
Persistence_heat_maps operator* (const Persistence_heat_maps &A, double scalar)
 

Detailed Description

Constructor & Destructor Documentation

◆ Persistence_heat_maps() [1/5]

template<typename Scalling_of_kernels = constant_scaling_function>
Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::Persistence_heat_maps ( )
inline

The default constructor. A scaling function from the diagonal is set up to a constant function. The image is not erased below the diagonal. The Gaussian have diameter 5.

◆ Persistence_heat_maps() [2/5]

template<typename Scalling_of_kernels >
Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::Persistence_heat_maps ( const std::vector< std::pair< double, double > > &  interval,
std::vector< std::vector< double > >  filter = create_Gaussian_filter(5, 1),
bool  erase_below_diagonal = false,
size_t  number_of_pixels = 1000,
double  min_ = std::numeric_limits<double>::max(),
double  max_ = std::numeric_limits<double>::max() 
)

Construction that takes at the input the following parameters: (1) A vector of pairs of doubles (representing persistence intervals). All other parameters are optional. They are: (2) a Gaussian filter generated by create_Gaussian_filter filter (the default value of this variable is a Gaussian filter of a radius 5), (3) a boolean value which determines if the area of image below diagonal should, or should not be erased (it will be erased by default). (4) a number of pixels in each direction (set to 1000 by default). (5) a min x and y value of points that are to be taken into account. By default it is set to std::numeric_limits<double>::max(), in which case the program compute the values based on the data, (6) a max x and y value of points that are to be taken into account. By default it is set to std::numeric_limits<double>::max(), in which case the program compute the values based on the data.

◆ Persistence_heat_maps() [3/5]

template<typename Scalling_of_kernels >
Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::Persistence_heat_maps ( const char *  filename,
std::vector< std::vector< double > >  filter = create_Gaussian_filter(5, 1),
bool  erase_below_diagonal = false,
size_t  number_of_pixels = 1000,
double  min_ = std::numeric_limits<double>::max(),
double  max_ = std::numeric_limits<double>::max(),
unsigned  dimension = std::numeric_limits<unsigned>::max() 
)

Construction that takes at the input a name of a file with persistence intervals, a filter (radius 5 by default), a scaling function (constant by default), a boolean value which determines if the area of image below diagonal should, or should not be erased (should by default). The next parameter is the number of pixels in each direction (set to 1000 by default) and min and max values of images (both set to std::numeric_limits<double>::max() by default. If this is the case, the program will pick the right values based on the data). Construction that takes at the input the following parameters: (1) A name of a file with persistence intervals. The file should be readable by the function read_persistence_intervals_in_one_dimension_from_file. All other parameters are optional. They are: (2) a Gaussian filter generated by create_Gaussian_filter filter (the default value of this variable is a Gaussian filter of a radius 5), (3) a boolean value which determines if the area of image below diagonal should, or should not be erased (it will be erased by default). (4) a number of pixels in each direction (set to 1000 by default). (5) a min x and y value of points that are to be taken into account. By default it is set to std::numeric_limits<double>::max(), in which case the program compute the values based on the data, (6) a max x and y value of points that are to be taken into account. By default it is set to std::numeric_limits<double>::max(), in which case the program compute the values based on the data.

◆ Persistence_heat_maps() [4/5]

template<typename Scalling_of_kernels >
Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::Persistence_heat_maps ( const std::vector< std::pair< double, double > > &  interval,
const std::function< double(std::pair< double, double >, std::pair< double, double >)> &  kernel,
size_t  number_of_x_pixels,
size_t  number_of_y_pixels,
double  min_x = 0,
double  max_x = 1,
double  min_y = 0,
double  max_y = 1 
)

Construction that takes as inputs (1) the diagram, and (2) the grid parameters (min, max and number of samples for x and y axes)

◆ Persistence_heat_maps() [5/5]

template<typename Scalling_of_kernels >
Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::Persistence_heat_maps ( const std::vector< std::pair< double, double > > &  interval,
const std::function< double(std::pair< double, double >, std::pair< double, double >)> &  kernel 
)

Construction that takes only the diagram as input (weight and 2D kernel are template parameters)

Member Function Documentation

◆ check_if_the_same()

template<typename Scalling_of_kernels = constant_scaling_function>
bool Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::check_if_the_same ( const Persistence_heat_maps< Scalling_of_kernels > &  second) const
inline

The procedure checks if min_, max_ and this->heat_maps sizes are the same.

◆ compute_average()

template<typename Scalling_of_kernels >
void Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::compute_average ( const std::vector< Persistence_heat_maps< Scalling_of_kernels > * > &  to_average)

A function to compute averaged persistence heat map, based on vector of persistence heat maps. This function is required by Topological_data_with_averages concept.

◆ compute_mean()

template<typename Scalling_of_kernels >
void Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::compute_mean ( const std::vector< Persistence_heat_maps< Scalling_of_kernels > * > &  maps)

Compute a mean value of a collection of heat maps and store it in the current object. Note that all the persistence maps send in a vector to this procedure need to have the same parameters. If this is not the case, the program will throw an exception.

◆ compute_median()

template<typename Scalling_of_kernels >
void Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::compute_median ( const std::vector< Persistence_heat_maps< Scalling_of_kernels > * > &  maps)

Compute a median value of a collection of heat maps and store it in the current object. Note that all the persistence maps send in a vector to this procedure need to have the same parameters. If this is not the case, the program will throw an exception.

◆ compute_percentage_of_active()

template<typename Scalling_of_kernels >
void Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::compute_percentage_of_active ( const std::vector< Persistence_heat_maps< Scalling_of_kernels > * > &  maps,
size_t  cutoff = 1 
)

Compute a percentage of active (i.e) values above the cutoff of a collection of heat maps.

◆ compute_scalar_product()

template<typename Scalling_of_kernels >
double Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::compute_scalar_product ( const Persistence_heat_maps< Scalling_of_kernels > &  second_) const

A function to compute scalar product of persistence heat maps. The parameter of this function is a const reference to an object of a class Persistence_heat_maps. This function is required in Topological_data_with_scalar_product concept.

◆ distance()

template<typename Scalling_of_kernels >
double Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::distance ( const Persistence_heat_maps< Scalling_of_kernels > &  second_,
double  power = 1 
) const

A function to compute distance between persistence heat maps. The parameter of this function is a const reference to an object of a class Persistence_heat_maps. This function is required in Topological_data_with_distances concept. For max norm distance, set power to std::numeric_limits<double>::max()

◆ get_max()

template<typename Scalling_of_kernels = constant_scaling_function>
double Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::get_max ( ) const
inline

Return maximal range value of persistent image.

◆ get_min()

template<typename Scalling_of_kernels = constant_scaling_function>
double Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::get_min ( ) const
inline

Return minimal range value of persistent image.

◆ get_x_range()

template<typename Scalling_of_kernels = constant_scaling_function>
std::pair< double, double > Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::get_x_range ( ) const
inline

The x-range of the persistence heat map.

◆ get_y_range()

template<typename Scalling_of_kernels = constant_scaling_function>
std::pair< double, double > Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::get_y_range ( ) const
inline

The y-range of the persistence heat map.

◆ load_from_file()

template<typename Scalling_of_kernels >
void Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::load_from_file ( const char *  filename)

A function that load a heat map from file to the current object (and erase whatever was stored in the current object before).

◆ multiply_by_scalar()

template<typename Scalling_of_kernels = constant_scaling_function>
Persistence_heat_maps Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::multiply_by_scalar ( double  scalar) const
inline

Multiplication of Persistence_heat_maps by scalar (so that all values of the heat map gets multiplied by that scalar).

◆ number_of_projections_to_R()

template<typename Scalling_of_kernels = constant_scaling_function>
size_t Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::number_of_projections_to_R ( ) const
inline

The function gives the number of possible projections to R. This function is required by the Real_valued_topological_data concept.

◆ number_of_vectorize_functions()

template<typename Scalling_of_kernels = constant_scaling_function>
size_t Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::number_of_vectorize_functions ( ) const
inline

This function return the number of functions that allows vectorization of persistence heat map. It is required in a concept Vectorized_topological_data.

◆ operator!=()

template<typename Scalling_of_kernels = constant_scaling_function>
bool Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::operator!= ( const Persistence_heat_maps< Scalling_of_kernels > &  rhs) const
inline

Operator != to check if to persistence heat maps are different.

◆ operator*()

template<typename Scalling_of_kernels = constant_scaling_function>
Persistence_heat_maps Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::operator* ( double  scalar)
inline

This function computes a product of an object of a type Persistence_heat_maps with real number.

◆ operator*=()

template<typename Scalling_of_kernels = constant_scaling_function>
Persistence_heat_maps Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::operator*= ( double  x)
inline

*= operator for Persistence_heat_maps.

◆ operator+=()

template<typename Scalling_of_kernels = constant_scaling_function>
Persistence_heat_maps Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::operator+= ( const Persistence_heat_maps< Scalling_of_kernels > &  rhs)
inline

+= operator for Persistence_heat_maps.

◆ operator-=()

template<typename Scalling_of_kernels = constant_scaling_function>
Persistence_heat_maps Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::operator-= ( const Persistence_heat_maps< Scalling_of_kernels > &  rhs)
inline

-= operator for Persistence_heat_maps.

◆ operator/=()

template<typename Scalling_of_kernels = constant_scaling_function>
Persistence_heat_maps Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::operator/= ( double  x)
inline

/= operator for Persistence_heat_maps.

◆ operator==()

template<typename Scalling_of_kernels = constant_scaling_function>
bool Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::operator== ( const Persistence_heat_maps< Scalling_of_kernels > &  rhs) const
inline

Operator == to check if to persistence heat maps are the same.

◆ plot()

template<typename Scalling_of_kernels >
void Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::plot ( const char *  filename) const

A function to generate a gnuplot script to visualize the persistent image.

◆ print_to_file()

template<typename Scalling_of_kernels >
void Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::print_to_file ( const char *  filename) const

The function outputs the persistence image to a text file. The format as follow: In the first line, the values min and max of the image are stored In the next lines, we have the persistence images in a form of a bitmap image.

◆ project_to_R()

template<typename Scalling_of_kernels >
double Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::project_to_R ( int  number_of_function) const

This function is required by the Real_valued_topological_data concept. It returns various projections on the persistence heat map to a real line. At the moment this function is not tested, since it is quite likely to be changed in the future. Given this, when using it, keep in mind that it will be most likely changed in the next versions.

◆ vectorize()

template<typename Scalling_of_kernels >
std::vector< double > Gudhi::Persistence_representations::Persistence_heat_maps< Scalling_of_kernels >::vectorize ( int  number_of_function) const

This function produce a vector of doubles based on a persistence heat map. It is required in a concept Vectorized_topological_data

Friends And Related Function Documentation

◆ operator* [1/2]

template<typename Scalling_of_kernels = constant_scaling_function>
Persistence_heat_maps operator* ( const Persistence_heat_maps< Scalling_of_kernels > &  A,
double  scalar 
)
friend

This function computes a product of an object of a type Persistence_heat_maps with real number.

◆ operator* [2/2]

template<typename Scalling_of_kernels = constant_scaling_function>
Persistence_heat_maps operator* ( double  scalar,
const Persistence_heat_maps< Scalling_of_kernels > &  A 
)
friend

This function computes a product of an object of a type Persistence_heat_maps with real number.

◆ operator+

template<typename Scalling_of_kernels = constant_scaling_function>
Persistence_heat_maps operator+ ( const Persistence_heat_maps< Scalling_of_kernels > &  first,
const Persistence_heat_maps< Scalling_of_kernels > &  second 
)
friend

This function computes a sum of two objects of a type Persistence_heat_maps.

◆ operator-

template<typename Scalling_of_kernels = constant_scaling_function>
Persistence_heat_maps operator- ( const Persistence_heat_maps< Scalling_of_kernels > &  first,
const Persistence_heat_maps< Scalling_of_kernels > &  second 
)
friend

This function computes a difference of two objects of a type Persistence_heat_maps.


The documentation for this class was generated from the following file: