rs-station / reciprocalspaceship

Tools for exploring reciprocal space
https://rs-station.github.io/reciprocalspaceship/
MIT License
29 stars 13 forks source link

Use einsum in weighted_pearsonr #246

Closed kmdalton closed 8 months ago

kmdalton commented 8 months ago

This PR just optimizes rs.utils.weighted_pearsonr by replacing sequential multiplication and summation with np.einsum. This allows numpy to calculate r faster and with less memory.