Loading...
Searching...
No Matches
Gudhi::Persistence_representations::Persistence_intervals Class Reference

#include <include/gudhi/Persistence_intervals.h>

Public Member Functions

 Persistence_intervals (const char *filename, unsigned dimension=std::numeric_limits< unsigned >::max())
 
 Persistence_intervals (const std::vector< std::pair< double, double > > &intervals)
 
std::pair< double, double > get_x_range () const
 
std::pair< double, double > get_y_range () const
 
std::vector< double > length_of_dominant_intervals (size_t where_to_cut=100) const
 
std::vector< std::pair< double, double > > dominant_intervals (size_t where_to_cut=100) const
 
std::vector< size_t > histogram_of_lengths (size_t number_of_bins=10) const
 
std::vector< size_t > cumulative_histogram_of_lengths (size_t number_of_bins=10) const
 
std::vector< double > characteristic_function_of_diagram (double x_min, double x_max, size_t number_of_bins=10) const
 
std::vector< double > cumulative_characteristic_function_of_diagram (double x_min, double x_max, size_t number_of_bins=10) const
 
std::vector< std::pair< double, size_t > > compute_persistent_betti_numbers () const
 
std::vector< double > k_n_n (size_t k, size_t where_to_cut=10) const
 
void plot (const char *filename, double min_x=std::numeric_limits< double >::max(), double max_x=std::numeric_limits< double >::max(), double min_y=std::numeric_limits< double >::max(), double max_y=std::numeric_limits< double >::max()) const
 
size_t size () const
 
std::pair< double, double > operator[] (size_t i) const
 
double project_to_R (int number_of_function) const
 
size_t number_of_projections_to_R () const
 
std::vector< double > vectorize (int number_of_function) const
 
size_t number_of_vectorize_functions () const
 

Friends

std::ostream & operator<< (std::ostream &out, const Persistence_intervals &intervals)
 

Detailed Description

Constructor & Destructor Documentation

◆ Persistence_intervals() [1/2]

Gudhi::Persistence_representations::Persistence_intervals::Persistence_intervals ( const char *  filename,
unsigned  dimension = std::numeric_limits<unsigned>::max() 
)

This is a constructor of a class Persistence_intervals from a text file. Each line of the input file is supposed to contain two numbers of a type double (or convertible to double) representing the birth and the death of the persistence interval. If the pairs are not sorted so that birth <= death, then the constructor will sort then that way.

  • The second parameter of a constructor is a dimension of intervals to be read from a file. If your file contains only birth-death pairs, use the default value.

◆ Persistence_intervals() [2/2]

Gudhi::Persistence_representations::Persistence_intervals::Persistence_intervals ( const std::vector< std::pair< double, double > > &  intervals)

This is a constructor of a class Persistence_intervals from a vector of pairs. Each pair is assumed to represent a persistence interval. We assume that the first elements of pairs are smaller or equal the second elements of pairs.

Member Function Documentation

◆ characteristic_function_of_diagram()

std::vector< double > Gudhi::Persistence_representations::Persistence_intervals::characteristic_function_of_diagram ( double  x_min,
double  x_max,
size_t  number_of_bins = 10 
) const

In this procedure we assume that each barcode is a characteristic function of a height equal to its length. The persistence diagram is a sum of such a functions. The procedure below construct a function being a sum of the characteristic functions of persistence intervals. The first two parameters are the range in which the function is to be computed and the last parameter is the number of bins in the discretization of the interval [_min,_max].

Examples
persistence_intervals.cpp.

◆ compute_persistent_betti_numbers()

std::vector< std::pair< double, size_t > > Gudhi::Persistence_representations::Persistence_intervals::compute_persistent_betti_numbers ( ) const

Compute the function of persistence Betti numbers. The returned value is a vector of pair. First element of each pair is a place where persistence Betti numbers change. Second element of each pair is the value of Persistence Betti numbers at that point.

Examples
persistence_intervals.cpp, and persistence_intervals/plot_persistence_Betti_numbers.cpp.

◆ cumulative_characteristic_function_of_diagram()

std::vector< double > Gudhi::Persistence_representations::Persistence_intervals::cumulative_characteristic_function_of_diagram ( double  x_min,
double  x_max,
size_t  number_of_bins = 10 
) const

Cumulative version of the function characteristic_function_of_diagram

Examples
persistence_intervals.cpp.

◆ cumulative_histogram_of_lengths()

std::vector< size_t > Gudhi::Persistence_representations::Persistence_intervals::cumulative_histogram_of_lengths ( size_t  number_of_bins = 10) const

