Fix Student's T kernel formula sign error in tdist() - #593
Merged
Conversation
The tdist() function had a double-negative that caused strength to increase with distance instead of decrease: return max / pow(base, -(nu + 1.0) / 2.0); // wrong: dividing by negative exp Fixed to: return max * pow(base, -(nu + 1.0) / 2.0); // correct: multiply by negative exp This bug caused the Student's T spatial kernel to produce physically nonsensical results where interaction strength exceeded fmax at non-zero distances.
Collaborator
Contributor
|
This will also make it significantly faster, since multiplication is much faster than division. Maybe this is why you saw such a large speedup for Student's T in your benchmarking, @andrewkern! Your SIMD code was doing multiplication but the original code was (incorrectly) doing division? :-O |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes double-negative in exponent causing strength to increase with distance:
Closes #591
Also should resolve CI test failures in #592