-
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
Rework simplex tree options #978
Conversation
…ree_options_fast_persistence. Specific Simplex_tree_options_for_python for Python. Rename Simplex_tree_interface_full_featured with Simplex_tree_python_interface
…d. Some documentation fix
* how to save on storage by not storing a filtration value. */ | ||
|
||
struct MyOptions : Gudhi::Simplex_tree_options_full_featured { | ||
struct MyOptions : Gudhi::Simplex_tree_options_minimal { | ||
// Implicitly use 0 as filtration value for all simplices | ||
static const bool store_filtration = false; |
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
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 comment
The 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.
src/Simplex_tree/include/gudhi/Simplex_tree/simplex_tree_options.h
Outdated
Show resolved
Hide resolved
src/Simplex_tree/include/gudhi/Simplex_tree/simplex_tree_options.h
Outdated
Show resolved
Hide resolved
src/Simplex_tree/test/simplex_tree_make_filtration_non_decreasing_unit_test.cpp
Show resolved
Hide resolved
@@ -47,11 +47,11 @@ class Euclidean_witness_complex_interface { | |||
delete witness_complex_; | |||
} | |||
|
|||
void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square, std::size_t limit_dimension) { | |||
void create_simplex_tree(Simplex_tree<Simplex_tree_options_for_python>* simplex_tree, double max_alpha_square, std::size_t limit_dimension) { |
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.
Is there a reason not to use Simplex_tree_interface
here (and related places)?
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.
…me points of the code review
…ns.h Co-authored-by: Marc Glisse <[email protected]>
…eau/gudhi-devel into rework_simplex_tree_options
…ex_tree_options_for_python>
@@ -47,11 +47,11 @@ class Euclidean_witness_complex_interface { | |||
delete witness_complex_; | |||
} | |||
|
|||
void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square, std::size_t limit_dimension) { | |||
void create_simplex_tree(Simplex_tree<Simplex_tree_options_for_python>* simplex_tree, double max_alpha_square, std::size_t limit_dimension) { |
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.
void create_simplex_tree(Simplex_tree<>* simplex_tree) { | ||
tangential_complex_->create_complex<Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_full_featured>>(*simplex_tree); | ||
void create_simplex_tree(Simplex_tree<Simplex_tree_options_for_python>* simplex_tree) { | ||
tangential_complex_->create_complex<Simplex_tree<Simplex_tree_options_for_python>>(*simplex_tree); |
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.
tangential_complex_->create_complex<Simplex_tree<Simplex_tree_options_for_python>>(*simplex_tree); | |
tangential_complex_->create_complex<Simplex_tree_interface>(*simplex_tree); |
Here, when it calls insert_simplex_and_subfaces
, it calls the method from Simplex_tree_interface and it fails because it is not returning the type required by tangential complex
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.
So the issue is that Simplex_tree_interface::insert_simplex_and_subfaces
overrides the functions of the base class but has an incompatible API? Shouldn't we rename that function so it does not clash with the one in the base class then?
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.
Actually, that function does not seem to be used anywhere, can't we remove it?
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.
Oh, ok ! That should be some dead code. I removed it and now my suggestion is possible on a6c5e0a
…patible API that was blocking tangential_complex create_complex method
@hschreiber @mglisse Some benchmarks to decide what options we do activate for the Python interface
|
For |
Yes, |
A possibility, which is not headache-free, is to have both in the same simplextree : as the current python interface only stores the simplextree c++ pointer, we just need to add a private member in the python simplextree class, telling by run time how to reinterpret_cast the simplextree in c++. This may cost another python call for each method, but it should be fine. To avoid confusion of python users, it might also be useful to define This can also apply to PR #976 . |
A search in the issues and gudhi-users finds surprisingly little. I know some people have used cofaces on examples small enough that they did not care about performance. The few cases I remember where people cared about the speed of cofaces were for C++.
So essentially a For multi-persistence, while it still seems possible, my first reaction without thinking much about it is that the interfaces are likely to differ enough that a separate Python class makes more sense. |
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.
We will need to say something in the release notes about it.
Ok, I will propose something |
Fix #905