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

[Simplex tree] Generalization of filtration values in Simplex_tree #1122

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1966df2
add references for non arithemtic filtration values
hschreiber Aug 14, 2024
b760df2
generalization of filtration value operations
hschreiber Aug 19, 2024
b7269a8
doc
hschreiber Aug 19, 2024
70549af
small fixes
hschreiber Aug 19, 2024
0416788
include fix
hschreiber Aug 19, 2024
c4e04ca
include fix
hschreiber Aug 20, 2024
290de10
doc + bool return for unify_birth and push_to_smallest_common_upper_b…
hschreiber Aug 23, 2024
4d80e13
minor fix for prone_above_filtration + Filtration_value concept
hschreiber Aug 23, 2024
ddb7d20
add references in simplex tree even for arithmetic filtration values
hschreiber Aug 26, 2024
35778b2
Merge branch 'GUDHI:master' into simplex_tree_filtration_value_genera…
hschreiber Aug 27, 2024
9cc2e76
update of SimplexTreeOptions.h
hschreiber Sep 3, 2024
df5a510
XMerge branch 'simplex_tree_filtration_value_generalization' of githu…
hschreiber Sep 3, 2024
7555436
Merge branch 'GUDHI:master' into simplex_tree_filtration_value_genera…
hschreiber Sep 3, 2024
d07a6f1
move 'insert' of Sibling in Simplex_tree and use it
hschreiber Sep 3, 2024
78470f5
minor fixes
hschreiber Sep 16, 2024
6d837af
merge upstream
hschreiber Sep 16, 2024
413b6c1
NaN fix for prune_above_filtration
hschreiber Sep 16, 2024
da79b21
filtration value doc
hschreiber Sep 24, 2024
1495403
Merge branch 'GUDHI:master' into simplex_tree_filtration_value_genera…
hschreiber Oct 22, 2024
aec50c9
doc + minor changes
hschreiber Oct 22, 2024
369a965
doc
hschreiber Oct 22, 2024
c77ca28
Merge branch 'GUDHI:master' into simplex_tree_filtration_value_genera…
hschreiber Oct 25, 2024
1cf4ec7
change unify/intersect name + replaces bool with predicate in second …
hschreiber Oct 28, 2024
95210dc
doc
hschreiber Oct 28, 2024
af820c5
fix (de)serialization for general filtration values
hschreiber Oct 29, 2024
d92d698
Update src/Simplex_tree/include/gudhi/Simplex_tree.h
hschreiber Oct 29, 2024
9c2047f
doc
hschreiber Oct 29, 2024
e46325e
enable deserialization from a simplex tree with different filtration …
hschreiber Nov 7, 2024
bcdad85
doc
hschreiber Nov 13, 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
72 changes: 60 additions & 12 deletions src/Simplex_tree/concept/FiltrationValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,67 @@
* Copyright (C) 2014 Inria
*
* Modification(s):
* - 2024/08 Hannah Schreiber: Update of the concept after several additions to the Simplex tree.
* - YYYY/MM Author: Description of the modification
*/

