Skip to content

Commit

Permalink
Merge pull request GUDHI#669 from hschreiber/persistence_matrix
Browse files Browse the repository at this point in the history
Persistence matrix module
  • Loading branch information
VincentRouvreau authored Jun 20, 2024
2 parents f6d9d3d + b2adaeb commit e4419b6
Show file tree
Hide file tree
Showing 87 changed files with 35,123 additions and 83 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ add_gudhi_module(Tangential_complex)
add_gudhi_module(Toplex_map)
add_gudhi_module(Witness_complex)
add_gudhi_module(Nerve_GIC)
add_gudhi_module(Persistence_matrix)

# Include module CMake subdirectories
# GUDHI_SUB_DIRECTORIES is managed in CMAKE_MODULE_PATH/GUDHI_modules.cmake
Expand Down
38 changes: 26 additions & 12 deletions biblio/bibliography.bib
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,19 @@ @article{de2004topological
% V
%-----------------------------
@inproceedings{vineyards,
author = {David Cohen-Steiner and
Herbert Edelsbrunner and
Dmitriy Morozov},
title = {Vines and vineyards by updating persistence in linear time},
booktitle = {Symposium on Computational Geometry},
year = {2006},
pages = {119-126},
ee = {http://doi.acm.org/10.1145/1137856.1137877},
bibsource = {DBLP, http://dblp.uni-trier.de},
url = {https://doi.org/10.1145/1137856.1137877}
}

@inproceedings{cavanna15visualizing,
author = {Nicholas J. Cavanna and Mahmoodreza Jahanseir and Donald R. Sheehy},
booktitle = {Proceedings of the 31st International Symposium on Computational Geometry},
Expand Down Expand Up @@ -768,6 +781,19 @@ @article{DBLP:journals/focm/CarlssonS10
url = {https://doi.org/10.1007/s10208-010-9066-0}
}

@inproceedings{zigzag,
author = {Cl{\'{e}}ment Maria and
Steve Y. Oudot},
title = {Zigzag Persistence via Reflections and Transpositions},
booktitle = {Proceedings of the Twenty-Sixth Annual {ACM-SIAM} Symposium on Discrete
Algorithms, {SODA} 2015, San Diego, CA, USA, January 4-6, 2015},
pages = {181--199},
publisher = {{SIAM}},
year = {2015},
url = {https://doi.org/10.1137/1.9781611973730.14},
doi = {10.1137/1.9781611973730.14}
}

%-----------------------------
% UNUSED
%-----------------------------
Expand Down Expand Up @@ -1279,18 +1305,6 @@ @article{rips2012
pdf = {http://hal.archives-ouvertes.fr/hal-00785072/PDF/2012-cgta-Rips.pdf}
}

@inproceedings{DBLP:conf/compgeom/Cohen-SteinerEM06,
author = {David Cohen-Steiner and
Herbert Edelsbrunner and
Dmitriy Morozov},
title = {Vines and vineyards by updating persistence in linear time},
booktitle = {Symposium on Computational Geometry},
year = {2006},
pages = {119-126},
ee = {http://doi.acm.org/10.1145/1137856.1137877},
bibsource = {DBLP, http://dblp.uni-trier.de}
}

@inproceedings{DBLP:conf/compgeom/CarlssonSM09,
author = {Gunnar E. Carlsson and
Vin de Silva and
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ add_gudhi_module(Tangential_complex)
add_gudhi_module(Toplex_map)
add_gudhi_module(Witness_complex)
add_gudhi_module(Nerve_GIC)
add_gudhi_module(Persistence_matrix)

# For "make doxygen" - Requires GUDHI_USER_VERSION_DIR to be set
set(GUDHI_USER_VERSION_DIR ${CMAKE_SOURCE_DIR})
Expand Down
140 changes: 140 additions & 0 deletions src/Persistence_matrix/concept/FieldOperators.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
* See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
* Author(s): Hannah Schreiber
*
* Copyright (C) 2024 Inria
*
* Modification(s):
* - YYYY/MM Author: Description of the modification
*/

/**
* @file FieldOperators.h
* @author Hannah Schreiber
* @brief Contains the concept for the matrix field operators.
*/

namespace Gudhi {
namespace persistence_matrix {

/**
* @ingroup persistence_matrix
*
* @brief Concept of the field operator classes needed for the class @ref Matrix.
*
* Implementations of this concept are @ref Gudhi::persistence_fields::Zp_field_operators,
* @ref Gudhi::persistence_fields::Z2_field_operators,
* @ref Gudhi::persistence_fields::Multi_field_operators and
* @ref Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics.
*/
class FieldOperators
{
public:
using element_type = unspecified; /**< Type for the elements in the field. */
using characteristic_type = unspecified; /**< Type for the field characteristic. */

/**
* @brief Default constructor. If a non-zero characteristic is given, initializes the field with it.
* The characteristic can later be changed again or initialized with @ref set_characteristic.
*
* @param characteristic Prime number corresponding to the desired characteristic of the field.
*/
FieldOperators(characteristic_type characteristic = 0);

/**
* @brief Sets the characteristic of the field. Can eventually be omitted if the characteristic of the class
* is fixed.
*
* @param characteristic Prime number corresponding to the desired characteristic of the field.
*/
void set_characteristic(const characteristic_type& characteristic);
/**
* @brief Returns the current characteristic.
*
* @return The value of the current characteristic.
*/
const characteristic_type& get_characteristic() const;

/**
* @brief Returns the value of an integer in the field.
* That is the positive value of the integer modulo the current characteristic.
*
* @tparam Integer_type A native integer type: int, unsigned int, long int, bool, etc.
* @param e Integer to return the value from.
* @return @p e modulo the current characteristic, such that the result is positive.
*/
template <typename Integer_type>
element_type get_value(Integer_type e) const;

// void get_value(element_type& e) const;

/**
* @brief Stores in the first element the sum of two given elements in the field, that is
* `(e1 + e2) % characteristic`, such that the result is positive.
*
* @param e1 First element.
* @param e2 Second element.
*/
void add_inplace(element_type& e1, const element_type& e2) const;

/**
* @brief Stores in the first element the multiplication of two given elements in the field,
* that is `(e1 * e2) % characteristic`, such that the result is positive.
*
* @param e1 First element.
* @param e2 Second element.
*/
void multiply_inplace(element_type& e1, const element_type& e2) const;

/**
* @brief Multiplies the first element with the second one and adds the third one, that is
* `(e * m + a) % characteristic`, such that the result is positive. Stores the result in the first element.
*
* @param e First element.
* @param m Second element.
* @param a Third element.
*/
void multiply_and_add_inplace_front(element_type& e, const element_type& m, const element_type& a) const;
/**
* @brief Multiplies the first element with the second one and adds the third one, that is
* `(e * m + a) % characteristic`, such that the result is positive. Stores the result in the third element.
*
* @param e First element.
* @param m Second element.
* @param a Third element.
*/
void multiply_and_add_inplace_back(const element_type& e, const element_type& m, element_type& a) const;

/**
* @brief Returns the inverse of the given element in the field.
*
* @param e Element to get the inverse from.
* @return Inverse in the current field of `e % characteristic`.
*/
element_type get_inverse(const element_type& e) const;

/**
* @brief Returns the additive identity of the field.
*
* @return The additive identity of the field.
*/
static const element_type& get_additive_identity();
/**
* @brief Returns the multiplicative identity of the field.
*
* @return The multiplicative identity of the field.
*/
static const element_type& get_multiplicative_identity();

/**
* @brief Assign operator.
*/
FieldOperators& operator=(FieldOperators other);
/**
* @brief Swap operator.
*/
friend void swap(FieldOperators& f1, FieldOperators& f2);
};

} // namespace persistence_matrix
} // namespace Gudhi
Loading

0 comments on commit e4419b6

Please sign in to comment.