mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

Fast cythonized inverse array of unsorted, unique indices

Open lilyminium opened this issue 4 years ago • 7 comments
trafficstars

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

lilyminium avatar Aug 15 '21 21:08 lilyminium

Hey, I am new to open source so it would be great if I can help to solve this issue.

SanjanaSogimatt avatar Oct 06 '21 15:10 SanjanaSogimatt

@SanjanaSogimatt please do go ahead and open up a PR with code to solve this issue.

IAlibay avatar Oct 06 '21 21:10 IAlibay

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 avatar Oct 09 '21 13:10 SanjanaSogimatt

@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.

IAlibay avatar Oct 09 '21 13:10 IAlibay

I added a comment elaborating on this problem here: https://github.com/MDAnalysis/mdanalysis/pull/3433#issuecomment-940087191

lilyminium avatar Oct 11 '21 14:10 lilyminium