Gudhi::Persistence_representations::Persistence_landscape Class Reference

A class implementing persistence landscapes data structures. More...

Public Member Functions

 Persistence_landscape ()
 
 Persistence_landscape (const std::vector< std::pair< double, double > > &p, size_t number_of_levels=std::numeric_limits< size_t >::max())
 
 Persistence_landscape (const char *filename, size_t dimension=std::numeric_limits< unsigned >::max(), size_t number_of_levels=std::numeric_limits< size_t >::max())
 
void load_landscape_from_file (const char *filename)
 
void print_to_file (const char *filename) const
 
double compute_integral_of_landscape () const
 
double compute_integral_of_a_level_of_a_landscape (size_t level) const
 
double compute_integral_of_landscape (double p) const
 
double compute_value_at_a_given_point (unsigned level, double x) const
 
Persistence_landscape operator+= (const Persistence_landscape &rhs)
 
Persistence_landscape operator-= (const Persistence_landscape &rhs)
 
Persistence_landscape operator*= (double x)
 
Persistence_landscape operator/= (double x)
 
bool operator== (const Persistence_landscape &rhs) const
 
bool operator!= (const Persistence_landscape &rhs) const
 
double compute_maximum () const
 
double operator() (unsigned level, double x) const
 
Persistence_landscape abs ()
 
size_t size () const
 
double find_max (unsigned lambda) 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
 
void compute_average (const std::vector< Persistence_landscape * > &to_average)
 
double distance (const Persistence_landscape &second, double power=1) const
 
double compute_scalar_product (const Persistence_landscape &second) const
 
std::pair< double, double > get_y_range (size_t level=0) const
 

Friends

std::ostream & operator<< (std::ostream &out, Persistence_landscape &land)
 
Persistence_landscape add_two_landscapes (const Persistence_landscape &land1, const Persistence_landscape &land2)
 
Persistence_landscape subtract_two_landscapes (const Persistence_landscape &land1, const Persistence_landscape &land2)
 
Persistence_landscape operator+ (const Persistence_landscape &first, const Persistence_landscape &second)
 
Persistence_landscape operator- (const Persistence_landscape &first, const Persistence_landscape &second)
 
Persistence_landscape operator* (const Persistence_landscape &first, double con)
 
Persistence_landscape operator* (double con, const Persistence_landscape &first)
 
double compute_max_norm_distance_of_landscapes (const Persistence_landscape &first, const Persistence_landscape &second)
 
double compute_distance_of_landscapes (const Persistence_landscape &first, const Persistence_landscape &second, double p)
 
double compute_inner_product (const Persistence_landscape &l1, const Persistence_landscape &l2)
 

Detailed Description

A class implementing persistence landscapes data structures.

For theoretical description, please consult Statistical topological data analysis using persistence landscapes[11] , and for details of algorithms, A persistence landscapes toolbox for topological statistics[10].

Persistence landscapes allow vectorization, computations of distances, computations of projections to Real, computations of averages and scalar products. Therefore they implement suitable interfaces. It implements the following concepts: Vectorized_topological_data, Topological_data_with_distances, Real_valued_topological_data, Topological_data_with_averages, Topological_data_with_scalar_product

Note that at the moment, due to rounding errors during the construction of persistence landscapes, elements which are different by 0.000005 are considered the same. If the scale in your persistence diagrams is comparable to this value, please rescale them before use this code.

Examples
persistence_landscape.cpp, persistence_landscapes/average_landscapes.cpp, persistence_landscapes/compute_distance_of_landscapes.cpp, persistence_landscapes/compute_scalar_product_of_landscapes.cpp, persistence_landscapes/create_landscapes.cpp, and persistence_landscapes/plot_landscapes.cpp.

Constructor & Destructor Documentation

◆ Persistence_landscape() [1/3]

Gudhi::Persistence_representations::Persistence_landscape::Persistence_landscape ( )
inline

Default constructor.

◆ Persistence_landscape() [2/3]

Gudhi::Persistence_representations::Persistence_landscape::Persistence_landscape ( const std::vector< std::pair< double, double > > &  p,
size_t  number_of_levels = std::numeric_limits<size_t>::max() 
)

Constructor that takes as an input a vector of birth-death pairs.

