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

Simplex tree ctors with data #1151

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

Conversation

VincentRouvreau
Copy link
Contributor

@VincentRouvreau VincentRouvreau commented Nov 7, 2024

rec_copy can copy or not simplex_data.
Some documentation and tests to explain when data are copied or not.
Fix #1127

Copy link
Collaborator

@hschreiber hschreiber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it wanted that the non assigned data seems to take a random value ? For unit test "simplex_data", the output is:

(2 1 0 ) filtration=0 - data='4'
(1 0 ) filtration=0 - data='5'
(2 0 ) filtration=0 - data='43808336'
(0 ) filtration=0 - data='2'
(2 1 ) filtration=0 - data='43808304'
(1 ) filtration=0 - data='43808304'
(2 ) filtration=0 - data='43808304'

Data is of type int and only 4 and 5 were assigned.

src/Simplex_tree/include/gudhi/Simplex_tree.h Outdated Show resolved Hide resolved
src/Simplex_tree/include/gudhi/Simplex_tree.h Outdated Show resolved Hide resolved
src/Simplex_tree/include/gudhi/Simplex_tree.h Outdated Show resolved Hide resolved
VincentRouvreau and others added 3 commits November 14, 2024 08:55
Co-authored-by: hschreiber <[email protected]>
Co-authored-by: hschreiber <[email protected]>
Co-authored-by: hschreiber <[email protected]>
@VincentRouvreau
Copy link
Contributor Author

Is it wanted that the non assigned data seems to take a random value ? For unit test "simplex_data", the output is:

(2 1 0 ) filtration=0 - data='4'
(1 0 ) filtration=0 - data='5'
(2 0 ) filtration=0 - data='43808336'
(0 ) filtration=0 - data='2'
(2 1 ) filtration=0 - data='43808304'
(1 ) filtration=0 - data='43808304'
(2 ) filtration=0 - data='43808304'

Data is of type int and only 4 and 5 were assigned.

It is the behaviour we want. We do not say it, but data are not initialized with a default value, that would take time. It is up to the user to deal with it.

@mglisse
Copy link
Member

mglisse commented Jan 19, 2025

We do not say it, but data are not initialized with a default value

If it was enough to disturb @hschreiber , maybe we should be explicit in the doc that this gets a default-initialization, and remind people that for scalars this may mean an indeterminate value.

Or we could change to value-initialize, I guess the main case where this could make a difference is if Simplex_data is a class that contains a large array of scalars, I don't know how likely that is.

(I haven't looked at the code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Additionnal data in Simplex_tree are not copied
3 participants