feat(f3dock-nfft): add FastGaussianSum wrapper library with direct-evaluator reference (Phase 5 task 2)#32
Merged
Conversation
…aluator reference (Phase 5 task 2) Adds a new static library 3dock-nfft exposing 3dock::nfft::FastGaussianSum, a thin wrapper that evaluates a 3D Gaussian sum f(y_j) = sum_k alpha_k * exp(-c * |y_j - x_k|^2). The wrapper has two evaluation paths: * evaluate_direct(out) -- always-available O(N*M) reference loop. Used as ground truth in unit tests. * evaluate(out) -- selects the NFFT3 fastsum fast path when is_accelerated() returns true; otherwise delegates to the direct evaluator. The NFFT3 hookup is intentionally a no-op fallback in this PR (so the library compiles and runs identically on every platform in the CI matrix) and lands in a follow-up patch once libnfft3 is available in CI. This is the building block that Phase 5 task 3 will route the F2Dock electrostatics gridding through under the fftAccelerate opt-in flag landed in PR #31. Build / test plumbing: * src/f3dock-nfft/CMakeLists.txt builds the static library and links the optional 3dock_science_stack INTERFACE target when present, so F2DOCK_HAVE_NFFT (and any related include/link plumbing) propagates automatically once libnfft3 is discovered. * Library is built under the existing F2DOCK_ENABLE_F3DOCK_EXPERIMENTAL gate alongside 3dock-domain/3dock-flex/3dock-icp/3dock-loop-closure. * 7 new gtest cases in ests/unit/test_f3dock_nfft_fast_gaussian_sum.cpp lock in: constructor validation (positive c, non-null sources), direct evaluator vs a hand-written reference, evaluate()=evaluate_direct() bit-for-bit when unaccelerated, single-point identity bound, empty-source short-circuit, and inspector accessors. Verification: 197/197 unit tests pass; clang-format-18 --Werror clean.
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.
Summary
Adds a new static library
f3dock-nfftexposingf3dock::nfft::FastGaussianSum, a thin wrapper that evaluates a 3D Gaussian sumat a batch of target points
{y_j}. This is the building block that Phase 5 task 3 will route the F2Dock electrostatics gridding through under thenfftAccelerateopt-in flag landed in #31.Two evaluation paths
evaluate_direct(out)— always-available O(N*M) reference loop. Used as ground truth in unit tests.evaluate(out)— selects the NFFT3 fastsum fast path whenis_accelerated()returns true; otherwise delegates to the direct evaluator. The NFFT3 hookup is intentionally a no-op fallback in this PR (so the library compiles and runs identically on every platform in the CI matrix) and lands in a follow-up patch once libnfft3 is available in CI.Build / test plumbing
src/f3dock-nfft/CMakeLists.txtbuilds the static library and links the optionalf3dock_science_stackINTERFACE target when present, soF2DOCK_HAVE_NFFT(and any related include/link plumbing) propagates automatically once libnfft3 is discovered.F2DOCK_ENABLE_F3DOCK_EXPERIMENTALgate alongsidef3dock-domain/f3dock-flex/f3dock-icp/f3dock-loop-closure.tests/unit/test_f3dock_nfft_fast_gaussian_sum.cpplock in:c, non-null sources)evaluate()==evaluate_direct()bit-for-bit when unacceleratedVerification
cmake --build— green on WSL Ubuntu-24.04 / gcc-13clang-format-18 --WerrorcleanFollow-ups
FastGaussianSuminto the electrostatics gridding path insrc/fft-utils/fastfft.cpp::gridding()under thenfftAccelerateswitch; add integration smoke baseline.evaluate()(requires libnfft3 in CI runners).