fast in r and turbo in c verisons of radius of gyration calculation #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @caesar0301 ,
I have made two faster versions of the radius of gyration function.
See below:
The results match with the original function, but are 100+ times faster. The C implementation is not only faster, but also consumes just a fraction of memory. This might make a difference when analyzing many trajectories.
I am making a draft PR, as I do not suggest to add these new functions in addition to the existing one, but to replace it.
Let me know if you like any of the implementations. I guess if your package already has C code, then it makes sense to use the C function as it is still a bit faster then the fully vectorized zero-dependency R function, and is also much more memory efficient.