NFFT Logo 3.1.1 API Reference

infft.h

00001 /*
00002  * Copyright (c) 2002, 2009 Jens Keiner, Stefan Kunis, Daniel Potts
00003  *
00004  * This program is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU General Public License as published by the Free Software
00006  * Foundation; either version 2 of the License, or (at your option) any later
00007  * version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00012  * details.
00013  *
00014  * You should have received a copy of the GNU General Public License along with
00015  * this program; if not, write to the Free Software Foundation, Inc., 51
00016  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 /* $Id: infft.h 3189 2009-05-13 14:16:32Z keiner $ */
00020 
00021 /* NFFT internal header file */
00022 #ifndef __INFFT_H__
00023 #define __INFFT_H__
00024 
00025 #include "config.h"
00026 
00027 #include <math.h>
00028 #include <float.h>
00029 
00030 #include <stdlib.h> /* size_t */
00031 #include <stdarg.h> /* va_list */
00032 #include <stddef.h> /* ptrdiff_t */
00033 
00034 #if HAVE_SYS_TYPES_H
00035 #include <sys/types.h>
00036 #endif
00037 
00038 #if HAVE_STDINT_H
00039 #include <stdint.h> /* uintptr_t, maybe */
00040 #endif
00041 
00042 #if HAVE_INTTYPES_H
00043 #include <inttypes.h> /* uintptr_t, maybe */
00044 #endif
00045 
00046 /* precision and name-mangling scheme */
00047 #define CONCAT(prefix, name) prefix ## name
00048 #if defined(NFFT_SINGLE)
00049 typedef float R;
00050 typedef float _Complex C;
00051 #define X(name) CONCAT(nfftf_, name)
00052 #elif defined(NFFT_LDOUBLE)
00053 typedef long double R;
00054 typedef long double _Complex C;
00055 #define X(name) CONCAT(nfftl_, name)
00056 #else
00057 typedef double R;
00058 typedef double _Complex C;
00059 #define X(name) CONCAT(nfft_, name)
00060 #endif
00061 
00062 #ifdef NFFT_LDOUBLE
00063 #  define K(x) ((R) x##L)
00064 #else
00065 #  define K(x) ((R) x)
00066 #endif
00067 #define DK(name, value) const R name = K(value)
00068 
00073 typedef ptrdiff_t INT;
00074 
00075 #define IF(x,a,b) ((x)?(a):(b))
00076 
00077 #define MIN(a,b) (((a)<(b))?(a):(b))
00078 #define MAX(a,b) (((a)>(b))?(a):(b))
00079 #define ABS(x) (((x)>K(0.0))?(x):(-(x)))
00080 #define SIGN(a) (((a)>=0)?1:-1)
00081 #define SIGN(a) (((a)>=0)?1:-1)
00082 #define SIGNF(a) IF((a)<K(0.0),K(-1.0),K(1.0))
00083 
00084 #if defined(NFFT_LDOUBLE)
00085 #define LOG1P log1pl
00086 #if HAVE_DECL_LOG1PL == 0
00087 extern long double log1pl(const long double);
00088 #endif
00089 #define LOG10 log10l
00090 #if HAVE_DECL_LOG10L == 0
00091 extern long double log10l(const long double);
00092 #endif
00093 #define SQRT sqrtl
00094 #if HAVE_DECL_SQRTL == 0
00095 extern long double sqrtl(const long double);
00096 #endif
00097 #define TGAMMA tgammal
00098 #if HAVE_DECL_TGAMMAL == 0
00099 extern long double tgammal(const long double);
00100 #endif
00101 #define LGAMMA lgammal
00102 #if HAVE_DECL_LGAMMAL == 0
00103 extern long double lgammal(const long double);
00104 #endif
00105 #define LOG logl
00106 #if HAVE_DECL_LOGL == 0
00107 extern long double logl(const long double);
00108 #endif
00109 #define LOG2 log2l
00110 #if HAVE_DECL_LOG2L == 0
00111 extern long double log2l(const long double);
00112 #endif
00113 #define SIN sinl
00114 #if HAVE_DECL_SINL == 0
00115 extern long double sinl(const long double);
00116 #endif
00117 #define COS cosl
00118 #if HAVE_DECL_COSL == 0
00119 extern long double cosl(const long double);
00120 #endif
00121 #define ACOS acosl
00122 #if HAVE_DECL_ACOSL == 0
00123 extern long double acosl(const long double);
00124 #endif
00125 #define POW powl
00126 #if HAVE_DECL_POWL == 0
00127 extern long double powl(const long double, const long double);
00128 #endif
00129 #define EXP expl
00130 #if HAVE_DECL_EXPL == 0
00131 extern long double expl(const long double);
00132 #endif
00133 #define COPYSIGN copysignl
00134 #if HAVE_DECL_COPYSIGNL == 0
00135 extern long double copysignl(const long double, const long double);
00136 #endif
00137 #define LRINT lrintl
00138 #if HAVE_DECL_LRINTL == 0
00139 extern long int lrintl(const long double);
00140 #endif
00141 #elif defined(NFFT_SINGLE)
00142 #define LOG1P log1pf
00143 #if HAVE_DECL_LOG1PF == 0
00144 extern float log1pf(const float);
00145 #endif
00146 #define LOG10 log10f
00147 #if HAVE_DECL_LOG10F == 0
00148 extern float log10f(const float);
00149 #endif
00150 #define SQRT sqrtf
00151 #if HAVE_DECL_SQRTF == 0
00152 extern float sqrtf(const float);
00153 #endif
00154 #define >TGAMMA tgammaf
00155 #if HAVE_DECL_TGAMMAF == 0
00156 extern float tgammaf(const float);
00157 #endif
00158 #define LGAMMA lgammaf
00159 #if HAVE_DECL_LGAMMAF == 0
00160 extern float lgammaf(const float);
00161 #endif
00162 #define LOG logf
00163 #if HAVE_DECL_LOGF == 0
00164 extern float logf(const float);
00165 #endif
00166 #define LOG2 log2f
00167 #if HAVE_DECL_LOG2F == 0
00168 extern float log2f(const float);
00169 #endif
00170 #define SIN sinf
00171 #if HAVE_DECL_SINF == 0
00172 extern float sinf(const float);
00173 #endif
00174 #define COS cosf
00175 #if HAVE_DECL_COSF == 0
00176 extern float cosf(const float);
00177 #endif
00178 #define ACOS acosf
00179 #if HAVE_DECL_ACOSF == 0
00180 extern float acosf(const float);
00181 #endif
00182 #define POW powf
00183 #if HAVE_DECL_POWF == 0
00184 extern float powf(const float, const float);
00185 #endif
00186 #define EXP expf
00187 #if HAVE_DECL_EXPF == 0
00188 extern float expf(const float);
00189 #endif
00190 #define COPYSIGN copysignf
00191 #if HAVE_DECL_COPYSIGNF == 0
00192 extern float copysignf(const float, const float);
00193 #endif
00194 #define LRINT lrintf
00195 #if HAVE_DECL_LRINTF == 0
00196 extern long int lrintf(const float);
00197 #endif
00198 #else
00199 #define LOG1P log1p
00200 #if HAVE_DECL_LOG1P == 0
00201 extern double log1p(const double);
00202 #endif
00203 #define LOG10 log10
00204 #if HAVE_DECL_LOG10 == 0
00205 extern double log10(const double);
00206 #endif
00207 #define SQRT sqrt
00208 #if HAVE_DECL_SQRT == 0
00209 extern double sqrt(const double);
00210 #endif
00211 #define TGAMMA tgamma
00212 #if HAVE_DECL_TGAMMA == 0
00213 extern double tgamma(const double);
00214 #endif
00215 #define LGAMMA lgamma
00216 #if HAVE_DECL_LGAMMA == 0
00217 extern double lgamma(const double);
00218 #endif
00219 #define LOG log
00220 #if HAVE_DECL_LOG == 0
00221 extern double log(const double);
00222 #endif
00223 #define LOG2 log2
00224 #if HAVE_DECL_LOG2 == 0
00225 extern double log2(const double);
00226 #endif
00227 #define SIN sin
00228 #if HAVE_DECL_SIN == 0
00229 extern double sin(const double);
00230 #endif
00231 #define COS cos
00232 #if HAVE_DECL_COS == 0
00233 extern double cos(const double);
00234 #endif
00235 #define ACOS acos
00236 #if HAVE_DECL_ACOS == 0
00237 extern double acos(const double);
00238 #endif
00239 #define POW pow
00240 #if HAVE_DECL_POW == 0
00241 extern double pow(const double, const double);
00242 #endif
00243 #define EXP exp
00244 #if HAVE_DECL_EXP == 0
00245 extern double exp(const double);
00246 #endif
00247 #define COPYSIGN copysign
00248 #if HAVE_DECL_COPYSIGN == 0
00249 extern double copysign(const double, const double);
00250 #endif
00251 #define LRINT lrint
00252 #if HAVE_DECL_LRINT == 0
00253 extern long int lrint(const double);
00254 #endif
00255 #endif
00256 
00257 #if defined(NFFT_LDOUBLE)
00258 #  define CEIL ceill
00259 #  define FLOOR floorl
00260 #  define ROUND roundl
00261 #  define FABS fabsl
00262 #  define FMAX fmaxl
00263 #  define FMIN fminl
00264 #  define FREXP frexpl
00265 #  define LDEXP ldexpl
00266 #  define EPS LDBL_EPSILON
00267 #  define R_MIN LDBL_MIN
00268 #  define R_MAX LDBL_MAX
00269 #  define R_MIN_EXP LDBL_MIN_EXP
00270 #  define R_MAX_EXP LDBL_MAX_EXP
00271 #  define R_MIN_10_EXP LDBL_MIN_10_EXP
00272 #  define R_MAX_10_EXP LDBL_MAX_10_EXP
00273 #  define R_DIG LDBL_DIG
00274 #  define CREAL creall
00275 #  define CIMAG cimagl
00276 #elif defined(NFFT_SINGLE)
00277 #  define CEIL ceilf
00278 #  define FLOOR floorf
00279 #  define ROUND roundf
00280 #  define FABS fabsf
00281 #  define FMAX fmaxf
00282 #  define FMIN fminf
00283 #  define FREXP frexpf
00284 #  define LDEXP ldexpf
00285 #  define EPS FLT_EPSILON
00286 #  define R_MIN FLT_MIN
00287 #  define R_MAX FLT_MAX
00288 #  define R_MIN_EXP FLT_MIN_EXP
00289 #  define R_MAX_EXP FLT_MAX_EXP
00290 #  define R_MIN_10_EXP FLT_MIN_10_EXP
00291 #  define R_MAX_10_EXP FLT_MAX_10_EXP
00292 #  define R_DIG FLT_DIG
00293 #  define CREAL crealf
00294 #  define CIMAG cimagf
00295 #else
00296 #  define CEIL ceil
00297 #  define FLOOR floor
00298 #  define ROUND round
00299 #  define FABS fabs
00300 #  define FMAX fmax
00301 #  define FMIN fmin
00302 #  define FREXP frexp
00303 #  define LDEXP ldexp
00304 #  define EPS DBL_EPSILON
00305 #  define R_MIN DBL_MIN
00306 #  define R_MAX DBL_MAX
00307 #  define R_MIN_EXP DBL_MIN_EXP
00308 #  define R_MAX_EXP DBL_MAX_EXP
00309 #  define R_MAX_10_EXP DBL_MAX_10_EXP
00310 #  define R_MIN_10_EXP DBL_MIN_10_EXP
00311 #  define R_DIG DBL_DIG
00312 #  define CREAL creal
00313 #  define CIMAG cimag
00314 #endif
00315 
00316 #if HAVE_DECL_DRAND48 == 0
00317   extern double drand48(void);
00318 #endif
00319 #if HAVE_DECL_SRAND48 == 0
00320   extern void srand48(long int);
00321 #endif
00322 #define RAND ((R)drand48())
00323 #define R_RADIX FLT_RADIX
00324 #define II _Complex_I
00325 
00326 /* format strings */
00327 #if defined(NFFT_LDOUBLE)
00328 #  define FE "LE"
00329 #elif defined(NFFT_SINGLE)
00330 #  define FE "E"
00331 #else
00332 #  define FE "lE"
00333 #endif
00334 
00335 #define TRUE 1
00336 #define FALSE 0
00337 
00339 #define UNUSED(x) (void)x
00340 
00341 #endif

Generated on 17 Aug 2009 by Doxygen 1.5.3