rs-station / reciprocalspaceship

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

Use einsum in weighted_pearsonr #246

Closed kmdalton closed 4 months ago

kmdalton commented 4 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.