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

This class implements the following concepts: Vectorized_topological_data, Topological_data_with_distances, Real_valued_topological_data. More...

#include <gudhi/Persistence_intervals.h>

Public Member Functions

 Persistence_intervals (const char *filename, unsigned int dimension=std::numeric_limits< unsigned int >::max())
 Constructor from a text file.
 Persistence_intervals (const std::vector< std::pair< double, double > > &intervals)
 Constructor from a vector of pairs.
std::pair< double, double > get_x_range () const
std::pair< double, double > get_y_range () const
std::vector< double > length_of_dominant_intervals (std::size_t where_to_cut=100) const
std::vector< std::pair< double, double > > dominant_intervals (std::size_t where_to_cut=100) const
std::vector< std::size_t > histogram_of_lengths (std::size_t number_of_bins=10) const
std::vector< std::size_t > cumulative_histogram_of_lengths (std::size_t number_of_bins=10) const
std::vector< double > characteristic_function_of_diagram (double x_min, double x_max, std::size_t number_of_bins=10) const
std::vector< double > cumulative_characteristic_function_of_diagram (double x_min, double x_max, std::size_t number_of_bins=10) const
std::vector< std::pair< double, std::size_t > > compute_persistent_betti_numbers () const
std::vector< double > k_n_n (std::size_t k, std::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
std::size_t size () const
const std::pair< double, double > & operator[] (std::size_t i) const
double project_to_R (int number_of_function) const
std::size_t number_of_projections_to_R () const
std::vector< double > vectorize (int number_of_function) const
std::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 int dimension = std::numeric_limits<unsigned int>::max() )
inline

Constructor from a text file.

Parameters
filenameEach 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. It is possible to have a third value at the begining of a line which represent the dimension of the interval.
dimensionIf anything other than std::numeric_limits<unsigned int>::max(), only the intervals in this given dimension are token into account if the dimension is given in the file lines. Ignored otherwise. Default value: std::numeric_limits<double>::max().

◆ Persistence_intervals() [2/2]

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

Constructor from a vector of pairs.

Parameters
intervalsEach pair in the vector is assumed to represent a persistence interval \( (b, d) \), such that \( b \leq d \).

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,
std::size_t number_of_bins = 10 ) const
inline

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, std::size_t > > Gudhi::Persistence_representations::Persistence_intervals::compute_persistent_betti_numbers ( ) const
inline

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,
std::size_t number_of_bins = 10 ) const
inline

Cumulative version of the function characteristic_function_of_diagram

Examples
persistence_intervals.cpp.

◆ cumulative_histogram_of_lengths()

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

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 ( std::size_t where_to_cut = 100) const
inline

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< std::size_t > Gudhi::Persistence_representations::Persistence_intervals::histogram_of_lengths ( std::size_t number_of_bins = 10) const
inline

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 ( std::size_t k,
std::size_t where_to_cut = 10 ) const
inline

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 ( std::size_t where_to_cut = 100) const
inline

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()

std::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()

std::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[]()

const std::pair< double, double > & Gudhi::Persistence_representations::Persistence_intervals::operator[] ( std::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
inline

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()

std::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.

◆ 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: