1 /* 2 * Copyright (c) 2002, 2017 Jens Keiner, Stefan Kunis, Daniel Potts 3 * 4 * This program is free software; you can redistribute it and/or modify it under 5 * the terms of the GNU General Public License as published by the Free Software 6 * Foundation; either version 2 of the License, or (at your option) any later 7 * version. 8 * 9 * This program is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 12 * details. 13 * 14 * You should have received a copy of the GNU General Public License along with 15 * this program; if not, write to the Free Software Foundation, Inc., 51 16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __NFFT3MP_H__ 20 #define __NFFT3MP_H__ 21 22 #include "nfft3.h" 23 24 #ifdef __cplusplus 25 extern "C" 26 { 27 #endif /* __cplusplus */ 28 29 #if defined(NFFT_PRECISION_SINGLE) 30 typedef float NFFT_R; 31 typedef fftwf_complex NFFT_C; 32 #define NFFT_K(x) ((NFFT_R) x) 33 #define NFFT_M(name) NFFT_CONCAT(name,f) 34 #define FFTW(name) NFFT_CONCAT(fftwf_,name) 35 #define NFFT(name) NFFT_CONCAT(nfftf_,name) 36 #define NFCT(name) NFFT_CONCAT(nfctf_,name) 37 #define NFST(name) NFFT_CONCAT(nfstf_,name) 38 #define NFSFT(name) NFFT_CONCAT(nfsftf_,name) 39 #define SOLVER(name) NFFT_CONCAT(solverf_,name) 40 #elif defined(NFFT_PRECISION_LONG_DOUBLE) 41 typedef long double NFFT_R; 42 typedef fftwl_complex NFFT_C; 43 #define NFFT_K(x) ((NFFT_R) x##L) 44 #define NFFT_M(name) NFFT_CONCAT(name,l) 45 #define FFTW(name) NFFT_CONCAT(fftwl_,name) 46 #define NFFT(name) NFFT_CONCAT(nfftl_,name) 47 #define NFCT(name) NFFT_CONCAT(nfctl_,name) 48 #define NFST(name) NFFT_CONCAT(nfstl_,name) 49 #define NFSFT(name) NFFT_CONCAT(nfsftl_,name) 50 #define SOLVER(name) NFFT_CONCAT(solverl_,name) 51 #elif defined(NFFT_PRECISION_DOUBLE) 52 typedef double NFFT_R; 53 typedef fftw_complex NFFT_C; 54 #define NFFT_K(x) ((NFFT_R) x) 55 #define NFFT_M(name) name 56 #define FFTW(name) NFFT_CONCAT(fftw_,name) 57 #define NFFT(name) NFFT_CONCAT(nfft_,name) 58 #define NFCT(name) NFFT_CONCAT(nfct_,name) 59 #define NFST(name) NFFT_CONCAT(nfst_,name) 60 #define NFSFT(name) NFFT_CONCAT(nfsft_,name) 61 #define SOLVER(name) NFFT_CONCAT(solver_,name) 62 #else 63 #error Either define macro NFFT_PRECISION_SINGLE, NFFT_PRECISION_DOUBLE or NFFT_PRECISION_LONG_DOUBLE for single, double or long double precision 64 #endif 65 66 /* format strings */ 67 #if defined(NFFT_PRECISION_LONG_DOUBLE) 68 # define NFFT__FGS__ "Lg" 69 # define NFFT__FES__ "LE" 70 # define NFFT__FE__ "% 36.32LE" 71 # define NFFT__FI__ "%Lf" 72 # define NFFT__FIS__ "Lf" 73 # define NFFT__FR__ "%Le" 74 #elif defined(NFFT_PRECISION_SINGLE) 75 # define NFFT__FGS__ "g" 76 # define NFFT__FES__ "E" 77 # define NFFT__FE__ "% 12.8E" 78 # define NFFT__FI__ "%f" 79 # define NFFT__FIS__ "f" 80 # define NFFT__FR__ "%e" 81 #elif defined(NFFT_PRECISION_DOUBLE) 82 # define NFFT__FGS__ "lg" 83 # define NFFT__FES__ "lE" 84 # define NFFT__FE__ "% 20.16lE" 85 # define NFFT__FI__ "%lf" 86 # define NFFT__FIS__ "lf" 87 # define NFFT__FR__ "%le" 88 #else 89 #error Either define macro NFFT_PRECISION_SINGLE, NFFT_PRECISION_DOUBLE or NFFT_PRECISION_LONG_DOUBLE for single, double or long double precision 90 #endif 91 92 #ifdef __cplusplus 93 } /* extern "C" */ 94 #endif /* __cplusplus */ 95 96 /** Swap two vectors. */ 97 #define NFFT_CSWAP(x,y) {NFFT_C* NFFT_SWAP_temp__; \ 98 NFFT_SWAP_temp__=(x); (x)=(y); (y)=NFFT_SWAP_temp__;} 99 100 #define NFFT_KPI NFFT_K(3.1415926535897932384626433832795028841971693993751) 101 102 #if defined(_WIN32) || defined(_WIN64) 103 # define NFFT__D__ "%Id" 104 #else 105 # define NFFT__D__ "%td" 106 #endif 107 108 #endif /* defined(__NFFT3MP_H__) */ 109