4namespace isce3 {
namespace cuda {
namespace core {
6template<
class Kernel,
typename T>
7CUDA_HOSTDEV
inline T interp1d(
const Kernel& kernel,
const T* x,
size_t length,
8 size_t stride,
double t,
bool periodic)
11 auto width =
static_cast<int>(std::ceil(kernel.width()));
12 auto i0 = (width % 2 == 0) ?
static_cast<long>(std::ceil(t))
13 :
static_cast<long>(std::round(t));
15 auto low = i0 - width / 2;
16 auto high = low + width;
18 if (not periodic and (low < 0 or high >= length)) {
22 using U =
typename std::common_type<typename Kernel::value_type, T>::type;
25 for (
auto i = low; i < high; ++i) {
26 auto j = (periodic) ? i % length : i;
27 double ti =
static_cast<double>(i) - t;
29 sum += w * x[j * stride];
32 return static_cast<T
>(sum);
CRTP base class for kernels.
Definition Kernels.h:19
base interpolator is an abstract base class
Definition BinarySearchFunc.cpp:5