mdanalysis
mdanalysis copied to clipboard
Fast cythonized inverse array of unsorted, unique indices
Is your feature request related to a problem?
PR #3368 creates an inverse index array of unsorted indices with this Python loop:
mask = np.zeros_like(self.ix)
for i, x in enumerate(indices):
values = np.where(self.ix == x)[0]
mask[values] = i
self._unique_restore_mask = mask
Describe the solution you'd like
This could be done very easily and much faster in Cython instead, in the lib module.
Describe alternatives you've considered
Additional context
Hey, I am new to open source so it would be great if I can help to solve this issue.
@SanjanaSogimatt please do go ahead and open up a PR with code to solve this issue.
Hey actually I'm new to open source. Can you give me some suggestions on how to get started? It would be really a great help
@SanjanaSogimatt please have a look at our userguide on contributing to MDAnalysis: https://userguide.mdanalysis.org/stable/contributing.html
If you open up a pull request which addresses this issue we can guide you through the process of merging your code into our codebase.
I added a comment elaborating on this problem here: https://github.com/MDAnalysis/mdanalysis/pull/3433#issuecomment-940087191