-
Notifications
You must be signed in to change notification settings - Fork 67
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 expansion_with_blockers python interface #389
Simplex tree expansion_with_blockers python interface #389
Conversation
src/python/gudhi/simplex_tree.pxd
Outdated
@@ -66,6 +66,9 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": | |||
vector[Simplex_tree_simplex_handle].const_iterator get_filtration_iterator_end() nogil | |||
Simplex_tree_skeleton_iterator get_skeleton_iterator_begin(int dimension) nogil | |||
Simplex_tree_skeleton_iterator get_skeleton_iterator_end(int dimension) nogil | |||
# Expansion with blockers | |||
ctypedef bool (*blocker_func)(vector[int], void *user_data) |
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.
Please don't use blocker_func both as a type here and as the name of a variable in another file. Maybe add _t
for the type?
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.
Renamed on f4f5992
src/python/gudhi/simplex_tree.pyx
Outdated
otherwise it is kept. The algorithm then proceeds with the next candidate. | ||
|
||
Note that you cannot update the filtration value of the simplex during the evaluation of `blocker_func`, as it | ||
would segfault. |
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.
The C++ version allows that, it would be good to understand what is going wrong here.
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 guess this paragraph is now wrong?
The C++ doc has a warning about phantom simplices that should also be in the python doc.
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.
src/python/gudhi/simplex_tree.pyx
Outdated
:param max_dim: Expansion maximal dimension value. | ||
:type max_dim: int | ||
:param blocker_func: Blocker oracle. | ||
:type blocker_func: Its concept is `Boolean blocker_func(list of int)` |
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.
:type blocker_func: Callable[[List[int]], bool]
according to https://docs.python.org/3/library/typing.html#callable
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.
Done on f4f5992
This comment was marked as resolved.
This comment was marked as resolved.
Is it because |
Nice ! Thanks ! It has been done on d114eaf |
This is a prototype based on https://github.com/cython/cython/tree/master/Demos/callback