From 1e3079c4e02f1f6e03fb32ec248d731106e8be51 Mon Sep 17 00:00:00 2001 From: Martin Reinecke <martin@mpa-garching.mpg.de> Date: Fri, 19 Apr 2019 21:52:07 +0200 Subject: [PATCH] cleanup --- pocketfft.cc | 72 ++++++++++------------------------------------------ 1 file changed, 13 insertions(+), 59 deletions(-) diff --git a/pocketfft.cc b/pocketfft.cc index 2f08d15..53db317 100644 --- a/pocketfft.cc +++ b/pocketfft.cc @@ -1,3 +1,15 @@ +/* + * This file is part of pocketfft. + * Licensed under a 3-clause BSD style license - see LICENSE.md + */ + +/* + * Main implementation file. + * + * Copyright (C) 2004-2019 Max-Planck-Society + * \author Martin Reinecke + */ + #include <cmath> #include <cstring> #include <algorithm> @@ -1984,64 +1996,6 @@ class multi_iter int64_t remaining() const { return rem; } }; -#if 0 -template<typename T> void pocketfft_general_c(int ndim, const size_t *shape, - const int64_t *stride_in, const int64_t *stride_out, int nax, - const size_t *axes, bool forward, const cmplx<T> *data_in, - cmplx<T> *data_out, T fct) - { - // allocate temporary 1D array storage, if necessary - size_t tmpsize = 0; - for (int iax=0; iax<nax; ++iax) - { - bool inplace = false; - int64_t stride = (iax==0) ? stride_in[axes[iax]] : stride_out[axes[iax]]; - if (stride==1) - if ((iax>0) || (data_in==data_out)) - inplace = true; - if (!inplace) - if (shape[axes[iax]] > tmpsize) tmpsize = shape[axes[iax]]; - } - arr<cmplx<T>> tdata(tmpsize); - multiarr a_in(ndim, shape, stride_in), a_out(ndim, shape, stride_out); - unique_ptr<pocketfft_c<T>> plan; - - for (int iax=0; iax<nax; ++iax) - { - int axis = axes[iax]; - multi_iter it_in(a_in, axis), it_out(a_out, axis); - bool inplace = (data_in==data_out) && (it_in.stride()==1); - if ((!plan) || (it_in.length()!=plan->length())) - plan.reset(new pocketfft_c<T>(it_in.length())); - while (!it_in.done()) - { - if (inplace) - { - cmplx<T> *d = data_out+it_in.offset(); - forward ? plan->forward((T *)d, fct) - : plan->backward((T *)d, fct); - } - else - { - for (size_t i=0; i<it_in.length(); ++i) - tdata[i] = data_in[it_in.offset()+i*it_in.stride()]; - forward ? plan->forward((T *)tdata.data(), fct) - : plan->backward((T *)tdata.data(), fct); - for (size_t i=0; i<it_out.length(); ++i) - data_out[it_out.offset()+i*it_out.stride()] = tdata[i]; - } - it_in.advance(); - if (!inplace) - it_out.advance(); - } - // after the first dimension, take data from output array - a_in = a_out; - data_in = data_out; - // factor has been applied, use 1 for remaining axes - fct = T(1); - } - } -#else #if defined(__AVX__) #include <x86intrin.h> @@ -2134,7 +2088,7 @@ template<typename T> void pocketfft_general_c(int ndim, const size_t *shape, fct = T(1); } } -#endif + template<typename T> void pocketfft_general_hartley(int ndim, const size_t *shape, const int64_t *stride_in, const int64_t *stride_out, int nax, const size_t *axes, const T *data_in, T *data_out, T fct) -- GitLab