GeoStat-Framework / GSTools-Core

A Rust implementation of the core algorithms of GSTools.
GNU Lesser General Public License v3.0
10 stars 0 forks source link

Fix double square root in computation of bandwidth distance. #12

Closed adamreichold closed 2 years ago

adamreichold commented 2 years ago

This slipped in when refactoring the variogram code is not detected by the current unit tests and I admittedly do not feel confident to write a regression test fixing it.

(As a performance aside, all these distances in the variogram module are used in comparisons. Hence, some of the square roots should be avoidable by squaring the other sides of these inequalities like bandwidth or lower_bin_edge. That squaring could also be done outside of the inner loops to further reduce costs.)

adamreichold commented 2 years ago

(As a performance aside, all these distances in the variogram module are used in comparisons. Hence, some of the square roots should be avoidable by squaring the other sides of these inequalities like bandwidth or lower_bin_edge. That squaring could also be done outside of the inner loops to further reduce costs.)

Actually, this is not really true as the angle computations needs the actual distance and Haversine distance does not loose any square roots like the Euclidean one does. So while this would probably make the common case a tiny bit faster, it makes the overall code more complex...