-
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
Rework simplex tree options #978
Merged
VincentRouvreau
merged 16 commits into
GUDHI:master
from
VincentRouvreau:rework_simplex_tree_options
Nov 20, 2023
Merged
Changes from 3 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5326b9a
Move simplex tree options in a separated header
VincentRouvreau c0d3d1b
Move simplex tree options in a separated header. No doc for Simplex_t…
VincentRouvreau f9c231e
Default (replacing full_feature as default), minimal and full_feature…
VincentRouvreau 99fc4dd
Merge branch 'master' into rework_simplex_tree_options
VincentRouvreau 8d2cf62
Merge remote-tracking branch 'upstream/master' into rework_simplex_tr…
VincentRouvreau 73e62bd
Fix simplex_tree_edge_expansion_unit_test after its merge
VincentRouvreau 9c6bdc2
code review: this was not part of a code review, but inspired from so…
VincentRouvreau ae70563
code review: custom simplex tree options for the cofaces access bench…
VincentRouvreau 69e7956
code review: More comments
VincentRouvreau 64cebe9
code review: Add some details on Simplex_tree_options_default
VincentRouvreau b534bcf
code review: activate stable simplex handles on full featured options
VincentRouvreau 0dea35e
Update src/Simplex_tree/include/gudhi/Simplex_tree/simplex_tree_optio…
VincentRouvreau 364fcd5
Merge branch 'rework_simplex_tree_options' of github.com:VincentRouvr…
VincentRouvreau 55f9f8e
code review: use Simplex_tree_interface instead of Simplex_tree<Simpl…
VincentRouvreau 0a82c1e
code review: rework comments about Simplex tree options
VincentRouvreau a6c5e0a
code review: remove insert_simplex_and_subfaces as not used and incom…
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 |
---|---|---|
|
@@ -8,28 +8,34 @@ | |
* - YYYY/MM Author: Description of the modification | ||
*/ | ||
|
||
/** \brief Concept of the template parameter for the class `Gudhi::Simplex_tree<SimplexTreeOptions>`. | ||
/** @brief Concept of the template parameter for the class `Gudhi::Simplex_tree<SimplexTreeOptions>`. | ||
* | ||
* One model for this is `Gudhi::Simplex_tree_options_full_featured`. If you want to provide your own, it is recommended that you derive from it and override some parts instead of writing a class from scratch. | ||
* A model for this is `Gudhi::Simplex_tree_options_full_featured` or `Gudhi::Simplex_tree_options_minimal`. | ||
* If you want to provide your own, it is recommended that you derive from it and override some parts instead of | ||
* writing a class from scratch. | ||
*/ | ||
struct SimplexTreeOptions { | ||
/// Forced for now. | ||
/** @brief Forced for now. */ | ||
typedef IndexingTag Indexing_tag; | ||
/// Must be a signed integer type. It admits a total order <. | ||
/** @brief Must be a signed integer type. It admits a total order <. */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not this PR, but at some point, for ourselves (not necessarily for users), it would be nice to have a comment explaining where such requirements ("signed") come from. |
||
typedef VertexHandle Vertex_handle; | ||
/// Must be comparable with operator<. | ||
/** @brief Must be comparable with operator<. */ | ||
typedef FiltrationValue Filtration_value; | ||
/// Must be an integer type. | ||
/** @brief Must be an integer type. */ | ||
typedef SimplexKey Simplex_key; | ||
/// If true, each simplex has extra storage for one `Simplex_key`. Necessary for `Persistent_cohomology`. | ||
/** @brief If true, each simplex has extra storage for one `Simplex_key`. Necessary for `Persistent_cohomology`. */ | ||
static const bool store_key; | ||
/// If true, each simplex has extra storage for one `Filtration_value`, and this value is propagated by operations like `Gudhi::Simplex_tree::expansion`. Without it, `Persistent_cohomology` degenerates to computing usual (non-persistent) cohomology. | ||
/** @brief If true, each simplex has extra storage for one `Filtration_value`, and this value is propagated by | ||
* operations like `Gudhi::Simplex_tree::expansion`. Without it, `Persistent_cohomology` degenerates to computing | ||
* usual (non-persistent) cohomology. | ||
*/ | ||
static const bool store_filtration; | ||
/// If true, the list of vertices present in the complex must always be 0, ..., num_vertices-1, without any hole. | ||
|
||
/** @brief If true, the list of vertices present in the complex must always be 0, ..., num_vertices-1, without any hole. */ | ||
static constexpr bool contiguous_vertices; | ||
/// If true, the lists of `Node` with same label are stored to enhance cofaces and stars access. | ||
/** @brief If true, the lists of `Node` with same label are stored to enhance cofaces and stars access. */ | ||
static const bool link_nodes_by_label; | ||
/// If true, Simplex_handle will not be invalidated after insertions or removals. | ||
/** @brief If true, Simplex_handle will not be invalidated after insertions or removals. */ | ||
static const bool stable_simplex_handles; | ||
}; | ||
|
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
93 changes: 93 additions & 0 deletions
93
src/Simplex_tree/include/gudhi/Simplex_tree/simplex_tree_options.h
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,93 @@ | ||
/* 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): Vincent Rouvreau | ||
* | ||
* Copyright (C) 2023 Inria | ||
* | ||
* Modification(s): | ||
* - YYYY/MM Author: Description of the modification | ||
*/ | ||
|
||
#ifndef SIMPLEX_TREE_SIMPLEX_TREE_OPTIONS_H_ | ||
#define SIMPLEX_TREE_SIMPLEX_TREE_OPTIONS_H_ | ||
|
||
#include <gudhi/Simplex_tree/indexing_tag.h> | ||
|
||
#include <cstdint> | ||
|
||
namespace Gudhi { | ||
|
||
/** \addtogroup simplex_tree | ||
* Pre-defined options for the Simplex_tree. | ||
* @{ | ||
*/ | ||
|
||
/** Model of SimplexTreeOptions. | ||
* | ||
* Default options version of the Simplex_tree. */ | ||
struct Simplex_tree_options_default { | ||
typedef linear_indexing_tag Indexing_tag; | ||
typedef int Vertex_handle; | ||
typedef double Filtration_value; | ||
typedef std::uint32_t Simplex_key; | ||
static const bool store_key = true; | ||
static const bool store_filtration = true; | ||
static const bool contiguous_vertices = false; | ||
static const bool link_nodes_by_label = false; | ||
static const bool stable_simplex_handles = false; | ||
}; | ||
|
||
/** Model of SimplexTreeOptions. | ||
* | ||
* Maximum number of simplices to compute persistence is <CODE>std::numeric_limits<std::uint32_t>::max()</CODE> | ||
* (about 4 billions of simplices). */ | ||
mglisse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
struct Simplex_tree_options_full_featured { | ||
typedef linear_indexing_tag Indexing_tag; | ||
typedef int Vertex_handle; | ||
typedef double Filtration_value; | ||
typedef std::uint32_t Simplex_key; | ||
static const bool store_key = true; | ||
static const bool store_filtration = true; | ||
static const bool contiguous_vertices = false; | ||
static const bool link_nodes_by_label = true; | ||
static const bool stable_simplex_handles = false; | ||
mglisse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
/** Model of SimplexTreeOptions. | ||
* | ||
* Minimal version of the Simplex_tree. No filtration values are stored and it is impossible to compute persistence | ||
* with these options. */ | ||
struct Simplex_tree_options_minimal { | ||
typedef linear_indexing_tag Indexing_tag; | ||
typedef int Vertex_handle; | ||
typedef double Filtration_value; | ||
typedef std::uint32_t Simplex_key; | ||
mglisse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
static const bool store_key = false; | ||
static const bool store_filtration = false; | ||
static const bool contiguous_vertices = false; | ||
static const bool link_nodes_by_label = false; | ||
static const bool stable_simplex_handles = false; | ||
}; | ||
|
||
/** @private @brief Model of SimplexTreeOptions, faster than `Simplex_tree_options_full_featured` but note the unsafe | ||
VincentRouvreau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* `contiguous_vertices` option. | ||
* | ||
* Maximum number of simplices to compute persistence is <CODE>std::numeric_limits<std::uint32_t>::max()</CODE> | ||
* (about 4 billions of simplices). */ | ||
struct Simplex_tree_options_fast_persistence { | ||
typedef linear_indexing_tag Indexing_tag; | ||
typedef int Vertex_handle; | ||
typedef float Filtration_value; | ||
typedef std::uint32_t Simplex_key; | ||
static const bool store_key = true; | ||
static const bool store_filtration = true; | ||
static const bool contiguous_vertices = true; | ||
static const bool link_nodes_by_label = false; | ||
static const bool stable_simplex_handles = false; | ||
}; | ||
|
||
/** @}*/ // end addtogroup simplex_tree | ||
|
||
} // namespace Gudhi | ||
|
||
#endif // SIMPLEX_TREE_SIMPLEX_TREE_OPTIONS_H_ |
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
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
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.
I wonder if we should comment out that line (keep it but make it a comment), since this is the default.
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.
Or maybe we should not derive from any existing options and set all the options we need for this example.
Tell me your preference.
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.
No, in an example, deriving from something is good, that's what we want to recommend.
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.
Rephrase simplex tree options for this example on 0a82c1e