-
Notifications
You must be signed in to change notification settings - Fork 65
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
Square root filtration values for alpha and delaunay-cech complex #1138
base: master
Are you sure you want to change the base?
Square root filtration values for alpha and delaunay-cech complex #1138
Conversation
…nay cech. Python hints for delaunay complex family
// For users to be able to define their own sqrt function on their desired Filtration_value type | ||
using std::sqrt; |
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.
You could also put it next to the single place where it is used, but it is ok here.
std::clog << "Alpha complex can be, or not, weighted (requires a file containing weights values).\n\n"; | ||
std::clog << "Weighted Alpha complex can have negative filtration values. If '-square-root-filtrations' is"; |
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.
Should we mention something like that in the documentation of Alpha_complex as well?
if constexpr (square_root_filtrations) | ||
filt = sqrt(filt); | ||
complex.assign_filtration(sh, max(filt, Filtration_value(0))); |
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 think it would be safer to do the max with 0 before the sqrt.
filt = sqrt(filt); | ||
// maxf = filt except for rounding errors | ||
maxf = max(maxf, filt); |
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 think there is a slight risk that a rounding error can make filt negative, with unpredictable results. It feels silly to use sqrt(max(filt,0))
, but I don't know if there is an easy way to avoid it. Well, maybe replacing max(maxf,filt)
by a hand-written comparison so we know what happens when filt is NaN, but it feels like a gratuitous use of NaN.
:param precision: Delaunay complex precision can be 'fast', 'safe' or 'exact'. Default is 'safe'. | ||
:type precision: string | ||
Args: | ||
points (Iterable[Iterable[float]]): A list of points in d-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.
Isn't the type redundant?
@@ -354,8 +355,10 @@ class Alpha_complex { | |||
* It also computes the filtration values accordingly to the \ref createcomplexalgorithm if default_filtration_value | |||
* is not set. | |||
* | |||
* \tparam square_root_filtrations If false (default value), it assigns to each simplex a filtration value equal to |
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.
(ignore the exact names I use here)
I wonder what is more natural between do_sqrt=true/false and output_squared_values=true/false. As the person writing the code, it is natural to ask if you should call sqrt. As the user... I am not sure, it might be the other one.
Fix #80 and #771