[arrayfire] 186/408: Moving general fft implementation to src/api/c

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:53 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit 822fd5a99057e3420226a3ca6566b22ff71d7b55
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Tue Aug 4 17:45:46 2015 -0400

    Moving general fft implementation to src/api/c
---
 src/api/c/fft.cpp          |  63 +++++++------------------
 src/api/c/fft_common.hpp   |  36 +++++++++++++++
 src/api/c/fftconvolve.cpp  |   8 ++--
 src/backend/cpu/fft.cpp    |  62 ++++---------------------
 src/backend/cpu/fft.hpp    |   6 ---
 src/backend/cuda/fft.cpp   |  66 ++++----------------------
 src/backend/cuda/fft.hpp   |   6 ---
 src/backend/opencl/fft.cpp | 113 +++++++++++++--------------------------------
 src/backend/opencl/fft.hpp |   6 ---
 9 files changed, 109 insertions(+), 257 deletions(-)

diff --git a/src/api/c/fft.cpp b/src/api/c/fft.cpp
index 9a2a4d0..1bc3df6 100644
--- a/src/api/c/fft.cpp
+++ b/src/api/c/fft.cpp
@@ -10,28 +10,22 @@
 #include <af/dim4.hpp>
 #include <af/defines.h>
 #include <af/signal.h>
-#include <handle.hpp>
 #include <err_common.hpp>
 #include <backend.hpp>
-#include <fft.hpp>
-#include <copy.hpp>
+#include <fft_common.hpp>
 
 using af::dim4;
 using namespace detail;
 
-template<typename inType, typename outType, int rank, bool isR2C>
-static af_array fft(const af_array in, const double norm_factor, const dim_t npad, const dim_t  * const pad)
+template<typename inType, typename outType, int rank, bool direction>
+static af_array fft(const af_array in, const double norm_factor,
+                    const dim_t npad, const dim_t  * const pad)
 {
-    return getHandle(fft<inType, outType, rank, isR2C>(getArray<inType>(in), norm_factor, npad, pad));
+    return getHandle(fft<inType, outType, rank, direction>(getArray<inType>(in),
+                                                           norm_factor, npad, pad));
 }
 
