-
Notifications
You must be signed in to change notification settings - Fork 66
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
VincentRouvreau
merged 156 commits into
GUDHI:master
from
hschreiber:persistence_matrix
Jun 20, 2024
Merged
Changes from all commits
Commits
Show all changes
156 commits
Select commit
Hold shift + click to select a range
e9f962e
initialization
hschreiber 0183294
initialization
hschreiber 9a9f9d2
options
hschreiber 4097390
options
hschreiber b78092f
options
hschreiber 33f866d
base matrix
hschreiber dcde95a
matrices
hschreiber cc39397
matrices
hschreiber 9a4fb46
matrices
hschreiber f04174c
matrices
hschreiber 7172a77
debug
hschreiber e006851
debug compilation
hschreiber e956f40
cleanup
hschreiber 8c5f2e3
compilation error correction + simple compilation test in examples
hschreiber 7dfe4c2
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 94f5932
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber be3e43d
fixed shadowing names
hschreiber 5cf74ff
made optional method accessible + skeleton of overlay classes
hschreiber ddb1fc6
overlay for indexation
hschreiber 5ea389f
unit test for field classes and common methods of matrices
hschreiber 0edbec4
unit test for specialized matrix methods
hschreiber af6f889
deleting temporary compilation test
hschreiber bebe370
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber b08b513
Merge branch 'persistence_matrix' of github.com:hschreiber/gudhi-deve…
hschreiber f9b65e2
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 46c9125
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 6b0dc90
Merge branch 'persistence_matrix' of github.com:hschreiber/gudhi-deve…
hschreiber 3390def
hide friends and correction of swap calls
hschreiber 0b6e5cc
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 5b5cecd
addition of const keyword when possible
hschreiber c357fd3
removal of unnecessary at() and correction of template lock for row c…
hschreiber 2067468
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber b31b890
columns unit tests
hschreiber 855989d
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber edd19bb
reorganisation of columns to fit row access + chain matrices without …
hschreiber 7b609af
boundary matrix with row access
hschreiber 6213cdd
add reverse iterator to columns
hschreiber e0afba3
add column compression + bug fix
hschreiber e1242d0
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 8fc37b6
compressed columns, adapting to cohomology + multi fields
hschreiber cf4d5f2
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 52c84a5
compression fixes
hschreiber f168500
Merge branch 'persistence_matrix' of github.com:hschreiber/gudhi-deve…
hschreiber e61aa09
wrong file removed
hschreiber 24bcef9
Merge branch 'GUDHI:master' into zigzag_persistence
hschreiber 5409368
cleanup maria's version
hschreiber ea0f4ce
cleanup maria's version
hschreiber 14c9375
Merge branch 'zigzag_persistence' of github.com:hschreiber/gudhi-deve…
hschreiber 2d50466
add unit tests
hschreiber b49007d
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 09ba636
comparision tests
hschreiber 8d81c1d
merge with persistence matrix
hschreiber beea4c7
benchmark tests
hschreiber 94307f3
small optimizations
hschreiber 44d92ca
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 99d01e5
merge last gudhi-devel version
hschreiber 5f22c97
Merge remote-tracking branch 'origin/simplex_tree_zigzag_option' into…
hschreiber 2c28d31
Merge remote-tracking branch 'origin/zigzag_persistence' into persist…
hschreiber a1c4cf9
removal of unnecessary files from last merge
hschreiber 1cb32c4
corrections after merge
hschreiber 4ea35f7
return essential cycles instead of passing by argument for chain matr…
hschreiber 52401ad
include fix
hschreiber 8efbe4f
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber a361c93
rollback of simplex tree after merge
hschreiber fe5bac6
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber a807dbb
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber cb77fef
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber a0cdfea
factorization of base, boundary matrices
hschreiber 8745194
RU factorization
hschreiber 0e2086b
factorization of chain matrices
hschreiber 6408c8e
cell factorization
hschreiber cc168c2
small cleanups and revamp of column row access
hschreiber bd9234d
removal of child pointer + factorization of intrusive list column
hschreiber 76fc0ba
factorized intrusive set, set and list column
hschreiber 97cc289
factorize unordered_set and vector columns
hschreiber 5e3a5fe
factorization of heap column + make it work for Zp
hschreiber 03a35dd
clean up
hschreiber f575b7a
move overlays
hschreiber 06a9a19
clean up
hschreiber bcbcd78
clean up
hschreiber 71041a1
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 4f3ad65
clean up
hschreiber 07c193d
clean up
hschreiber 080b848
fixes
hschreiber 03c8c7a
updated unit tests v1 (compilation time has to be shortened)
hschreiber 16d271e
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 840a6e7
file rename fix
hschreiber 2ddf03e
small compile fixes
hschreiber 8817950
unit tests v2 (still not definitive, some tests are still too long, b…
hschreiber 750da6e
add possibility to give dimension for insert_boundary in case of a ce…
hschreiber e3bef46
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber d02e1ce
RU vine fix
hschreiber cf880bf
chain swap bug fix
hschreiber 499972c
small fixes
hschreiber 865e396
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber a6aace5
fix for removal and indexation
hschreiber c25ca91
adaptation of the indexation options. But now, unit tests for id chai…
hschreiber e39f82e
change of zp operators such that the matrices do not have to share th…
hschreiber b63a801
small fixes
hschreiber 58d019b
pushing up cell constructor to matrix level instead of static in columns
hschreiber 5394c26
small fixes and faster barcodes for boundary matrix
hschreiber bd7652e
boundary reduction
hschreiber 01e8597
doc
hschreiber 6a2d218
small bug fix
hschreiber 2f79f29
doc
hschreiber 65bf22b
doc
hschreiber 6f54642
doc
hschreiber 353929a
doc
hschreiber 65aa77b
doc
hschreiber cd1b83a
compilation fix for heap_column
hschreiber 1a9349f
doc
hschreiber cf41344
doc
hschreiber 016889a
doc + warning fix
hschreiber 1f90ba0
doc
hschreiber 308b3a9
doc
hschreiber e05b106
doc + revisting fields
hschreiber 86b46a2
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber c278d12
examples
hschreiber 9a64c20
change pointer to std::function to store also lambda function in chai…
hschreiber aca2e02
vineyard fix
hschreiber c82ec26
std::unordered_set to boost unordered set
hschreiber 8305da1
reworking of submatrix and column interfaces to allow better specific…
hschreiber 02f6697
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber a95f33d
small fixes for Unordered_set_column
hschreiber 3e51f8e
merge with upstream gudhi-devel
hschreiber 9d91ea5
change of == operator for unordered set columns
hschreiber b8d6c3d
doc fix + change of multiply_and_add method name to separate the two …
hschreiber 07efd10
doc fix + small fixes in heap and vector column
hschreiber 6299b92
replacing field operations with inplace operations
hschreiber 3a006fa
change of addition strategy in Unordered_set_column
hschreiber 1833eac
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber f998d70
correction of hash method for Unordered_set_column
hschreiber 45376f6
rename erase_row to erase_empty_row
hschreiber 3773d2c
replaces assert with GUDHI_CHECK
hschreiber f64342e
Doc update for examples
hschreiber a86f72e
small changes
hschreiber abb93a6
few optimisations for zp
hschreiber 55d17e5
factorization for better readability
hschreiber 5bf1b6d
correction for column hash method
hschreiber f131e31
heap hash method correction
hschreiber 6e886a3
doc correction
hschreiber c207e6e
change of default dummy value for field characteristic and simplifica…
hschreiber 8b10f70
change of heap column == and > operators
hschreiber d3dc1b4
test cleanup
hschreiber 2249aca
fix CI compilation problem?
hschreiber 1cbec06
reduces default unit tests to less than 30s each
hschreiber 28ef360
include multifields only when gmpxx gound
hschreiber 79d2172
reduces the number of unit tests done for the matrices by default
hschreiber 0c8e7f5
fix CI compilation problem?
hschreiber b9424b7
fix is_non_zero()
hschreiber cfee83d
fix gmp link error
hschreiber d802887
fix memory leaks in heap_column
hschreiber 8d77ab7
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber 656c70c
fix windows compilation and test error
hschreiber a971ddd
Merge branch 'GUDHI:master' into persistence_matrix
hschreiber b2adaeb
Rollback merge issue with submodule
VincentRouvreau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.