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

Square root filtration values for alpha and delaunay-cech complex #1138

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

VincentRouvreau
Copy link
Contributor

@VincentRouvreau VincentRouvreau commented Oct 1, 2024

Fix #80 and #771

@VincentRouvreau VincentRouvreau added the enhancement New feature or request label Oct 1, 2024
@VincentRouvreau VincentRouvreau marked this pull request as ready for review October 14, 2024 16:05
Comment on lines +396 to +397
// For users to be able to define their own sqrt function on their desired Filtration_value type
using std::sqrt;
Copy link
Member

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";
Copy link
Member

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?

Comment on lines +85 to +87
if constexpr (square_root_filtrations)
filt = sqrt(filt);
complex.assign_filtration(sh, max(filt, Filtration_value(0)));
Copy link
Member

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.

Comment on lines +126 to +128
filt = sqrt(filt);
// maxf = filt except for rounding errors
maxf = max(maxf, filt);
Copy link
Member

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.
Copy link
Member

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Alpha_complex] new do_sqrt argument
2 participants