◆ Persistence_landscape() [3/3]

Gudhi::Persistence_representations::Persistence_landscape::Persistence_landscape ( const char *  filename,
size_t  dimension = std::numeric_limits<unsigned>::max(),
size_t  number_of_levels = std::numeric_limits<size_t>::max() 
)
Constructor that reads persistence intervals from file and creates persistence landscape. The format of the

input file is the following: in each line we put birth-death pair. Last line is assumed to be empty. Even if the points within a line are not ordered, they will be ordered while the input is read.

Member Function Documentation

◆ abs()

Persistence_landscape Gudhi::Persistence_representations::Persistence_landscape::abs ( )

Function to compute absolute value of a PL function. The representation of persistence landscapes allow to store general PL-function. When computing distance between two landscapes, we compute difference between them. In this case, a general PL-function with negative value can appear as a result. Then in order to compute distance, we need to take its absolute value. This is the purpose of this procedure.

◆ compute_average()

void Gudhi::Persistence_representations::Persistence_landscape::compute_average ( const std::vector< Persistence_landscape * > &  to_average)
inline

A function to compute averaged persistence landscape, based on vector of persistence landscapes. This function is required by Topological_data_with_averages concept.

Examples
persistence_landscape.cpp, and persistence_landscapes/average_landscapes.cpp.

◆ compute_integral_of_a_level_of_a_landscape()

double Gudhi::Persistence_representations::Persistence_landscape::compute_integral_of_a_level_of_a_landscape ( size_t  level) const

This function compute integral of the 'level'-level of a landscape.

◆ compute_integral_of_landscape() [1/2]

double Gudhi::Persistence_representations::Persistence_landscape::compute_integral_of_landscape ( ) const

This function compute integral of the landscape (defined formally as sum of integrals on R of all landscape functions)

Examples
persistence_landscape.cpp.

◆ compute_integral_of_landscape() [2/2]

double Gudhi::Persistence_representations::Persistence_landscape::compute_integral_of_landscape ( double  p) const
This function compute integral of the landscape p-th power of a landscape (defined formally as sum of integrals

on R of p-th powers of all landscape functions)

◆ compute_maximum()

double Gudhi::Persistence_representations::Persistence_landscape::compute_maximum ( ) const
inline

Computations of maximum (y) value of landscape.

Examples
persistence_landscape.cpp.

◆ compute_scalar_product()

double Gudhi::Persistence_representations::Persistence_landscape::compute_scalar_product ( const Persistence_landscape second) const
inline

A function to compute scalar product of persistence landscapes. The parameter of this function is a Persistence_landscape. This function is required in Topological_data_with_scalar_product concept.

Examples
persistence_landscape.cpp.

◆ compute_value_at_a_given_point()

double Gudhi::Persistence_representations::Persistence_landscape::compute_value_at_a_given_point ( unsigned  level,
double  x 
) const

A function that computes the value of a landscape at a given point. The parameters of the function are: unsigned level and double x. The procedure will compute the value of the level-landscape at the point x.

◆ distance()

double Gudhi::Persistence_representations::Persistence_landscape::distance ( const Persistence_landscape second,
double  power = 1 
) const
inline

A function to compute distance between persistence landscape. The parameter of this function is a Persistence_landscape. This function is required in Topological_data_with_distances concept. For max norm distance, set power to std::numeric_limits<double>::max()

Examples
persistence_landscape.cpp.

◆ find_max()

double Gudhi::Persistence_representations::Persistence_landscape::find_max ( unsigned  lambda) const

Compute maximal value of lambda-level landscape.

◆ get_y_range()

std::pair<double, double> Gudhi::Persistence_representations::Persistence_landscape::get_y_range ( size_t  level = 0) const
inline

This procedure returns y-range of a given level persistence landscape. If a default value is used, the y-range of 0th level landscape is given (and this range contains the ranges of all other landscapes).

◆ load_landscape_from_file()

void Gudhi::Persistence_representations::Persistence_landscape::load_landscape_from_file ( const char *  filename)

◆ number_of_projections_to_R()

size_t Gudhi::Persistence_representations::Persistence_landscape::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_landscape::number_of_vectorize_functions ( ) const
inline

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

