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

what does the function kde! modify? #95

Closed
urlicht opened this issue Mar 25, 2023 · 1 comment
Closed

what does the function kde! modify? #95

urlicht opened this issue Mar 25, 2023 · 1 comment
Milestone

Comments

@urlicht
Copy link

urlicht commented Mar 25, 2023

By convention in Julia, a function that ends with ! modifies some of its input arguments.

It seems like kde! can be called with only the data for the estimation. Does the function modify the input data? If so, it'd be great to clarify on the usage case and give an option that doesn't modify the input data

@dehann
Copy link
Member

dehann commented Nov 17, 2023

Hi, yes ! is used in a sort of inverse way to indicate that the first argument (the data points) are used directly in the computation and not copied. The kde! function builds a rather intricate tree structure of the data. The use of ! here rather indicates that if the user changes the input data vector, then the data structure kde! built would no longer be valid.

If this is an issue, the recommended use would be:

P  = kde!(deepcopy(data))

@dehann dehann closed this as completed Nov 17, 2023
@dehann dehann added this to the v0.5.12 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants