Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistence matrix module #669

Merged
merged 156 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
e9f962e
initialization
hschreiber Jun 22, 2022
0183294
initialization
hschreiber Jun 22, 2022
9a9f9d2
options
hschreiber Jun 24, 2022
4097390
options
hschreiber Jun 28, 2022
b78092f
options
hschreiber Jun 29, 2022
33f866d
base matrix
hschreiber Jul 1, 2022
dcde95a
matrices
hschreiber Jul 6, 2022
cc39397
matrices
hschreiber Jul 8, 2022
9a4fb46
matrices
hschreiber Jul 11, 2022
f04174c
matrices
hschreiber Jul 12, 2022
7172a77
debug
hschreiber Jul 13, 2022
e006851
debug compilation
hschreiber Jul 18, 2022
e956f40
cleanup
hschreiber Jul 19, 2022
8c5f2e3
compilation error correction + simple compilation test in examples
hschreiber Aug 9, 2022
7dfe4c2
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Aug 11, 2022
94f5932
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Aug 23, 2022
be3e43d
fixed shadowing names
hschreiber Sep 8, 2022
5cf74ff
made optional method accessible + skeleton of overlay classes
hschreiber Sep 15, 2022
ddb1fc6
overlay for indexation
hschreiber Sep 20, 2022
5ea389f
unit test for field classes and common methods of matrices
hschreiber Sep 26, 2022
0edbec4
unit test for specialized matrix methods
hschreiber Oct 6, 2022
af6f889
deleting temporary compilation test
hschreiber Oct 6, 2022
bebe370
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Oct 12, 2022
b08b513
Merge branch 'persistence_matrix' of github.com:hschreiber/gudhi-deve…
hschreiber Oct 12, 2022
f9b65e2
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Oct 18, 2022
46c9125
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Oct 18, 2022
6b0dc90
Merge branch 'persistence_matrix' of github.com:hschreiber/gudhi-deve…
hschreiber Oct 18, 2022
3390def
hide friends and correction of swap calls
hschreiber Oct 19, 2022
0b6e5cc
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Oct 19, 2022
5b5cecd
addition of const keyword when possible
hschreiber Oct 20, 2022
c357fd3
removal of unnecessary at() and correction of template lock for row c…
hschreiber Nov 8, 2022
2067468
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Nov 8, 2022
b31b890
columns unit tests
hschreiber Nov 15, 2022
855989d
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Dec 20, 2022
edd19bb
reorganisation of columns to fit row access + chain matrices without …
hschreiber Dec 21, 2022
7b609af
boundary matrix with row access
hschreiber Jan 3, 2023
6213cdd
add reverse iterator to columns
hschreiber Jan 4, 2023
e0afba3
add column compression + bug fix
hschreiber Jan 23, 2023
e1242d0
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Jan 23, 2023
8fc37b6
compressed columns, adapting to cohomology + multi fields
hschreiber Feb 9, 2023
cf4d5f2
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber May 10, 2023
52c84a5
compression fixes
hschreiber May 12, 2023
f168500
Merge branch 'persistence_matrix' of github.com:hschreiber/gudhi-deve…
hschreiber May 12, 2023
e61aa09
wrong file removed
hschreiber May 15, 2023
24bcef9
Merge branch 'GUDHI:master' into zigzag_persistence
hschreiber May 30, 2023
5409368
cleanup maria's version
hschreiber May 30, 2023
ea0f4ce
cleanup maria's version
hschreiber May 30, 2023
14c9375
Merge branch 'zigzag_persistence' of github.com:hschreiber/gudhi-deve…
hschreiber May 30, 2023
2d50466
add unit tests
hschreiber Jun 14, 2023
b49007d
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Jun 16, 2023
09ba636
comparision tests
hschreiber Jun 19, 2023
8d81c1d
merge with persistence matrix
hschreiber Jun 27, 2023
beea4c7
benchmark tests
hschreiber Jun 30, 2023
94307f3
small optimizations
hschreiber Jul 13, 2023
44d92ca
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Jul 13, 2023
99d01e5
merge last gudhi-devel version
hschreiber Jul 13, 2023
5f22c97
Merge remote-tracking branch 'origin/simplex_tree_zigzag_option' into…
hschreiber Jul 13, 2023
2c28d31
Merge remote-tracking branch 'origin/zigzag_persistence' into persist…
hschreiber Jul 13, 2023
a1c4cf9
removal of unnecessary files from last merge
hschreiber Jul 13, 2023
1cb32c4
corrections after merge
hschreiber Jul 17, 2023
4ea35f7
return essential cycles instead of passing by argument for chain matr…
hschreiber Jul 18, 2023
52401ad
include fix
hschreiber Jul 25, 2023
8efbe4f
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Aug 4, 2023
a361c93
rollback of simplex tree after merge
hschreiber Aug 21, 2023
fe5bac6
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Aug 21, 2023
a807dbb
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Aug 22, 2023
cb77fef
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Sep 1, 2023
a0cdfea
factorization of base, boundary matrices
hschreiber Sep 8, 2023
8745194
RU factorization
hschreiber Sep 11, 2023
0e2086b
factorization of chain matrices
hschreiber Sep 13, 2023
6408c8e
cell factorization
hschreiber Sep 14, 2023
cc168c2
small cleanups and revamp of column row access
hschreiber Sep 14, 2023
bd9234d
removal of child pointer + factorization of intrusive list column
hschreiber Sep 28, 2023
76fc0ba
factorized intrusive set, set and list column
hschreiber Oct 3, 2023
97cc289
factorize unordered_set and vector columns
hschreiber Oct 4, 2023
5e3a5fe
factorization of heap column + make it work for Zp
hschreiber Oct 5, 2023
03a35dd
clean up
hschreiber Oct 5, 2023
f575b7a
move overlays
hschreiber Oct 6, 2023
06a9a19
clean up
hschreiber Oct 6, 2023
bcbcd78
clean up
hschreiber Oct 6, 2023
71041a1
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Oct 6, 2023
4f3ad65
clean up
hschreiber Oct 6, 2023
07c193d
clean up
hschreiber Oct 6, 2023
080b848
fixes
hschreiber Nov 3, 2023
03c8c7a
updated unit tests v1 (compilation time has to be shortened)
hschreiber Nov 8, 2023
16d271e
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Nov 8, 2023
840a6e7
file rename fix
hschreiber Nov 8, 2023
2ddf03e
small compile fixes
hschreiber Nov 9, 2023
8817950
unit tests v2 (still not definitive, some tests are still too long, b…
hschreiber Nov 21, 2023
750da6e
add possibility to give dimension for insert_boundary in case of a ce…
hschreiber Nov 24, 2023
e3bef46
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Nov 24, 2023
d02e1ce
RU vine fix
hschreiber Dec 6, 2023
cf880bf
chain swap bug fix
hschreiber Jan 2, 2024
499972c
small fixes
hschreiber Jan 15, 2024
865e396
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Feb 16, 2024
a6aace5
fix for removal and indexation
hschreiber Feb 19, 2024
c25ca91
adaptation of the indexation options. But now, unit tests for id chai…
hschreiber Feb 19, 2024
e39f82e
change of zp operators such that the matrices do not have to share th…
hschreiber Feb 23, 2024
b63a801
small fixes
hschreiber Feb 29, 2024
58d019b
pushing up cell constructor to matrix level instead of static in columns
hschreiber Mar 4, 2024
5394c26
small fixes and faster barcodes for boundary matrix
hschreiber Mar 5, 2024
bd7652e
boundary reduction
hschreiber Mar 7, 2024
01e8597
doc
hschreiber Mar 8, 2024
6a2d218
small bug fix
hschreiber Mar 27, 2024
2f79f29
doc
hschreiber Mar 27, 2024
65bf22b
doc
hschreiber Apr 2, 2024
6f54642
doc
hschreiber Apr 3, 2024
353929a
doc
hschreiber Apr 4, 2024
65aa77b
doc
hschreiber Apr 5, 2024
cd1b83a
compilation fix for heap_column
hschreiber Apr 8, 2024
1a9349f
doc
hschreiber Apr 10, 2024
cf41344
doc
hschreiber Apr 10, 2024
016889a
doc + warning fix
hschreiber Apr 11, 2024
1f90ba0
doc
hschreiber Apr 12, 2024
308b3a9
doc
hschreiber Apr 15, 2024
e05b106
doc + revisting fields
hschreiber Apr 17, 2024
86b46a2
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Apr 17, 2024
c278d12
examples
hschreiber Apr 18, 2024
9a64c20
change pointer to std::function to store also lambda function in chai…
hschreiber Apr 18, 2024
aca2e02
vineyard fix
hschreiber Apr 19, 2024
c82ec26
std::unordered_set to boost unordered set
hschreiber May 16, 2024
8305da1
reworking of submatrix and column interfaces to allow better specific…
hschreiber May 21, 2024
02f6697
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber May 22, 2024
a95f33d
small fixes for Unordered_set_column
hschreiber May 22, 2024
3e51f8e
merge with upstream gudhi-devel
hschreiber May 27, 2024
9d91ea5
change of == operator for unordered set columns
hschreiber May 27, 2024
b8d6c3d
doc fix + change of multiply_and_add method name to separate the two …
hschreiber May 27, 2024
07efd10
doc fix + small fixes in heap and vector column
hschreiber May 27, 2024
6299b92
replacing field operations with inplace operations
hschreiber May 28, 2024
3a006fa
change of addition strategy in Unordered_set_column
hschreiber May 29, 2024
1833eac
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber May 29, 2024
f998d70
correction of hash method for Unordered_set_column
hschreiber May 30, 2024
45376f6
rename erase_row to erase_empty_row
hschreiber May 30, 2024
3773d2c
replaces assert with GUDHI_CHECK
hschreiber May 30, 2024
f64342e
Doc update for examples
hschreiber Jun 3, 2024
a86f72e
small changes
hschreiber Jun 3, 2024
abb93a6
few optimisations for zp
hschreiber Jun 5, 2024
55d17e5
factorization for better readability
hschreiber Jun 12, 2024
5bf1b6d
correction for column hash method
hschreiber Jun 12, 2024
f131e31
heap hash method correction
hschreiber Jun 12, 2024
6e886a3
doc correction
hschreiber Jun 12, 2024
c207e6e
change of default dummy value for field characteristic and simplifica…
hschreiber Jun 12, 2024
8b10f70
change of heap column == and > operators
hschreiber Jun 13, 2024
d3dc1b4
test cleanup
hschreiber Jun 13, 2024
2249aca
fix CI compilation problem?
hschreiber Jun 13, 2024
1cbec06
reduces default unit tests to less than 30s each
hschreiber Jun 13, 2024
28ef360
include multifields only when gmpxx gound
hschreiber Jun 14, 2024
79d2172
reduces the number of unit tests done for the matrices by default
hschreiber Jun 14, 2024
0c8e7f5
fix CI compilation problem?
hschreiber Jun 14, 2024
b9424b7
fix is_non_zero()
hschreiber Jun 14, 2024
cfee83d
fix gmp link error
hschreiber Jun 14, 2024
d802887
fix memory leaks in heap_column
hschreiber Jun 17, 2024
8d77ab7
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Jun 17, 2024
656c70c
fix windows compilation and test error
hschreiber Jun 19, 2024
a971ddd
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber Jun 20, 2024
b2adaeb
Rollback merge issue with submodule
VincentRouvreau Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks a bit strange to use 0 as a dummy value for the field characteristic, when a field of characteristic 0 is a perfectly well defined concept.
If I tried to add a field Q for Rationals, would the package just work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ask the characteristic to be a prime number, so it should never be 0, no ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it arbitrary and unnecessary to restrict to finite fields? Rationals are a field that should work just fine with the rest of the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I never had a use case using something else than those fields, so I never verified if everything will really work with arbitrary fields. But I guess that at least for the base matrices there shouldn't be a problem with it. So, do you suggest to initialize it to -1 instead? I don't remember a characteristic allowed to be negative.

* 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
Loading