00001 00002 /*--------------------------------------------------------------------------- 00003 E.S.O. 00004 ---------------------------------------------------------------------------- 00005 File name : fft_base.h 00006 Author : N. Devillard 00007 Created on : October 1999 00008 Language : ANSI C 00009 Part of ECLIPSE library for Adonis 00010 Description : base FFT routines 00011 *--------------------------------------------------------------------------*/ 00012 00013 /* 00014 00015 $Id: fft_base.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $ 00016 $Author: amodigli $ 00017 $Date: 2003/09/03 12:50:47 $ 00018 $Revision: 1.1 $ 00019 00020 */ 00021 00022 #ifndef _FFT_BASE_H_ 00023 #define _FFT_BASE_H_ 00024 00025 /*--------------------------------------------------------------------------- 00026 Includes 00027 ---------------------------------------------------------------------------*/ 00028 00029 #include <math.h> 00030 #include "local_types.h" 00031 #include "memory.h" 00032 00033 /*--------------------------------------------------------------------------- 00034 Defines 00035 ---------------------------------------------------------------------------*/ 00036 00037 #define FFT_FORWARD 1 00038 #define FFT_INVERSE -1 00039 00040 00041 /*--------------------------------------------------------------------------- 00042 Function codes 00043 ---------------------------------------------------------------------------*/ 00044 00045 00046 /*--------------------------------------------------------------------------- 00047 Function : fftn 00048 In : complex array, array dimensions, # of dimensions, sign 00049 sign is defined as FFT_FORWARD or FFT_INVERSE 00050 Out : results are stored in input array 00051 Job : 2-dimensional FFT. Although the code is able to compute 00052 an FFT for any given number of dimensions, I would NOT 00053 trust it above 2, for I don't think it was tested. 00054 Notice : Public domain fft see extract of Usenet article below 00055 Found on: http://www.tu-chemnitz.de/~arndt/joerg.html 00056 ---------------------------------------------------------------------------*/ 00057 00058 /* 00059 * From: alee@tybalt.caltech.edu (Andrew Lee) 00060 * Newsgroups: comp.sources.misc 00061 * Subject: N-dimensional, Radix 2 FFT Routine 00062 * Date: 17 Jul 87 22:26:29 GMT 00063 * Approved: allbery@ncoast.UUCP 00064 * X-Archive: comp.sources.misc/8707/48 00065 * 00066 * [..] 00067 * Now for the usage (finally): 00068 * data[] is the array of complex numbers to be transformed, 00069 * nn[] is the array giving the dimensions (I mean size) of the array, 00070 * ndim is the number of dimensions of the array, and 00071 * isign is +1 for a forward transform, and -1 for an inverse transform. 00072 * 00073 * data[] and nn[] are stored in the "natural" order for C: 00074 * nn[0] gives the number of elements along the leftmost index, 00075 * nn[ndim - 1] gives the number of elements along the rightmost index, and 00076 * data should be declared along the lines of 00077 * struct (f)complex data[nn[0], nn[1], ..., nn[ndim - 1]] 00078 * 00079 * Additional notes: The routine does NO NORMALIZATION, so if you do a 00080 * forward, and then an inverse transform on an array, the result will 00081 * be identical to the original array MULTIPLIED BY THE NUMBER OF 00082 * ELEMENTS IN THE ARRAY. Also, of course, the dimensions of data[] 00083 * must all be powers of 2. 00084 * 00085 */ 00086 00087 void 00088 fftn( 00089 dcomplex data[], 00090 unsigned nn[], 00091 int ndim, 00092 int isign); 00093 00094 00095 /*---------------------------------------------------------------------------- 00096 * Function : is_power_of_2() 00097 * In : int 00098 * Out : int 00099 * Job : if the input number is a power of 2, the power is 00100 * returned. Otherwise, it returns -1. 00101 * Notice : 00102 * Example : is_power_of_2(1024) returns 10 00103 * is_power_of_2(1023) returns -1 00104 *--------------------------------------------------------------------------*/ 00105 00106 int is_power_of_2(int p); 00107 00108 00109 #endif 00110 /*--------------------------------------------------------------------------*/ 00111
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001