Commit 395a0c89 by Martin Reinecke

### change normalization parameters

parent d77cdeb5
 ... @@ -5,7 +5,7 @@ import pypocketfft ... @@ -5,7 +5,7 @@ import pypocketfft from time import time from time import time import matplotlib.pyplot as plt import matplotlib.pyplot as plt nthreads=0 nthreads=1 def _l2error(a,b): def _l2error(a,b): return np.sqrt(np.sum(np.abs(a-b)**2)/np.sum(np.abs(a)**2)) return np.sqrt(np.sum(np.abs(a-b)**2)/np.sum(np.abs(a)**2)) ... @@ -26,7 +26,7 @@ def bench_nd_fftn(ndim, nmax, ntry, tp, nrepeat, filename=""): ... @@ -26,7 +26,7 @@ def bench_nd_fftn(ndim, nmax, ntry, tp, nrepeat, filename=""): b=pypocketfft.fftn(a,nthreads=nthreads) b=pypocketfft.fftn(a,nthreads=nthreads) t1=time() t1=time() tmin_pp = min(tmin_pp,t1-t0) tmin_pp = min(tmin_pp,t1-t0) a2=pypocketfft.ifftn(b,fct=1./a.size) a2=pypocketfft.ifftn(b,inorm=2) assert(_l2error(a,a2)<(2.5e-15 if tp=='c16' else 6e-7)) assert(_l2error(a,a2)<(2.5e-15 if tp=='c16' else 6e-7)) res.append(tmin_pp/tmin_np) res.append(tmin_pp/tmin_np) plt.title("t(pypocketfft / numpy 1.17), {}D, {}, max_extent={}".format(ndim, str(tp), nmax)) plt.title("t(pypocketfft / numpy 1.17), {}D, {}, max_extent={}".format(ndim, str(tp), nmax)) ... ...
 ... @@ -34,11 +34,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ... @@ -34,11 +34,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define POCKETFFT_HDRONLY_H #define POCKETFFT_HDRONLY_H #ifndef __cplusplus #ifndef __cplusplus #error This file is C++ and requires a C++ compiler #error This file is C++ and requires a C++ compiler. #endif #endif #if !(__cplusplus >= 201103L || _MSVC_LANG+0L >= 201103L) #if !(__cplusplus >= 201103L || _MSVC_LANG+0L >= 201103L) #error This file requires at least C++11 support #error This file requires at least C++11 support. #endif #endif #include #include ... @@ -48,9 +48,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ... @@ -48,9 +48,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include #include #include #include #if defined(_WIN32) #include #endif #ifdef POCKETFFT_OPENMP #ifdef POCKETFFT_OPENMP #include #include #endif #endif ... @@ -83,7 +80,7 @@ constexpr bool FORWARD = true, ... @@ -83,7 +80,7 @@ constexpr bool FORWARD = true, #ifndef POCKETFFT_NO_VECTORS #ifndef POCKETFFT_NO_VECTORS #define POCKETFFT_NO_VECTORS #define POCKETFFT_NO_VECTORS #if defined(__INTEL_COMPILER) #if defined(__INTEL_COMPILER) // do nothing. This is necessary because this compiler also sets __GNUC__ // do nothing. This is necessary because this compiler also sets __GNUC__. #elif defined(__clang__) #elif defined(__clang__) #if __clang__>=5 #if __clang__>=5 #undef POCKETFFT_NO_VECTORS #undef POCKETFFT_NO_VECTORS ... @@ -141,27 +138,19 @@ template class arr ... @@ -141,27 +138,19 @@ template class arr } } static void dealloc(T *ptr) static void dealloc(T *ptr) { free(ptr); } { free(ptr); } #elif defined(_WIN32) #else // portable emulation static T *ralloc(size_t num) static T *ralloc(size_t num) { { if (num==0) return nullptr; if (num==0) return nullptr; void *res = _aligned_malloc(num*sizeof(T), 64); void *ptr = malloc(num*sizeof(T)+64); if (!res) throw bad_alloc(); if (!ptr) throw bad_alloc(); return reinterpret_cast(res); T *res = reinterpret_cast ((reinterpret_cast(ptr) & ~(size_t(63))) + 64); (reinterpret_cast(res))[-1] = ptr; return res; } } static void dealloc(T *ptr) static void dealloc(T *ptr) { _aligned_free(ptr); } { if (ptr) free((reinterpret_cast(ptr))[-1]); } #else static T *ralloc(size_t num) { if (num==0) return nullptr; void *res(nullptr); if (posix_memalign(&res, 64, num*sizeof(T))!=0) throw bad_alloc(); return reinterpret_cast(res); } static void dealloc(T *ptr) { free(ptr); } #endif #endif public: public: ... ...