Skip to content

Commit 95ba004

Browse files
committed
Fix ES kernel for ns=2 sigma=2
1 parent 53d2599 commit 95ba004

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

src/finufft_core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,8 @@ template<typename TF> void FINUFFT_PLAN_T<TF>::precompute_horner_coeffs() {
569569
// coeffs[0] is highest degree.
570570
int used = 0;
571571
for (size_t k = 0; k < coeffs.size(); ++k) {
572-
if (std::abs(coeffs[k]) >= tol * 0.50) { // divide tol by 5 otherwise it fails in
573-
// some cases
572+
if (std::abs(coeffs[k]) >= tol * 0.5) { // divide tol by 2 otherwise it fails in
573+
// some cases
574574
used = static_cast<int>(coeffs.size() - k);
575575
break;
576576
}

src/spreadinterp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,6 +2057,8 @@ int setup_spreader(finufft_spread_opts &opts, T eps, double upsampfac, int kerev
20572057
}
20582058
// Compute ns (kernel width) using central helper; caller handles clipping.
20592059
ns = compute_kernel_ns(upsampfac, (double)eps, kernel_type, opts);
2060+
// ns == 2 breaks for float with upsampfact = 2.00
2061+
if (std::is_same_v<T, float> && upsampfac == 2.00) ns = std::max(ns, 3);
20602062
if (ns > MAX_NSPREAD) {
20612063
// clip to fit allocated arrays, Horner rules
20622064
if (showwarn)

test/CMakeLists.txt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,7 @@ if(NOT FINUFFT_USE_DUCC0 AND FINUFFT_USE_OPENMP)
4646
endif()
4747

4848
# Add ctest definitions that run at both precisions...
49-
function(
50-
add_tests_with_prec
51-
PREC
52-
REQ_TOL
53-
CHECK_TOL
54-
SUFFIX
55-
MAX_DIGITS
56-
)
49+
function(add_tests_with_prec PREC REQ_TOL CHECK_TOL SUFFIX)
5750
# All of the following should be run at OMP_NUM_THREADS=4 or something small,
5851
# as in makefile. This prevents them taking a huge time on a, say, 128-core
5952
# Rome node. ... but I don't know platform-indep way to do that! Does anyone?
@@ -111,5 +104,5 @@ endfunction()
111104

112105
# use above function to actually add the tests, with certain requested and check
113106
# tols
114-
add_tests_with_prec(float 1e-5 2e-4 f 5)
115-
add_tests_with_prec(double 1e-12 1e-11 "" 15)
107+
add_tests_with_prec(float 1e-5 2e-4 f)
108+
add_tests_with_prec(double 1e-12 1e-11 "")

0 commit comments

Comments
 (0)