/** \brief Value type for a filtration function on a cell complex.
*
* A <EM>filtration</EM> of a cell complex (see FilteredComplex) is
* a function \f$f:\mathbf{K} \rightarrow \mathbb{R}\f$ satisfying \f$f(\tau)\leq
* f(\sigma)\f$ whenever \f$\tau \subseteq \sigma\f$. Ordering the simplices
* by increasing filtration values (breaking ties so as a simplex appears after
* its subsimplices of same filtration value) provides an indexing scheme
* (see IndexingTag).
*/
struct FiltrationValue {
/** \brief Operator < is a StrictWeakOrdering. */
bool operator<(FiltrationValue f1, FiltrationValue f2);
};
*
VincentRouvreau marked this conversation as resolved.
Show resolved Hide resolved
* Needs to implement `std::numeric_limits<FiltrationValue>::has_infinity`,
* `std::numeric_limits<FiltrationValue>::infinity()` and `std::numeric_limits<FiltrationValue>::max()`.
* But when `std::numeric_limits<FiltrationValue>::has_infinity` returns `true`,
* `std::numeric_limits<FiltrationValue>::max()` can simply throw when called, as well as,
* `std::numeric_limits<FiltrationValue>::infinity()` if `std::numeric_limits<FiltrationValue>::has_infinity`
* returns `false`.
*
* A <EM>filtration</EM> of a cell complex (see FilteredComplex) is
* a function \f$f:\mathbf{K} \rightarrow \mathbb{R}\f$ satisfying \f$f(\tau)\leq
* f(\sigma)\f$ whenever \f$\tau \subseteq \sigma\f$. Ordering the simplices
* by increasing filtration values (breaking ties so as a simplex appears after
* its subsimplices of same filtration value) provides an indexing scheme
* (see IndexingTag).
*/
struct FiltrationValue {
Copy link
Member

Choose a reason for hiding this comment

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

I sometimes wonder if we should rename it to FiltrationValueForSimplexTree. But the name of concepts is not that important, it can always be changed later since it does not appear in users' 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.

If the concepts of FiltrationValue are not the same for other classes, it would make sense to rename it for the long run. But I have the feeling that for now, everything is more or less complying with the needs of the simplex tree, as it is mostly used as double.

/**
* @brief Has to construct the default value of FiltrationValue. E.g., 0 for a numerical value or {} for a vector.
*/
FiltrationValue();

// only for default ordering of filtration_vect_ in initialize_filtration and for prune_above_filtration
/**
* @brief Strictly smaller operator. If the filtration values are totally ordered, should be a StrictWeakOrdering.
*/
friend bool operator<(const FiltrationValue& f1, const FiltrationValue& f2);
/**
* @brief Equality operator
*/
friend bool operator==(const FiltrationValue& f1, const FiltrationValue& f2);
/**
* @brief Not equal operator
*/
friend bool operator!=(const FiltrationValue& f1, const FiltrationValue& f2);
hschreiber marked this conversation as resolved.
Show resolved Hide resolved

/**
* @brief Given two filtration values at which a simplex exists, returns the minimal union of births generating
* a lifetime including those two values. The overload for native arithmetic types like `double` or `int` is
* already implemented.
hschreiber marked this conversation as resolved.
Show resolved Hide resolved
*
* For a k-critical filtration, FiltrationValue should be able to store an union of values (corresponding to the
* different births of a same simplex) and this method adds the values of @p f2 in @p f1 and removes the values
* from @p f1 which are comparable and greater than other values.
* In the special case of 1-critical filtration, as the union should not contain more than one birth element,
* this method is expected to throw if the two given elements in the filtration values are not comparable.
* If they are comparable, the union is simply the minimum of both.
*
* @return True if and only if the values in @p f1 were actually modified.
*/
friend bool unify_births(FiltrationValue& f1, const FiltrationValue& f2);

/**
* @brief Given two filtration values, stores in the first value the greatest common upper bound of the two values.
hschreiber marked this conversation as resolved.
Show resolved Hide resolved
* The overload for native arithmetic types like `double` or `int` is already implemented.
*
* @return True if and only if the values in @p f1 were actually modified.
*/
friend bool push_to_smallest_common_upper_bound(FiltrationValue& f1, const FiltrationValue& f2);
};
2 changes: 1 addition & 1 deletion src/Simplex_tree/concept/SimplexTreeOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct SimplexTreeOptions {
typedef IndexingTag Indexing_tag;
/** @brief Must be a signed integer type. It admits a total order <. */
typedef VertexHandle Vertex_handle;
/** @brief Must be comparable with operator<. */
/** @brief Filtration value type which should implement the @ref FiltrationValue concept. */
hschreiber marked this conversation as resolved.
Show resolved Hide resolved
typedef FiltrationValue Filtration_value;
/** @brief Must be an integer type. */
typedef SimplexKey Simplex_key;
Expand Down
Loading
Loading