◆ operator!=()

bool Gudhi::Persistence_representations::Persistence_landscape::operator!= ( const Persistence_landscape rhs) const
inline

An operator to compare two persistence landscapes.

◆ operator()()

double Gudhi::Persistence_representations::Persistence_landscape::operator() ( unsigned  level,
double  x 
) const
inline

An operator to compute the value of a landscape in the level 'level' at the argument 'x'.

◆ operator*=()

Persistence_landscape Gudhi::Persistence_representations::Persistence_landscape::operator*= ( double  x)
inline

Operator *=. The second parameter is a real number by which the y values of all landscape functions are multiplied. The x-values remain unchanged.

◆ operator+=()

Persistence_landscape Gudhi::Persistence_representations::Persistence_landscape::operator+= ( const Persistence_landscape rhs)
inline

Operator +=. The second parameter is persistence landscape.

◆ operator-=()

Persistence_landscape Gudhi::Persistence_representations::Persistence_landscape::operator-= ( const Persistence_landscape rhs)
inline

Operator -=. The second parameter is a persistence landscape.

◆ operator/=()

Persistence_landscape Gudhi::Persistence_representations::Persistence_landscape::operator/= ( double  x)
inline

Operator /=. The second parameter is a real number.

◆ operator==()

bool Gudhi::Persistence_representations::Persistence_landscape::operator== ( const Persistence_landscape rhs) const

An operator to compare two persistence landscapes.

◆ print_to_file()

void Gudhi::Persistence_representations::Persistence_landscape::print_to_file ( const char *  filename) const

The procedure stores a landscape to a file. The file can be later used by a procedure load_landscape_from_file.

Examples
persistence_landscapes/average_landscapes.cpp, and persistence_landscapes/create_landscapes.cpp.

◆ project_to_R()

double Gudhi::Persistence_representations::Persistence_landscape::project_to_R ( int  number_of_function) const
inline

The number of projections to R is defined to the number of nonzero landscape functions. I-th projection is an integral of i-th landscape function over whole R. This function is required by the Real_valued_topological_data concept. 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_landscape::size ( ) const
inline

Computes the number of landscape functions.

◆ vectorize()

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

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

Friends And Related Function Documentation

◆ add_two_landscapes

Persistence_landscape add_two_landscapes ( const Persistence_landscape land1,
const Persistence_landscape land2 
)
friend

A function that compute sum of two landscapes.

◆ compute_distance_of_landscapes

double compute_distance_of_landscapes ( const Persistence_landscape first,
const Persistence_landscape second,
double  p 
)
friend

Computations of \(L^{p}\) distance between two landscapes. p is the parameter of the procedure.

◆ compute_inner_product

double compute_inner_product ( const Persistence_landscape l1,
const Persistence_landscape l2 
)
friend

Function to compute inner (scalar) product of two landscapes.

◆ compute_max_norm_distance_of_landscapes

double compute_max_norm_distance_of_landscapes ( const Persistence_landscape first,
const Persistence_landscape second 
)
friend

Computations of \(L^{\infty}\) distance between two landscapes.

◆ operator* [1/2]

Persistence_landscape operator* ( const Persistence_landscape first,
double  con 
)
friend

An operator * that allows multiplication of a landscape by a real number.

◆ operator* [2/2]

Persistence_landscape operator* ( double  con,
const Persistence_landscape first 
)
friend

An operator * that allows multiplication of a landscape by a real number (order of parameters swapped).

◆ operator+

Persistence_landscape operator+ ( const Persistence_landscape first,
const Persistence_landscape second 
)
friend

An operator +, that compute sum of two landscapes.

◆ operator-

Persistence_landscape operator- ( const Persistence_landscape first,
const Persistence_landscape second 
)
friend

An operator -, that compute difference of two landscapes.

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
Persistence_landscape land 
)
friend

Writing landscape into a stream. A i-th level landscape starts with a string "lambda_i". Then the discontinuity points of the landscapes follows. Shall those points be joined with lines, we will obtain the i-th landscape function.

◆ subtract_two_landscapes

Persistence_landscape subtract_two_landscapes ( const Persistence_landscape land1,
const Persistence_landscape land2 
)
friend

A function that compute difference of two landscapes.


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