Skip to content

Conversation

@andrewkern
Copy link
Collaborator

Fixes double-negative in exponent causing strength to increase with distance:

  // Before (wrong): dividing by negative exponent = multiplying by positive
  return max / pow(base, -(nu + 1.0) / 2.0);

  // After (correct)
  return max * pow(base, -(nu + 1.0) / 2.0);

Closes #591

Also should resolve CI test failures in #592

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.
@petrelharp
Copy link
Collaborator

Ack! Good catch. Inded:
Screenshot From 2025-12-17 09-43-22

@bhaller
Copy link
Contributor

bhaller commented Dec 17, 2025

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

@bhaller bhaller merged commit 78aabea into MesserLab:master Dec 17, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Student's T spatial kernel strength increases with distance instead of decreasing

3 participants