-template<typename T, int rank>
-static af_array ifft(const af_array in, const double norm_factor, const dim_t npad, const dim_t * const pad)
-{
-    return getHandle(ifft<T, rank>(getArray<T>(in), norm_factor, npad, pad));
-}
-
-template<int rank>
+template<int rank, bool direction>
 static af_err fft(af_array *out, const af_array in, const double norm_factor, const dim_t npad, const dim_t * const pad)
 {
     try {
@@ -43,33 +37,10 @@ static af_err fft(af_array *out, const af_array in, const double norm_factor, co
 
         af_array output;
         switch(type) {
-            case c32: output = fft<cfloat , cfloat , rank, false>(in, norm_factor, npad, pad); break;
-            case c64: output = fft<cdouble, cdouble, rank, false>(in, norm_factor, npad, pad); break;
-            case f32: output = fft<float , cfloat  , rank, true >(in, norm_factor, npad, pad); break;
-            case f64: output = fft<double, cdouble , rank, true >(in, norm_factor, npad, pad); break;
-            default: TYPE_ERROR(1, type);
-        }
-        std::swap(*out,output);
-    }
-    CATCHALL;
-
-    return AF_SUCCESS;
-}
-
-template<int rank>
-static af_err ifft(af_array *out, const af_array in, const double norm_factor, const dim_t npad, const dim_t * const pad)
-{
-    try {
-        ArrayInfo info = getInfo(in);
-        af_dtype type  = info.getType();
-        af::dim4 dims  = info.dims();
-
-        DIM_ASSERT(1, (dims.ndims()>=rank));
-
-        af_array output;
-        switch(type) {
-            case c32: output = ifft<cfloat , rank>(in, norm_factor, npad, pad); break;
-            case c64: output = ifft<cdouble, rank>(in, norm_factor, npad, pad); break;
+            case c32: output = fft<cfloat , cfloat , rank, direction>(in, norm_factor, npad, pad); break;
+            case c64: output = fft<cdouble, cdouble, rank, direction>(in, norm_factor, npad, pad); break;
+            case f32: output = fft<float , cfloat  , rank, direction>(in, norm_factor, npad, pad); break;
+            case f64: output = fft<double, cdouble , rank, direction>(in, norm_factor, npad, pad); break;
             default: TYPE_ERROR(1, type);
         }
         std::swap(*out,output);
@@ -82,37 +53,37 @@ static af_err ifft(af_array *out, const af_array in, const double norm_factor, c
 af_err af_fft(af_array *out, const af_array in, const double norm_factor, const dim_t pad0)
 {
     const dim_t pad[1] = {pad0};
-    return fft<1>(out, in, norm_factor, (pad0>0?1:0), pad);
+    return fft<1, true>(out, in, norm_factor, (pad0>0?1:0), pad);
 }
 
 af_err af_fft2(af_array *out, const af_array in, const double norm_factor, const dim_t pad0, const dim_t pad1)
 {
     const dim_t pad[2] = {pad0, pad1};
-    return fft<2>(out, in, norm_factor, (pad0>0&&pad1>0?2:0), pad);
+    return fft<2, true>(out, in, norm_factor, (pad0>0&&pad1>0?2:0), pad);
 }
 
 af_err af_fft3(af_array *out, const af_array in, const double norm_factor, const dim_t pad0, const dim_t pad1, const dim_t pad2)
 {
     const dim_t pad[3] = {pad0, pad1, pad2};
-    return fft<3>(out, in, norm_factor, (pad0>0&&pad1>0&&pad2>0?3:0), pad);
+    return fft<3, true>(out, in, norm_factor, (pad0>0&&pad1>0&&pad2>0?3:0), pad);
 }
 
 af_err af_ifft(af_array *out, const af_array in, const double norm_factor, const dim_t pad0)
 {
     const dim_t pad[1] = {pad0};
-    return ifft<1>(out, in, norm_factor, (pad0>0?1:0), pad);
+    return fft<1, false>(out, in, norm_factor, (pad0>0?1:0), pad);
 }
 
 af_err af_ifft2(af_array *out, const af_array in, const double norm_factor, const dim_t pad0, const dim_t pad1)
 {
     const dim_t pad[2] = {pad0, pad1};
-    return ifft<2>(out, in, norm_factor, (pad0>0&&pad1>0?2:0), pad);
+    return fft<2, false>(out, in, norm_factor, (pad0>0&&pad1>0?2:0), pad);
 }
 
 af_err af_ifft3(af_array *out, const af_array in, const double norm_factor, const dim_t pad0, const dim_t pad1, const dim_t pad2)
 {
     const dim_t pad[3] = {pad0, pad1, pad2};
-    return ifft<3>(out, in, norm_factor, (pad0>0&&pad1>0&&pad2>0?3:0), pad);
+    return fft<3, false>(out, in, norm_factor, (pad0>0&&pad1>0&&pad2>0?3:0), pad);
 }
 
 template<typename T, int rank, bool direction>
diff --git a/src/api/c/fft_common.hpp b/src/api/c/fft_common.hpp
new file mode 100644
index 0000000..8c4de85
--- /dev/null
+++ b/src/api/c/fft_common.hpp
@@ -0,0 +1,36 @@
+/*******************************************************
+ * Copyright (c) 2014, 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 <handle.hpp>
+#include <fft.hpp>
+#include <copy.hpp>
+
+using namespace detail;
+
+static void computePaddedDims(dim4 &pdims,
+                              const dim4 &idims,
+                              const dim_t npad,
+                              dim_t const * const pad)
+{
+    for (int i = 0; i < 4; i++) {
+        pdims[i] = (i < (int)npad) ? pad[i] : idims[i];
+    }
+}
+
+template<typename inType, typename outType, int rank, bool direction>
+Array<outType> fft(const Array<inType> input, const double norm_factor,
+                   const dim_t npad, const dim_t  * const pad)
+{
+    dim4 pdims(1);
+    computePaddedDims(pdims, input.dims(), npad, pad);
+    Array<outType> output = padArray<inType, outType>(input, pdims, scalar<outType>(0), norm_factor);
+
+    fft_inplace<outType, rank, direction>(output);
+
+    return output;
+}
diff --git a/src/api/c/fftconvolve.cpp b/src/api/c/fftconvolve.cpp
index d359119..f060dc5 100644
--- a/src/api/c/fftconvolve.cpp
+++ b/src/api/c/fftconvolve.cpp
@@ -13,11 +13,11 @@
 #include <err_common.hpp>
 #include <backend.hpp>
 #include <arith.hpp>
-#include <fft.hpp>
 #include <fftconvolve.hpp>
 #include <convolve_common.hpp>
 #include <dispatch.hpp>
 #include <complex.hpp>
+#include <fft_common.hpp>
 
 using af::dim4;
 using namespace detail;
@@ -67,16 +67,16 @@ af_array fftconvolve_fallback(const af_array signal, const af_array filter, bool
     }
 
     // fft(signal)
-    Array<cT> T1 = fft<cT, cT, baseDim, false>(S, 1.0, baseDim, psdims.get());
+    Array<cT> T1 = fft<cT, cT, baseDim, true>(S, 1.0, baseDim, psdims.get());
 
     // fft(filter)
-    Array<cT> T2 = fft<cT, cT, baseDim, false>(F, 1.0, baseDim, pfdims.get());
+    Array<cT> T2 = fft<cT, cT, baseDim, true>(F, 1.0, baseDim, pfdims.get());
 
     // fft(signal) * fft(filter)
     T1 = arithOp<cT, af_mul_t>(T1, T2, odims);
 
     // ifft(ffit(signal) * fft(filter))
-    T1 = ifft<cT, baseDim>(T1, 1.0/(double)count, baseDim, odims.get());
+    T1 = fft<cT, cT, baseDim, false>(T1, 1.0/(double)count, baseDim, odims.get());
 
     // Index to proper offsets
     T1 = createSubArray<cT>(T1, index);
diff --git a/src/backend/cpu/fft.cpp b/src/backend/cpu/fft.cpp
index 9a7696a..b933ec4 100644
--- a/src/backend/cpu/fft.cpp
+++ b/src/backend/cpu/fft.cpp
@@ -91,60 +91,16 @@ void fft_inplace(Array<T> &in)
 
 }
 
-void computePaddedDims(dim4 &pdims,
-                       const dim4 &idims,
-                       const dim_t npad,
-                       dim_t const * const pad)
-{
-    for (int i = 0; i < 4; i++) {
-        pdims[i] = (i < (int)npad) ? pad[i] : idims[i];
-    }
-}
-
-template<typename inType, typename outType, int rank, bool isR2C>
-Array<outType> fft(Array<inType> const &in, double norm_factor, dim_t const npad, dim_t const * const pad)
-{
-    ARG_ASSERT(1, rank >= 1 && rank <= 3);
-
-    dim4 pdims(1);
-    computePaddedDims(pdims, in.dims(), npad, pad);
-
-    Array<outType> ret = padArray<inType, outType>(in, pdims);
-    fft_inplace<outType, rank, true>(ret);
-    return ret;
-}
-
-template<typename T, int rank>
-Array<T> ifft(Array<T> const &in, double norm_factor, dim_t const npad, dim_t const * const pad)
-{
-    ARG_ASSERT(1, rank >= 1 && rank <= 3);
-
-    dim4 pdims(1);
-    computePaddedDims(pdims, in.dims(), npad, pad);
-
-    Array<T> ret = padArray<T, T>(in, pdims, scalar<T>(0), norm_factor);
-    fft_inplace<T, rank, false>(ret);
-
-    return ret;
-}
-
-#define INSTANTIATE1(T1, T2)\
-    template Array<T2> fft <T1, T2, 1, true >(const Array<T1> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T2> fft <T1, T2, 2, true >(const Array<T1> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T2> fft <T1, T2, 3, true >(const Array<T1> &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
-INSTANTIATE1(float  , cfloat )
-INSTANTIATE1(double , cdouble)
+#define INSTANTIATE(T)                                      \
+    template void fft_inplace<T, 1, true >(Array<T> &in);   \
+    template void fft_inplace<T, 2, true >(Array<T> &in);   \
+    template void fft_inplace<T, 3, true >(Array<T> &in);   \
+    template void fft_inplace<T, 1, false>(Array<T> &in);   \
+    template void fft_inplace<T, 2, false>(Array<T> &in);   \
+    template void fft_inplace<T, 3, false>(Array<T> &in);
 
-#define INSTANTIATE2(T)                                                 \
-    template Array<T> fft <T, T, 1, false>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> fft <T, T, 2, false>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> fft <T, T, 3, false>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> ifft<T, 1>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> ifft<T, 2>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> ifft<T, 3>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
+    INSTANTIATE(cfloat )
+    INSTANTIATE(cdouble)
 
-INSTANTIATE2(cfloat )
-INSTANTIATE2(cdouble)
 
 }
diff --git a/src/backend/cpu/fft.hpp b/src/backend/cpu/fft.hpp
index eff44cd..0414ecb 100644
--- a/src/backend/cpu/fft.hpp
+++ b/src/backend/cpu/fft.hpp
@@ -12,12 +12,6 @@
 namespace cpu
 {
 
-template<typename inType, typename outType, int rank, bool isR2C>
-Array<outType> fft(Array<inType> const &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
-template<typename T, int rank>
-Array<T> ifft(Array<T> const &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
 template<typename T, int rank, bool direction>
 void fft_inplace(Array<T> &in);
 }
diff --git a/src/backend/cuda/fft.cpp b/src/backend/cuda/fft.cpp
index a762c8b..ff90cb4 100644
--- a/src/backend/cuda/fft.cpp
+++ b/src/backend/cuda/fft.cpp
@@ -180,61 +180,15 @@ void fft_inplace(Array<T> &in)
     CUFFT_CHECK(transform(plan, (T *)in.get(), in.get(), direction ? CUFFT_FORWARD : CUFFT_INVERSE));
 }
 
-void computePaddedDims(dim4 &pdims,
-                       const dim4 &idims,
-                       const dim_t npad,
-                       dim_t const * const pad)
-{
-    for (int i = 0; i < 4; i++) {
-        pdims[i] = (i < (int)npad) ? pad[i] : idims[i];
-    }
-}
-
-template<typename inType, typename outType, int rank, bool isR2C>
-Array<outType> fft(Array<inType> const &in, double norm_factor, dim_t const npad, dim_t const * const pad)
-{
-    ARG_ASSERT(1, (rank>=1 && rank<=3));
-
-    dim4 pdims(1);
-    computePaddedDims(pdims, in.dims(), npad, pad);
-
-    Array<outType> ret = padArray<inType, outType>(in, pdims, scalar<outType>(0), norm_factor);
-    fft_inplace<outType, rank, true>(ret);
-
-    return ret;
-}
-
-template<typename T, int rank>
-Array<T> ifft(Array<T> const &in, double norm_factor, dim_t const npad, dim_t const * const pad)
-{
-    ARG_ASSERT(1, (rank>=1 && rank<=3));
-
-    dim4 pdims(1);
-    computePaddedDims(pdims, in.dims(), npad, pad);
-
-    Array<T> ret = padArray<T, T>(in, pdims, scalar<T>(0), norm_factor);
-    fft_inplace<T, rank, false>(ret);
-
-    return ret;
-}
-
-#define INSTANTIATE1(T1, T2)\
-    template Array<T2> fft <T1, T2, 1, true >(const Array<T1> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T2> fft <T1, T2, 2, true >(const Array<T1> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T2> fft <T1, T2, 3, true >(const Array<T1> &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
-INSTANTIATE1(float  , cfloat )
-INSTANTIATE1(double , cdouble)
-
-#define INSTANTIATE2(T)\
-    template Array<T> fft <T, T, 1, false>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> fft <T, T, 2, false>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> fft <T, T, 3, false>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> ifft<T, 1>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> ifft<T, 2>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> ifft<T, 3>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
-INSTANTIATE2(cfloat )
-INSTANTIATE2(cdouble)
+#define INSTANTIATE(T)                                      \
+    template void fft_inplace<T, 1, true >(Array<T> &in);   \
+    template void fft_inplace<T, 2, true >(Array<T> &in);   \
+    template void fft_inplace<T, 3, true >(Array<T> &in);   \
+    template void fft_inplace<T, 1, false>(Array<T> &in);   \
+    template void fft_inplace<T, 2, false>(Array<T> &in);   \
+    template void fft_inplace<T, 3, false>(Array<T> &in);
+
+    INSTANTIATE(cfloat )
+    INSTANTIATE(cdouble)
 
 }
diff --git a/src/backend/cuda/fft.hpp b/src/backend/cuda/fft.hpp
index ee3ef14..bac02d5 100644
--- a/src/backend/cuda/fft.hpp
+++ b/src/backend/cuda/fft.hpp
@@ -12,12 +12,6 @@
 namespace cuda
 {
 
-template<typename inType, typename outType, int rank, bool isR2C>
-Array<outType> fft(Array<inType> const &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
-template<typename T, int rank>
-Array<T> ifft(Array<T> const &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
 template<typename T, int rank, bool direction>
 void fft_inplace(Array<T> &out);
 
diff --git a/src/backend/opencl/fft.cpp b/src/backend/opencl/fft.cpp
index 5094300..1ce5ac0 100644
--- a/src/backend/opencl/fft.cpp
+++ b/src/backend/opencl/fft.cpp
@@ -165,54 +165,13 @@ template<typename T> struct Precision;
 template<> struct Precision<cfloat > { enum {type = CLFFT_SINGLE}; };
 template<> struct Precision<cdouble> { enum {type = CLFFT_DOUBLE}; };
 
-void computeDims(size_t rdims[4], const dim4 &idims)
+static void computeDims(size_t rdims[4], const dim4 &idims)
 {
     for (int i = 0; i < 4; i++) {
         rdims[i] = (size_t)idims[i];
     }
 }
 
-template<typename T, int rank, bool direction>
-void fft_inplace(Array<T> &in)
-{
-    size_t idims[4], istrides[4], iembed[4];
-
-    computeDims(idims   , in.dims());
-    computeDims(iembed  , in.getDataDims());
-    computeDims(istrides, in.strides());
-
-    clfftPlanHandle plan;
-
-    int batch = 1;
-    for (int i = rank; i < 4; i++) {
-        batch *= idims[i];
-    }
-
-    find_clfft_plan(plan, (clfftDim)rank, idims,
-                    istrides, istrides[rank],
-                    istrides, istrides[rank],
-                    (clfftPrecision)Precision<T>::type,
-                    batch);
-
-    cl_mem imem = (*in.get())();
-    cl_command_queue queue = getQueue()();
-
-    CLFFT_CHECK(clfftEnqueueTransform(plan,
-                                      direction ? CLFFT_FORWARD : CLFFT_BACKWARD,
-                                      1, &queue, 0, NULL, NULL,
-                                      &imem, &imem, NULL));
-}
-
-void computePaddedDims(dim4 &pdims,
-                       const dim4 &idims,
-                       const dim_t npad,
-                       dim_t const * const pad)
-{
-    for (int i = 0; i < 4; i++) {
-        pdims[i] = (i < (int)npad) ? pad[i] : idims[i];
-    }
-}
-
 //(currently) true is in clFFT if length is a power of 2,3,5
 inline bool isSupLen(dim_t length)
 {
@@ -238,52 +197,46 @@ void verifySupported(const dim4 dims)
     }
 }
 
-template<typename inType, typename outType, int rank, bool isR2C>
-Array<outType> fft(Array<inType> const &in, double norm_factor, dim_t const npad, dim_t const * const pad)
+template<typename T, int rank, bool direction>
+void fft_inplace(Array<T> &in)
 {
-    ARG_ASSERT(1, (rank>=1 && rank<=3));
+    verifySupported<rank>(in.dims());
+    size_t idims[4], istrides[4], iembed[4];
 
-    dim4 pdims(1);
-    computePaddedDims(pdims, in.dims(), npad, pad);
-    verifySupported<rank>(pdims);
+    computeDims(idims   , in.dims());
+    computeDims(iembed  , in.getDataDims());
+    computeDims(istrides, in.strides());
 
-    Array<outType> ret = padArray<inType, outType>(in, pdims, scalar<outType>(0), norm_factor);
-    fft_inplace<outType, rank, true>(ret);
+    clfftPlanHandle plan;
 
-    return ret;
-}
+    int batch = 1;
+    for (int i = rank; i < 4; i++) {
+        batch *= idims[i];
+    }
 
-template<typename T, int rank>
-Array<T> ifft(Array<T> const &in, double norm_factor, dim_t const npad, dim_t const * const pad)
-{
-    ARG_ASSERT(1, (rank>=1 && rank<=3));
+    find_clfft_plan(plan, (clfftDim)rank, idims,
+                    istrides, istrides[rank],
+                    istrides, istrides[rank],
+                    (clfftPrecision)Precision<T>::type,
+                    batch);
 
-    dim4 pdims(1);
-    computePaddedDims(pdims, in.dims(), npad, pad);
-    verifySupported<rank>(pdims);
+    cl_mem imem = (*in.get())();
+    cl_command_queue queue = getQueue()();
 
-    Array<T> ret = padArray<T, T>(in, pdims, scalar<T>(0), norm_factor);
-    fft_inplace<T, rank, false>(ret);
-    return ret;
+    CLFFT_CHECK(clfftEnqueueTransform(plan,
+                                      direction ? CLFFT_FORWARD : CLFFT_BACKWARD,
+                                      1, &queue, 0, NULL, NULL,
+                                      &imem, &imem, NULL));
 }
 
-#define INSTANTIATE1(T1, T2)\
-    template Array<T2> fft <T1, T2, 1, true >(const Array<T1> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T2> fft <T1, T2, 2, true >(const Array<T1> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T2> fft <T1, T2, 3, true >(const Array<T1> &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
-INSTANTIATE1(float  , cfloat )
-INSTANTIATE1(double , cdouble)
-
-#define INSTANTIATE2(T)\
-    template Array<T> fft <T, T, 1, false>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> fft <T, T, 2, false>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> fft <T, T, 3, false>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> ifft<T, 1>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> ifft<T, 2>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad); \
-    template Array<T> ifft<T, 3>(const Array<T> &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
-INSTANTIATE2(cfloat )
-INSTANTIATE2(cdouble)
+#define INSTANTIATE(T)                                      \
+    template void fft_inplace<T, 1, true >(Array<T> &in);   \
+    template void fft_inplace<T, 2, true >(Array<T> &in);   \
+    template void fft_inplace<T, 3, true >(Array<T> &in);   \
+    template void fft_inplace<T, 1, false>(Array<T> &in);   \
+    template void fft_inplace<T, 2, false>(Array<T> &in);   \
+    template void fft_inplace<T, 3, false>(Array<T> &in);
 
+    INSTANTIATE(cfloat )
+    INSTANTIATE(cdouble)
 }
diff --git a/src/backend/opencl/fft.hpp b/src/backend/opencl/fft.hpp
index 2406f5b..3b48254 100644
--- a/src/backend/opencl/fft.hpp
+++ b/src/backend/opencl/fft.hpp
@@ -12,12 +12,6 @@
 namespace opencl
 {
 
-template<typename inType, typename outType, int rank, bool isR2C>
-Array<outType> fft(Array<inType> const &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
-template<typename T, int rank>
-Array<T> ifft(Array<T> const &in, double norm_factor, dim_t const npad, dim_t const * const pad);
-
 template<typename T, int rank, bool direction>
 void fft_inplace(Array<T> &in);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list