Based on a histogram of intervals lengths computed by the function histogram_of_lengths H the procedure below computes the cumulative histogram. The i-th position of the resulting histogram is the sum of values of H for the positions from 0 to i.

Examples
persistence_intervals.cpp.

◆ dominant_intervals()

std::vector< std::pair< double, double > > Gudhi::Persistence_representations::Persistence_intervals::dominant_intervals ( size_t  where_to_cut = 100) const
Procedure that compute the vector of the dominant (i.e. the longest) persistence intervals. The parameter of

the procedure (set by default to 100) is the number of dominant intervals returned by the procedure.

Examples
persistence_intervals.cpp, persistence_intervals/compute_number_of_dominant_intervals.cpp, and persistence_intervals/plot_histogram_of_intervals_lengths.cpp.

◆ get_x_range()

std::pair< double, double > Gudhi::Persistence_representations::Persistence_intervals::get_x_range ( ) const
inline

This procedure returns x-range of a given persistence diagram.

Examples
persistence_intervals.cpp, and persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp.

◆ get_y_range()

std::pair< double, double > Gudhi::Persistence_representations::Persistence_intervals::get_y_range ( ) const
inline

This procedure returns y-range of a given persistence diagram.

◆ histogram_of_lengths()

std::vector< size_t > Gudhi::Persistence_representations::Persistence_intervals::histogram_of_lengths ( size_t  number_of_bins = 10) const
Procedure to compute a histogram of interval's length. A histogram is a block plot. The number of blocks is

determined by the first parameter of the function (set by default to 10). For the sake of argument let us assume that the length of the longest interval is 1 and the number of bins is

  1. In this case the i-th block correspond to a range between i-1/10 and i10. The vale of a block supported at the interval is the number of persistence intervals of a length between x_0 and x_1.
Examples
persistence_intervals.cpp, and persistence_intervals/plot_histogram_of_intervals_lengths.cpp.

◆ k_n_n()

std::vector< double > Gudhi::Persistence_representations::Persistence_intervals::k_n_n ( size_t  k,
size_t  where_to_cut = 10 
) const

This is a non optimal procedure that compute vector of distances from each point of diagram to its k-th nearest neighbor (k is a parameter of the program). The resulting vector is by default truncated to 10 elements (this value can be changed by using the second parameter of the program). The points are returned in order from the ones which are farthest away from their k-th nearest neighbors.

◆ length_of_dominant_intervals()

std::vector< double > Gudhi::Persistence_representations::Persistence_intervals::length_of_dominant_intervals ( size_t  where_to_cut = 100) const

Procedure that compute the vector of lengths of the dominant (i.e. the longest) persistence intervals. The list is truncated at the parameter of the call where_to_cut (set by default to 100).

Examples
persistence_intervals.cpp.

◆ number_of_projections_to_R()

size_t Gudhi::Persistence_representations::Persistence_intervals::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()

size_t Gudhi::Persistence_representations::Persistence_intervals::number_of_vectorize_functions ( ) const
inline

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

◆ operator[]()

std::pair< double, double > Gudhi::Persistence_representations::Persistence_intervals::operator[] ( size_t  i) const
inline

Return the persistence interval at the given position. Note that intervals are not sorted with respect to their lengths.

◆ plot()

void Gudhi::Persistence_representations::Persistence_intervals::plot ( const char *  filename,
double  min_x = std::numeric_limits<double>::max(),
double  max_x = std::numeric_limits<double>::max(),
double  min_y = std::numeric_limits<double>::max(),
double  max_y = std::numeric_limits<double>::max() 
) const
inline

Generating gnuplot script to plot the interval.

Examples
persistence_intervals/plot_persistence_intervals.cpp.

◆ project_to_R()

double Gudhi::Persistence_representations::Persistence_intervals::project_to_R ( int  number_of_function) const

This is a simple function projecting the persistence intervals to a real number. The function we use here is a sum of squared lengths of intervals. It can be naturally interpreted as sum of step function, where the step height it equal to the length of the interval. 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.

◆ size()

size_t Gudhi::Persistence_representations::Persistence_intervals::size ( ) const
inline

Return number of points in the diagram.

◆ vectorize()

std::vector< double > Gudhi::Persistence_representations::Persistence_intervals::vectorize ( int  number_of_function) const
inline

Return a family of vectors obtained from the persistence diagram. The i-th vector consist of the length of i dominant persistence intervals.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const Persistence_intervals intervals 
)
friend

Operator that send the diagram to a stream.


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