-
Notifications
You must be signed in to change notification settings - Fork 555
Expand file tree
/
Copy pathapprox1.cpp
More file actions
51 lines (47 loc) · 1.84 KB
/
Copy pathapprox1.cpp
File metadata and controls
51 lines (47 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************
* Copyright (c) 2022, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <approx.hpp>
#include <err_oneapi.hpp>
#include <kernel/approx1.hpp>
namespace arrayfire {
namespace oneapi {
template<typename Ty, typename Tp>
void approx1(Array<Ty> &yo, const Array<Ty> &yi, const Array<Tp> &xo,
const int xdim, const Tp &xi_beg, const Tp &xi_step,
const af_interp_type method, const float offGrid) {
switch (method) {
case AF_INTERP_NEAREST:
case AF_INTERP_LOWER:
kernel::approx1<Ty, Tp, 1>(yo, yi, xo, xdim, xi_beg, xi_step,
offGrid, method);
break;
case AF_INTERP_LINEAR:
case AF_INTERP_LINEAR_COSINE:
kernel::approx1<Ty, Tp, 2>(yo, yi, xo, xdim, xi_beg, xi_step,
offGrid, method);
break;
case AF_INTERP_CUBIC:
case AF_INTERP_CUBIC_SPLINE:
kernel::approx1<Ty, Tp, 3>(yo, yi, xo, xdim, xi_beg, xi_step,
offGrid, method);
break;
default: break;
}
}
#define INSTANTIATE(Ty, Tp) \
template void approx1<Ty, Tp>( \
Array<Ty> & yo, const Array<Ty> &yi, const Array<Tp> &xo, \
const int xdim, const Tp &xi_beg, const Tp &xi_step, \
const af_interp_type method, const float offGrid);
INSTANTIATE(float, float)
INSTANTIATE(double, double)
INSTANTIATE(cfloat, float)
INSTANTIATE(cdouble, double)
} // namespace oneapi
} // namespace arrayfire