home/flatmax/personal/research.flatmax/fft/0000777000175000017500000000000011271165234021153 5ustar flatmaxflatmaxhome/flatmax/personal/research.flatmax/fft/realFFTData.H0000666000175000017500000000523211271160114023333 0ustar flatmaxflatmax/* Copyright 2001,2002 Matt Flax This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #ifndef REALFFTDATA_H_ #define REALFFTDATA_H_ #include "realFFT.H" #include #include using namespace std; #ifndef fftw_real #define fftw_real double #endif /// class realFFTData controls and manipulates fft data class realFFTData { /// Var used to specify if the memory was allocated by the realFFTData class int deleteInOutMemory; public: /// Specifies the size of the data array int size; /// Specifies the minimum and maximum power bins as used in the methods findMaxMinPowerBins and compPowerSpec int minPowerBin, maxPowerBin; /// the input, output and power_spectrum arrays fftw_real *in, *out, *power_spectrum; //, *powerDeriv; power deriv. removed for now /// The total power (summed) of the power spectrum as used in the method compPowerSpec double totalPower; /// All memory to be allocated internally realFFTData(int sz); /// input and output data arrays are to be allocated by another process realFFTData(int sz, fftw_real*inp, fftw_real*outp); /// Deconstructor ~realFFTData(void); /// Limits the maximum to 'lim' and returns the last fft bin with max int limitHalfPowerSpec(double lim); /// Returns the number of elements in the input and output arrays int getSize(void){return size;} /// Returns the number of elements in the power spectrum array int getHalfSize(void){ if (!(size%2)) return size/2; else return size/2+1;} /// Returns the maximum input variable fftw_real findMaxIn(void); /// Fills the max and min power spectrum bins void findMaxMinPowerBins(void); /// This function computes the power spectrum and returns the max bin int compPowerSpec(); /// This function computes the square root of the power spectrum and returns the max bin int sqrtPowerSpec(); // int powerSpecDeriv(); // Find the derivative of the power spectrum /// This function zeros the output data array (out) void zeroFFTData(void); }; #endif // REALFFTDATA_H_ home/flatmax/personal/research.flatmax/fft/complexFFT.H0000666000175000017500000000563210763157324023307 0ustar flatmaxflatmax/* Copyright 2001,2002 Matt Flax This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #ifndef COMPLEXFFT_H_ #define COMPLEXFFT_H_ #include #ifndef fftw_real #define fftw_real double #endif #define c_re(c) ((c)[0]) #define c_im(c) ((c)[1]) #include using namespace std; #define PLANTYPE FFTW_ESTIMATE /// class complexFFTData controls and manipulates complex fft data class complexFFTData { public: /// Specifies the size of the data array int size; /// the input and output arrays fftw_complex *in, *out; /// the power_spectrum array fftw_real *power_spectrum; /// The total power (summed) of the power spectrum as used in the method compPowerSpec double totalPower; /// Constructor with all memory to be allocated internally complexFFTData(int sz); /// Deconstructor ~complexFFTData(void); /// Use this to change associated fft data (for fft'ing) void switchData(complexFFTData *d); /// Limits the maximum to 'lim' and returns the last fft bin with max int limitHalfPowerSpec(double lim); /// Returns the number of elements in the input and output arrays int getSize(){return size;} // int getHalfSize(){ if (!(size%2)) return size/2; else return size/2+1;} /// This function computes the power spectrum and returns the max bin int compPowerSpec(); // int powerSpecDeriv(); // Find the derivative of the power spectrum }; ///class complexFFT controls fftw plans and executes fwd/inv transforms class complexFFT { /// The fwd/inv plans fftw_plan fwdPlan, invPlan; /// Method to create the plans void createPlan(void); /// Method to destroy the plans void destroyPlan(void); protected: // int size; /// The pointer to the relevant data complexFFTData *data; public: // complexFFT(int sz, char *ws=NULL); /// fft init ... data pointed to by 'd' complexFFT(complexFFTData *d); /// fft deconstructor ~complexFFT(); /// Use this to change associated fft data (for fft'ing) void switchData(complexFFTData *d); /// Forward transform the data (in to out) void fwdTransform(); // Forward fft /// Inverse transform the data (out to in) void invTransform(); // Inverse fft }; /** \example complexFFTExample.cc * This is an example of how to use the class. */ #endif // COMPLEXFFT_H_ home/flatmax/personal/research.flatmax/fft/realFFT.H0000666000175000017500000000365111271160146022551 0ustar flatmaxflatmax/* Copyright 2001,2002 Matt Flax This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #ifndef REALFFT_H_ #define REALFFT_H_ #include "realFFTData.H" #include #include using namespace std; class realFFTData; #define PLANTYPE FFTW_ESTIMATE ///class realFFT controls fftw plans and executes fwd/inv transforms class realFFT { /// The fwd/inv plans fftw_plan fwdPlan, invPlan; /// Method to create the plans void createPlan(void); /// Method to destroy the plans void destroyPlan(void); protected: /// The pointer to the relevant data realFFTData *data; public: /// fft init ... don't forget to associate data using switchData realFFT(void); /// fft init ... data pointed to by 'd' realFFT(realFFTData *d); /// fft deconstructor ~realFFT(void); /// Use this to change associated fft data (for fft'ing) void switchData(realFFTData *d); /// Forward transform the data (in to out) void fwdTransform(); // Forward fft /// Inverse transform the data (out to in) void invTransform(); // Inverse fft }; /** \example realFFTExample.cc * This is an example of how to use the class. * It transforms a sine tone stored in the .dat file and saves the * in, out, and power_spectrum results of using the class */ #endif // REALFFT_H_ home/flatmax/personal/research.flatmax/fft/Changelog0000666000175000017500000000130011271163004022750 0ustar flatmaxflatmaxv1.7 October 2009 * Fixed inverse transorm to work in realFFT and complexFFT v1.5 April 2005 * Alteres complex fftdata to use fftw_malloc and fftw_free. v1.4 : Fix merrory allocation error in real2DFFT.cc variable realXSum v1.3 : Change from fftw2 to fftw3 ... should be more efficient This is 100% backwards compatable with the API for v1.2 Re-documented (*.H -> html) ... API docs should be alot better Ensured all examples for realFFT, complexFFT and real2DFFT work v1.2 : complex fft switchData function implemented v1.1 : Change-log begun separated the realFFT and realFFTData classes improved the documentation fixed the realFFTExample example file other major adjustments not listed home/flatmax/personal/research.flatmax/fft/realFFTData.cc0000666000175000017500000001235611271160225023541 0ustar flatmaxflatmax/* Copyright 2001,2002 Matt Flax This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #include "realFFTData.H" #include #include #include #include realFFTData:: realFFTData(int sz){ deleteInOutMemory=1; //cout <<"realFFTData init:"<max) max=in[i]; // cout<<"max "<max) max=power_spectrum[maxPowerBin=i]; if (power_spectrum[i] max) max=power_spectrum[bin=i]; for (int i=0; imax){ max=power_spectrum[maxPowerBin=k]; } if (power_spectrum[k]max) max=power_spectrum[maxPowerBin=getSize()/2]; if (power_spectrum[getSize()/2]max) max=power_spectrum[maxPowerBin=k]; return maxPowerBin; } /* int realFFTData:: powerSpecDeriv(){ if (!powerDeriv){ // create memory if it doesn't exist powerDeriv = new fftw_real[size/2+1]; if (!powerDeriv){ std::cerr << "Could not allocate enough mem for a powerSpectrum deriv"< max){ max = fabs(powerDeriv[k] = power_spectrum[k]-power_spectrum[k-1]); pos = k; } } if (getSize() % 2 == 0) // N is even if (fabs(powerDeriv[getSize()/2] = power_spectrum[getSize()/2]-power_spectrum[getSize()/2-1]) > max){ max = fabs(powerDeriv[getSize()/2] = power_spectrum[getSize()/2]-power_spectrum[getSize()/2-1]); pos = getSize()/2; } return pos; } */ void realFFTData:: zeroFFTData(void){ //cout<<"here"< Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. home/flatmax/personal/research.flatmax/fft/real2DFFT.cc0000666000175000017500000001615111271160246023135 0ustar flatmaxflatmax/* Copyright 2001,2002 Matt Flax This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #include "real2DFFT.H" #include using namespace std; #include //#include real2DFFTData:: real2DFFTData(int r, int c){ // std::cout <<"real2DFFTData init:"<maxPower){ maxPower=temp; maxIndexX=i; maxIndexY=j; } if (temp void real2DFFTData:: compLogPowerSpec(){ int maxIndexX, maxIndexY; int minIndexX, minIndexY; totalPower=0.0; maxPower=-999999999.9, minPower=9999999.9; double temp; std::ofstream ofs("2Dfft.dat"); for (int i=0; i < x; i++){ // The x dimension int index=i*(y/2+1); for (int j=0;jmaxPower){ maxPower=temp; maxIndexX=i; maxIndexY=j; } if (temp ySumMax && j>2){ ySumMax=ySum[j]; maxYSumIndex=j; } } } void real2DFFTData:: timeSpecAverage(){ memset(timeXSum, 0, x*sizeof(fftw_real)); for (int i=0; i < x; i++){ // The x dimension int index=i*y; for (int j=0;jx*6/7) // std::cout< xSumMax){ xSumMax=xSum[i]; maxXSumIndex=i; } } for (int j=0;j ySumMax){ ySumMax=ySum[j]; maxYSumIndex=j; } } } real2DFFT:: real2DFFT(real2DFFTData *d) { //std::cout <<"realFFT init:"<getXSize() << '\t'<getYSize()<getXSize(), data->getYSize(), data->in, data->out, PLANTYPE); invPlan = fftw_plan_dft_c2r_2d(data->getXSize(), data->getYSize(), data->out, data->in, PLANTYPE); } real2DFFT:: ~real2DFFT(){ // std::cout <<"realFFT DeInit:"< This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #include "complexFFT.H" #include #include using namespace std; complexFFTData:: complexFFTData(int sz){ // std::cout <<"complexFFTData init:"<max){ max=power_spectrum[bin=k]; } totalPower += power_spectrum[k]; } /* if (getSize() % 2 == 0){ // N is even power_spectrum[getSize()/2] = out[getSize()/2]*out[getSize()/2]; // Nyquist freq. if (power_spectrum[getSize()/2]>max) max=power_spectrum[bin=getSize()/2]; totalPower += power_spectrum[getSize()/2]; }*/ return bin; } complexFFT:: complexFFT(complexFFTData *d) { // std::cout <<"complexFFT init:"<getSize(), data->in, data->out, FFTW_FORWARD, PLANTYPE); invPlan = fftw_plan_dft_1d(data->getSize(), data->out, data->in, FFTW_BACKWARD, PLANTYPE); } } void complexFFT:: switchData(complexFFTData *d){ //fftw_cleanup(); destroyPlan(); data=d; createPlan(); } void complexFFT:: fwdTransform(){ if (!data) std::cerr<<"complexFFT::fwdTransform : data not present, please switch data"<in, data->out); }*/ } void complexFFT:: invTransform(){ if (!data) std::cerr<<"complexFFT::invTransform : data not present, please switch data"<in, data->out); }*/ } home/flatmax/personal/research.flatmax/fft/Doxyfile0000666000175000017500000001560010763157324022671 0ustar flatmaxflatmax# Doxyfile 1.2.15 #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- PROJECT_NAME = "MFFM FFTw Wrapper" PROJECT_NUMBER = OUTPUT_DIRECTORY = OUTPUT_LANGUAGE = English EXTRACT_ALL = NO EXTRACT_PRIVATE = NO EXTRACT_STATIC = NO EXTRACT_LOCAL_CLASSES = YES HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = INTERNAL_DOCS = NO STRIP_CODE_COMMENTS = NO CASE_SENSE_NAMES = YES SHORT_NAMES = NO HIDE_SCOPE_NAMES = NO VERBATIM_HEADERS = YES SHOW_INCLUDE_FILES = YES JAVADOC_AUTOBRIEF = NO INHERIT_DOCS = YES INLINE_INFO = YES SORT_MEMBER_DOCS = YES DISTRIBUTE_GROUP_DOC = NO TAB_SIZE = 8 GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES ALIASES = ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO SHOW_USED_FILES = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = . FILE_PATTERNS = *.H RECURSIVE = NO EXCLUDE = EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = . EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO IMAGE_PATH = INPUT_FILTER = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = YES INLINE_SOURCES = NO REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = NO DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = NO LATEX_OUTPUT = latex LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4wide EXTRA_PACKAGES = LATEX_HEADER = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO RTF_OUTPUT = rtf COMPACT_RTF = NO RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO MAN_OUTPUT = man MAN_EXTENSION = .3 MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = NO #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::addtions related to external references #--------------------------------------------------------------------------- TAGFILES = GENERATE_TAGFILE = ALLEXTERNALS = NO EXTERNAL_GROUPS = YES PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = YES HAVE_DOT = NO CLASS_GRAPH = YES COLLABORATION_GRAPH = YES TEMPLATE_RELATIONS = YES HIDE_UNDOC_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES GRAPHICAL_HIERARCHY = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::addtions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO CGI_NAME = search.cgi CGI_URL = DOC_URL = DOC_ABSPATH = BIN_ABSPATH = /usr/local/bin/ EXT_DOC_PATHS = home/flatmax/personal/research.flatmax/fft/Makefile0000666000175000017500000000403611271164733022621 0ustar flatmaxflatmax#Copyright 2001,2002 Matt Flax #This file is part of the MFFM FFTw Wrapper library. # #MFFM MFFM FFTw Wrapper library is free software; you can #redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation; either version 2 of the License, or #(at your option) any later version. # #MFFM FFTw Wrapper library is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. # #You have received a copy of the GNU General Public License #along with the MFFM FFTw Wrapper library LIB = $(DESTDIR)/usr/lib INC = $(DESTDIR)/usr/include/mffm DOCS = $(DESTDIR)/usr/share/doc/mffm-fftw-dev CC=g++ -O3 .cc.o: $(CC) -fPIC -c $< .C.o: $(CC) -fPIC -c $< MAKELIB=$(CC) -shared -Wl,-soname #EXAMPLES= complexFFTExample real2DFFTExample realFFTExample SRC= realFFT.cc realFFTData.cc complexFFT.cc SRC2D= real2DFFT.cc OBJ=$(SRC:.cc=.o) OBJ2D=$(SRC2D:.cc=.o) all: $(OBJ) \ $(OBJ2D) \ libs \ docs \ ex docs: doxygen libs: $(MAKELIB),libfft.so.1 -o libfft.so.1 $(OBJ) $(MAKELIB),lib2Dfft.so.1 -o lib2Dfft.so.1 $(OBJ2D) ex: #fftw V2 # $(CC) *.o -lrfftw -lfftw complexFFTExample.cc -o complexFFTExample # $(CC) *.o -lrfftw -lfftw real2DFFTExample.cc -o real2DFFTExample # $(CC) *.o -lrfftw -lfftw realFFTExample.cc -o realFFTExample #fftw V3 # $(CC) *.o -lfftw3 complexFFTExample.cc -o complexFFTExample # $(CC) *.o -lfftw3 real2DFFTExample.cc -o real2DFFTExample # $(CC) *.o -lfftw3 realFFTExample.cc -o realFFTExample install: $(OBJ) \ $(OBJ2D) \ libs \ docs install --directory $(LIB) $(INC) $(DOCS)/html $(DOCS)/examples install lib* $(LIB) install -m 644 *.H $(INC) install html/* $(DOCS)/html install -m 644 complexFFTExample.cc real2DFFTExample.cc realFFTExample.cc sine.1000Hz.dat $(DOCS)/examples clean: rm -f $(EXAMPLES) *.o a.out *~ *.txt lib*.so.* complexFFTExample realFFTExample real2DFFTExample home/flatmax/personal/research.flatmax/fft/html/0000777000175000017500000000000011050726174022120 5ustar flatmaxflatmaxhome/flatmax/personal/research.flatmax/fft/html/classcomplexFFTData-members.html0000666000175000017500000000615010763157324030274 0ustar flatmaxflatmax Member List
Main Page   Compound List   File List   Compound Members   Examples  

complexFFTData Member List

This is the complete list of members for complexFFTData, including all inherited members.
complexFFTData(int sz)complexFFTData
compPowerSpec()complexFFTData
getSize()complexFFTData [inline]
incomplexFFTData
limitHalfPowerSpec(double lim)complexFFTData
outcomplexFFTData
power_spectrumcomplexFFTData
sizecomplexFFTData
switchData(complexFFTData *d)complexFFTData
totalPowercomplexFFTData
~complexFFTData(void)complexFFTData

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/classrealFFT.html0000666000175000017500000001013510763157324025324 0ustar flatmaxflatmax realFFT class Reference
Main Page   Compound List   File List   Compound Members   Examples  

realFFT Class Reference

class realFFT controls fftw plans and executes fwd/inv transforms More...

#include <realFFT.H>

List of all members.

Public Methods

 realFFT (void)
 fft init ... don't forget to associate data using switchData

 realFFT (realFFTData *d)
 fft init ... data pointed to by 'd'

 ~realFFT (void)
 fft deconstructor

void switchData (realFFTData *d)
 Use this to change associated fft data (for fft'ing).

void fwdTransform ()
 Forward transform the data (in to out).

void invTransform ()
 Inverse transform the data (out to in).


Protected Attributes

realFFTDatadata
 The pointer to the relevant data.


Detailed Description

class realFFT controls fftw plans and executes fwd/inv transforms
Examples:

realFFTExample.cc.

Definition at line 32 of file realFFT.H.


The documentation for this class was generated from the following file:
Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/real2DFFT_8H-source.html0000666000175000017500000003547110763157324026333 0ustar flatmaxflatmax real2DFFT.H Source File
Main Page   Compound List   File List   Compound Members   Examples  

real2DFFT.H

00001 /* Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
00002    This file is part of the MFFM FFTw Wrapper library.
00003 
00004    MFFM MFFM FFTw Wrapper library is free software; you can 
00005    redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009    
00010    MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014    
00015    You have received a copy of the GNU General Public License
00016    along with the MFFM FFTw Wrapper library
00017 */
00018 #ifndef REAL2DFFT_H_
00019 #define REAL2DFFT_H_
00020 
00021 #include <string.h>
00022 
00023 #include <fftw3.h>
00024 #ifndef fftw_real
00025 #define fftw_real double
00026 #endif
00027 #define c_re(c) ((c)[0])
00028 #define c_im(c) ((c)[1])
00029 
00030 #include <iomanip>
00031 using namespace std;
00032 
00033 #define PLANTYPE FFTW_ESTIMATE
00034 
00035 /// class real2DFFTData controls and manipulates real 2D fft data
00036 class real2DFFTData {
00037   /// x=row y=column
00038   int x, y;
00039   /// The total memory used by this class
00040   fftw_real *mem;
00041   /// Free the memory
00042   void memDeInit(void);
00043 public:
00044   /// The input data and power spectrum
00045   fftw_real *in, *power;
00046   /// The output data
00047   fftw_complex *out;
00048   /// Arrays which sum across rows (x) and columns (y)
00049   fftw_real *xSum, *ySum;
00050   /// A sum across the input time signal
00051   fftw_real *timeXSum;
00052   /// Power spectral sums across rows (x) and columns (y)
00053   fftw_real *realXSum, *imagXSum;
00054 
00055   /// The total power in the power spectrum, the maximum and minimum powers too
00056   double totalPower, maxPower, minPower;
00057   /// The minimum/maximum row (x) and column (y) sums
00058   double xSumMin, xSumMax, ySumMin, ySumMax;
00059   /// Row (x) and Column (y) max sum indexes
00060   int maxXSumIndex, maxYSumIndex;
00061 
00062   /// Constructor with all memory to be allocated internally
00063   real2DFFTData(int r, int c);
00064   /// Deconstructor
00065   ~real2DFFTData();
00066 
00067   /// The row count
00068   int getXSize(){return x;}
00069   /// The column count
00070   int getYSize(){return y;}
00071   /// The half row count
00072   int getXHalfSize(){ if (!(x%2)) return x/2; else return x/2+1;}
00073   /// The half column count
00074   int getYHalfSize(){ if (!(y%2)) return y/2; else return y/2+1;}
00075 
00076   /// Scales the output down by the number of elements
00077   void reScale(void);
00078   /// This function computes the power spectrum and updates the totalPower, maxPower and minPower
00079   void compPowerSpec(); // Find the power spectrum
00080   /// Finds 10*log10(power spectrum) and updates the totalPower, maxPower and minPower
00081   void compLogPowerSpec(); // Find the log power spectrum
00082 
00083   /// Updates timeXSum
00084   void timeSpecAverage();
00085   /// Updates realXSum and imagXSum
00086   void complexSpecAverage();
00087   /// Finds the power Spectrum averages and 
00088   /// updates the xSumMin, xSumMax, ySumMin, ySumMax, xSum, ySum, maxXSumIndex, maxYSumIndex
00089   void powerSpecAverage();
00090   /// Finds the y-sum between columns start and stop
00091   void findYSum(int start, int stop);
00092   /// Finds the y-max for the ySum array, updates ySumMin, ySumMax, maxYSumIndex
00093   void findYMax(void);
00094 
00095   /// Zeros the in array
00096   void clearInput(void){memset(in, 0, x*2*(y/2+1)*sizeof(fftw_real));}
00097   /// Zeros the out awway
00098   void clearOutput(void){memset(out, 0, x*(y/2+1)*sizeof(fftw_complex));}
00099 };
00100 
00101 ///class real2DFFT controls fftw plans and executes fwd/inv transforms
00102 class real2DFFT {
00103   /// The forward and inverse plans
00104   fftw_plan fwdPlan, invPlan;
00105 protected:
00106   /// The pointer to the relevant data
00107   real2DFFTData *data;
00108 public:
00109   /// fft init ... data pointed to by 'd'
00110   real2DFFT(real2DFFTData *d);
00111   /// fft deconstructor
00112   ~real2DFFT();
00113 
00114   /// Forward transform the data (in to out)
00115   void fwdTransform(); // Forward 2D fft
00116   /// Inverse transform the data (out to in)
00117   void invTransform(); // Inverse 2D fft
00118 };
00119 /** \example real2DFFTExample.cc
00120  * This is an example of how to use the class.
00121  */
00122 #endif // REAL2DFFT_H_

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/realFFTData_8H-source.html0000666000175000017500000002177510763157324026741 0ustar flatmaxflatmax realFFTData.H Source File
Main Page   Compound List   File List   Compound Members   Examples  

realFFTData.H

00001 /* Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
00002    This file is part of the MFFM FFTw Wrapper library.
00003 
00004    MFFM MFFM FFTw Wrapper library is free software; you can 
00005    redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009    
00010    MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014    
00015    You have received a copy of the GNU General Public License
00016    along with the MFFM FFTw Wrapper library
00017 */
00018 #ifndef REALFFTDATA_H_
00019 #define REALFFTDATA_H_
00020 
00021 #include "realFFT.H"
00022 #include <fftw3.h>
00023 
00024 #include <iomanip.h>
00025 using namespace std;
00026 
00027 #ifndef fftw_real
00028 #define fftw_real double
00029 #endif
00030 
00031 /// class realFFTData controls and manipulates fft data
00032 class realFFTData {
00033   /// Var used to specify if the memory was allocated by the realFFTData class
00034   int deleteInOutMemory;
00035 public:
00036   /// Specifies the size of the data array
00037   int size;
00038   /// Specifies the minimum and maximum power bins as used in the methods findMaxMinPowerBins and compPowerSpec
00039   int minPowerBin, maxPowerBin;
00040   /// the input, output and power_spectrum arrays
00041   fftw_real *in, *out, *power_spectrum; //, *powerDeriv; power deriv. removed for now
00042   /// The total power (summed) of the power spectrum as used in the method compPowerSpec
00043   double totalPower;
00044 
00045   /// All memory to be allocated internally
00046   realFFTData(int sz);
00047   /// input and output data arrays are to be allocated by another process
00048   realFFTData(int sz, fftw_real*inp, fftw_real*outp);
00049   /// Deconstructor
00050   ~realFFTData(void);
00051 
00052   /// Limits the maximum to 'lim' and returns the last fft bin with max
00053   int limitHalfPowerSpec(double lim); 
00054 
00055   /// Returns the number of elements in the input and output arrays
00056   int getSize(void){return size;}
00057   /// Returns the number of elements in the power spectrum array
00058   int getHalfSize(void){ if (!(size%2)) return size/2; else return size/2+1;}
00059 
00060   /// Returns the maximum input variable
00061   fftw_real findMaxIn(void);
00062   /// Fills the max and min power spectrum bins
00063   void findMaxMinPowerBins(void);
00064 
00065   /// This function computes the power spectrum and returns the max bin
00066   int compPowerSpec();
00067   /// This function computes the square root of the power spectrum and returns the max bin
00068   int sqrtPowerSpec();
00069 
00070   //  int powerSpecDeriv(); // Find the derivative of the power spectrum
00071 
00072   /// This function zeros the output data array (out)
00073   void zeroFFTData(void);
00074 };
00075 #endif // REALFFTDATA_H_

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/index.html0000666000175000017500000000164610763157324024131 0ustar flatmaxflatmax Main Page
Main Page   Compound List   File List   Compound Members   Examples  

MFFM FFTw Wrapper Documentation


Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/classrealFFTData-members.html0000666000175000017500000001043210763157324027546 0ustar flatmaxflatmax Member List
Main Page   Compound List   File List   Compound Members   Examples  

realFFTData Member List

This is the complete list of members for realFFTData, including all inherited members.
compPowerSpec()realFFTData
findMaxIn(void)realFFTData
findMaxMinPowerBins(void)realFFTData
getHalfSize(void)realFFTData [inline]
getSize(void)realFFTData [inline]
inrealFFTData
limitHalfPowerSpec(double lim)realFFTData
maxPowerBinrealFFTData
minPowerBinrealFFTData
outrealFFTData
power_spectrumrealFFTData
realFFTData(int sz)realFFTData
realFFTData(int sz, fftw_real *inp, fftw_real *outp)realFFTData
sizerealFFTData
sqrtPowerSpec()realFFTData
totalPowerrealFFTData
zeroFFTData(void)realFFTData
~realFFTData(void)realFFTData

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/namespaces.html0000666000175000017500000000216510763157324025136 0ustar flatmaxflatmax Namespace Index
Main Page   Namespace List   Compound List   File List   Compound Members  

MFFM FFTw Wrapper Namespace List

Here is a list of all documented namespaces with brief descriptions:
std

Generated on Thu May 15 03:17:24 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/classreal2DFFTData-members.html0000666000175000017500000001612610763157324027742 0ustar flatmaxflatmax Member List
Main Page   Compound List   File List   Compound Members   Examples  

real2DFFTData Member List

This is the complete list of members for real2DFFTData, including all inherited members.
clearInput(void)real2DFFTData [inline]
clearOutput(void)real2DFFTData [inline]
complexSpecAverage()real2DFFTData
compLogPowerSpec()real2DFFTData
compPowerSpec()real2DFFTData
findYMax(void)real2DFFTData
findYSum(int start, int stop)real2DFFTData
getXHalfSize()real2DFFTData [inline]
getXSize()real2DFFTData [inline]
getYHalfSize()real2DFFTData [inline]
getYSize()real2DFFTData [inline]
imagXSumreal2DFFTData
inreal2DFFTData
maxPowerreal2DFFTData
maxXSumIndexreal2DFFTData
maxYSumIndexreal2DFFTData
minPowerreal2DFFTData
outreal2DFFTData
powerreal2DFFTData
powerSpecAverage()real2DFFTData
real2DFFTData(int r, int c)real2DFFTData
realXSumreal2DFFTData
reScale(void)real2DFFTData
timeSpecAverage()real2DFFTData
timeXSumreal2DFFTData
totalPowerreal2DFFTData
xSumreal2DFFTData
xSumMaxreal2DFFTData
xSumMinreal2DFFTData
ySumreal2DFFTData
ySumMaxreal2DFFTData
ySumMinreal2DFFTData
~real2DFFTData()real2DFFTData

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/classreal2DFFT.html0000666000175000017500000000675010763157324025522 0ustar flatmaxflatmax real2DFFT class Reference
Main Page   Compound List   File List   Compound Members   Examples  

real2DFFT Class Reference

class real2DFFT controls fftw plans and executes fwd/inv transforms More...

#include <real2DFFT.H>

List of all members.

Public Methods

 real2DFFT (real2DFFTData *d)
 fft init ... data pointed to by 'd'

 ~real2DFFT ()
 fft deconstructor

void fwdTransform ()
 Forward transform the data (in to out).

void invTransform ()
 Inverse transform the data (out to in).


Protected Attributes

real2DFFTDatadata
 The pointer to the relevant data.


Detailed Description

class real2DFFT controls fftw plans and executes fwd/inv transforms
Examples:

real2DFFTExample.cc.

Definition at line 102 of file real2DFFT.H.


The documentation for this class was generated from the following file:
Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/functions.html0000666000175000017500000002031110763157324025020 0ustar flatmaxflatmax Compound Member Index
Main Page   Compound List   File List   Compound Members   Examples  

MFFM FFTw Wrapper Compound Members

c | d | f | g | i | l | m | o | p | r | s | t | x | y | z | ~

Here is a list of all documented class members with links to the classes they belong to:

- c -

- d -

- f -

- g -

- i -

- l -

- m -

- o -

- p -

- r -

- s -

- t -

- x -

- y -

- z -

- ~ -


Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/classcomplexFFT-members.html0000666000175000017500000000417110763157324027503 0ustar flatmaxflatmax Member List
Main Page   Compound List   File List   Compound Members   Examples  

complexFFT Member List

This is the complete list of members for complexFFT, including all inherited members.
complexFFT(complexFFTData *d)complexFFT
datacomplexFFT [protected]
fwdTransform()complexFFT
invTransform()complexFFT
switchData(complexFFTData *d)complexFFT
~complexFFT()complexFFT

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/files.html0000666000175000017500000000277010763157324024123 0ustar flatmaxflatmax File Index
Main Page   Compound List   File List   Compound Members   Examples  

MFFM FFTw Wrapper File List

Here is a list of all documented files with brief descriptions:
complexFFT.H [code]
real2DFFT.H [code]
realFFT.H [code]
realFFTData.H [code]

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/doxygen.css0000666000175000017500000000341210763157324024314 0ustar flatmaxflatmaxH1 { text-align: center; } CAPTION { font-weight: bold } A.qindex {} A.qindexRef {} A.el { text-decoration: none; font-weight: bold } A.elRef { font-weight: bold } A.code { text-decoration: none; font-weight: normal; color: #4444ee } A.codeRef { font-weight: normal; color: #4444ee } A:hover { text-decoration: none; background-color: #f2f2ff } DL.el { margin-left: -1cm } DIV.fragment { width: 100%; border: none; background-color: #eeeeee } DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } TD.md { background-color: #f2f2ff; font-weight: bold; } TD.mdname1 { background-color: #f2f2ff; font-weight: bold; color: #602020; } TD.mdname { background-color: #f2f2ff; font-weight: bold; color: #602020; width: 600px; } DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold } DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } BODY { background: white } TD.indexkey { background-color: #eeeeff; font-weight: bold; padding-right : 10px; padding-top : 2px; padding-left : 10px; padding-bottom : 2px; margin-left : 0px; margin-right : 0px; margin-top : 2px; margin-bottom : 2px } TD.indexvalue { background-color: #eeeeff; font-style: italic; padding-right : 10px; padding-top : 2px; padding-left : 10px; padding-bottom : 2px; margin-left : 0px; margin-right : 0px; margin-top : 2px; margin-bottom : 2px } span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } home/flatmax/personal/research.flatmax/fft/html/classcomplexFFTData.html0000666000175000017500000001266010763157324026647 0ustar flatmaxflatmax complexFFTData class Reference
Main Page   Compound List   File List   Compound Members   Examples  

complexFFTData Class Reference

class complexFFTData controls and manipulates complex fft data More...

#include <complexFFT.H>

List of all members.

Public Methods

 complexFFTData (int sz)
 Constructor with all memory to be allocated internally.

 ~complexFFTData (void)
 Deconstructor.

void switchData (complexFFTData *d)
 Use this to change associated fft data (for fft'ing).

int limitHalfPowerSpec (double lim)
 Limits the maximum to 'lim' and returns the last fft bin with max.

int getSize ()
 Returns the number of elements in the input and output arrays.

int compPowerSpec ()
 This function computes the power spectrum and returns the max bin.


Public Attributes

int size
 Specifies the size of the data array.

fftw_complex * in
 the input and output arrays

fftw_complex * out
 the input and output arrays

fftw_real * power_spectrum
 the power_spectrum array

double totalPower
 The total power (summed) of the power spectrum as used in the method compPowerSpec.


Detailed Description

class complexFFTData controls and manipulates complex fft data
Examples:

complexFFTExample.cc.

Definition at line 35 of file complexFFT.H.


The documentation for this class was generated from the following file:
Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/classreal2DFFT-members.html0000666000175000017500000000364510763157324027152 0ustar flatmaxflatmax Member List
Main Page   Compound List   File List   Compound Members   Examples  

real2DFFT Member List

This is the complete list of members for real2DFFT, including all inherited members.
datareal2DFFT [protected]
fwdTransform()real2DFFT
invTransform()real2DFFT
real2DFFT(real2DFFTData *d)real2DFFT
~real2DFFT()real2DFFT

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/real2DFFTExample_8cc-example.html0000666000175000017500000001405210763157324030170 0ustar flatmaxflatmax Example Documentation
Main Page   Compound List   File List   Compound Members   Examples  

real2DFFTExample.cc

This is an example of how to use the class.

/* Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
   This file is part of the MFFM FFTw Wrapper library.

   MFFM MFFM FFTw Wrapper library is free software; you can 
   redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You have received a copy of the GNU General Public License
   along with the MFFM FFTw Wrapper library
*/
#include <string.h>
#include "real2DFFT.H"
#include <iomanip.h>
using namespace std;

int main(void){
  int x=8, y=8;
  real2DFFTData *fftData = new real2DFFTData(x,y);
  real2DFFT *fft= new real2DFFT(fftData);

  // clear the data
  fftData->clearInput();
  fftData->clearOutput();

  int temp=x/2, temp2=y/2;
  for (int j=0;j<x;j++)
    fftData->in[temp2+j*x]=10000.0;
  for (int j=0;j<y;j++)
    fftData->in[temp*y+j]=10000.0;
  //  fftData->in[temp*y+(y-1)/2]=20000.0;

  for (int i=0;i<fftData->getXSize();i++){
    for (int j=0;j<fftData->getYSize();j++)
      cout<<fftData->in[i*x+j]<<'\t';
    cout<<endl;
  }
  cout<<'\n'<<endl;
  fft->fwdTransform();
  fftData->reScale();
  fftData->compPowerSpec();
  fft->invTransform();

  for (int i=0;i<fftData->getXSize();i++){
    for (int j=0;j<fftData->getYSize();j++)
      cout<<fftData->in[i*x+j]<<'\t';
    cout<<endl;
  }
  cout<<'\n'<<endl;
  /*  for (int i=0;i<fftData.getXSize();i++){
    for (int j=0;j<fftData.getYHalfSize();j++)
      cout<<fftData.out[i][j].im<<'\t';
    cout<<endl;
    }*/
  for (int i=0;i<x;i++){
    for (int j=0;j<y/2+1;j++)
      cout<<fftData->power[i*(y/2+1)+j]<<'\t';
    cout<<endl;
  }
  delete fftData;
  delete fft;
}

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/annotated.html0000666000175000017500000000413710763157324024775 0ustar flatmaxflatmax Annotated Index
Main Page   Compound List   File List   Compound Members   Examples  

MFFM FFTw Wrapper Compound List

Here are the classes, structs, unions and interfaces with brief descriptions:
complexFFTClass complexFFT controls fftw plans and executes fwd/inv transforms
complexFFTDataClass complexFFTData controls and manipulates complex fft data
real2DFFTClass real2DFFT controls fftw plans and executes fwd/inv transforms
real2DFFTDataClass real2DFFTData controls and manipulates real 2D fft data
realFFTClass realFFT controls fftw plans and executes fwd/inv transforms
realFFTDataClass realFFTData controls and manipulates fft data

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/namespacestd.html0000666000175000017500000000346510763157324025472 0ustar flatmaxflatmax std Namespace Reference
Main Page   Namespace List   Compound List   File List   Compound Members  

std Namespace Reference


Detailed Description

Copyright 2001,2002 Matt Flax <flatmax@ieee.org> This file is part of the MFFM FFTw Wrapper library.

MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library


Generated on Thu May 15 03:17:24 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/complexFFT_8H-source.html0000666000175000017500000002350410763157324026663 0ustar flatmaxflatmax complexFFT.H Source File
Main Page   Compound List   File List   Compound Members   Examples  

complexFFT.H

00001 /* Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
00002    This file is part of the MFFM FFTw Wrapper library.
00003 
00004    MFFM MFFM FFTw Wrapper library is free software; you can 
00005    redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009    
00010    MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014    
00015    You have received a copy of the GNU General Public License
00016    along with the MFFM FFTw Wrapper library
00017 */
00018 #ifndef COMPLEXFFT_H_
00019 #define COMPLEXFFT_H_
00020 
00021 #include <fftw3.h>
00022 
00023 #ifndef fftw_real
00024 #define fftw_real double
00025 #endif
00026 #define c_re(c) ((c)[0])
00027 #define c_im(c) ((c)[1])
00028 
00029 #include <iomanip>
00030 using namespace std;
00031 
00032 #define PLANTYPE FFTW_ESTIMATE
00033 
00034 /// class complexFFTData controls and manipulates complex fft data
00035 class complexFFTData {
00036 public:
00037   /// Specifies the size of the data array
00038   int size;
00039   /// the input and output arrays
00040   fftw_complex *in, *out;
00041   /// the power_spectrum array
00042   fftw_real *power_spectrum;
00043   /// The total power (summed) of the power spectrum as used in the method compPowerSpec
00044   double totalPower;
00045 
00046   /// Constructor with all memory to be allocated internally
00047   complexFFTData(int sz);
00048   /// Deconstructor
00049   ~complexFFTData(void);
00050 
00051   /// Use this to change associated fft data (for fft'ing)
00052   void switchData(complexFFTData *d);
00053 
00054   /// Limits the maximum to 'lim' and returns the last fft bin with max  
00055   int limitHalfPowerSpec(double lim);
00056 
00057   /// Returns the number of elements in the input and output arrays
00058   int getSize(){return size;}
00059   //  int getHalfSize(){ if (!(size%2)) return size/2; else return size/2+1;}
00060 
00061   /// This function computes the power spectrum and returns the max bin
00062   int compPowerSpec();
00063   //  int powerSpecDeriv(); // Find the derivative of the power spectrum
00064 };
00065 
00066 ///class complexFFT controls fftw plans and executes fwd/inv transforms
00067 class complexFFT {
00068   /// The fwd/inv plans
00069   fftw_plan fwdPlan, invPlan;
00070   /// Method to create the plans
00071   void createPlan(void);
00072   /// Method to destroy the plans
00073   void destroyPlan(void);
00074 protected:
00075   //  int size;
00076   /// The pointer to the relevant data
00077   complexFFTData *data;
00078 public:
00079 
00080   //  complexFFT(int sz, char *ws=NULL);
00081   /// fft init ... data pointed to by 'd'
00082   complexFFT(complexFFTData *d);
00083   /// fft deconstructor
00084   ~complexFFT();
00085 
00086   /// Use this to change associated fft data (for fft'ing)
00087   void switchData(complexFFTData *d);
00088 
00089   /// Forward transform the data (in to out)
00090   void fwdTransform(); // Forward fft
00091   /// Inverse transform the data (out to in)
00092   void invTransform(); // Inverse fft
00093 };
00094 /** \example complexFFTExample.cc
00095  * This is an example of how to use the class.
00096  */
00097 #endif // COMPLEXFFT_H_

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/examples.html0000666000175000017500000000230110763157324024625 0ustar flatmaxflatmax Example Index
Main Page   Compound List   File List   Compound Members   Examples  

MFFM FFTw Wrapper Examples

Here is a list of all examples:
Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/classcomplexFFT.html0000666000175000017500000000761210763157324026056 0ustar flatmaxflatmax complexFFT class Reference
Main Page   Compound List   File List   Compound Members   Examples  

complexFFT Class Reference

class complexFFT controls fftw plans and executes fwd/inv transforms More...

#include <complexFFT.H>

List of all members.

Public Methods

 complexFFT (complexFFTData *d)
 fft init ... data pointed to by 'd'

 ~complexFFT ()
 fft deconstructor

void switchData (complexFFTData *d)
 Use this to change associated fft data (for fft'ing).

void fwdTransform ()
 Forward transform the data (in to out).

void invTransform ()
 Inverse transform the data (out to in).


Protected Attributes

complexFFTDatadata
 The pointer to the relevant data.


Detailed Description

class complexFFT controls fftw plans and executes fwd/inv transforms
Examples:

complexFFTExample.cc.

Definition at line 67 of file complexFFT.H.


The documentation for this class was generated from the following file:
Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/classrealFFTData.html0000666000175000017500000001735510763157324026131 0ustar flatmaxflatmax realFFTData class Reference
Main Page   Compound List   File List   Compound Members   Examples  

realFFTData Class Reference

class realFFTData controls and manipulates fft data More...

#include <realFFTData.H>

List of all members.

Public Methods

 realFFTData (int sz)
 All memory to be allocated internally.

 realFFTData (int sz, fftw_real *inp, fftw_real *outp)
 input and output data arrays are to be allocated by another process

 ~realFFTData (void)
 Deconstructor.

int limitHalfPowerSpec (double lim)
 Limits the maximum to 'lim' and returns the last fft bin with max.

int getSize (void)
 Returns the number of elements in the input and output arrays.

int getHalfSize (void)
 Returns the number of elements in the power spectrum array.

fftw_real findMaxIn (void)
 Returns the maximum input variable.

void findMaxMinPowerBins (void)
 Fills the max and min power spectrum bins.

int compPowerSpec ()
 This function computes the power spectrum and returns the max bin.

int sqrtPowerSpec ()
 This function computes the square root of the power spectrum and returns the max bin.

void zeroFFTData (void)
 This function zeros the output data array (out).


Public Attributes

int size
 Specifies the size of the data array.

int minPowerBin
 Specifies the minimum and maximum power bins as used in the methods findMaxMinPowerBins and compPowerSpec.

int maxPowerBin
 Specifies the minimum and maximum power bins as used in the methods findMaxMinPowerBins and compPowerSpec.

fftw_real * in
 the input, output and power_spectrum arrays

fftw_real * out
 the input, output and power_spectrum arrays

fftw_real * power_spectrum
 the input, output and power_spectrum arrays

double totalPower
 The total power (summed) of the power spectrum as used in the method compPowerSpec.


Detailed Description

class realFFTData controls and manipulates fft data
Examples:

realFFTExample.cc.

Definition at line 32 of file realFFTData.H.


The documentation for this class was generated from the following file:
Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/classrealFFT-members.html0000666000175000017500000000433010763157324026754 0ustar flatmaxflatmax Member List
Main Page   Compound List   File List   Compound Members   Examples  

realFFT Member List

This is the complete list of members for realFFT, including all inherited members.
datarealFFT [protected]
fwdTransform()realFFT
invTransform()realFFT
realFFT(void)realFFT
realFFT(realFFTData *d)realFFT
switchData(realFFTData *d)realFFT
~realFFT(void)realFFT

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/realFFT_8H-source.html0000666000175000017500000001442110763157324026135 0ustar flatmaxflatmax realFFT.H Source File
Main Page   Compound List   File List   Compound Members   Examples  

realFFT.H

00001 /* Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
00002    This file is part of the MFFM FFTw Wrapper library.
00003 
00004    MFFM MFFM FFTw Wrapper library is free software; you can 
00005    redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009    
00010    MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014    
00015    You have received a copy of the GNU General Public License
00016    along with the MFFM FFTw Wrapper library
00017 */
00018 #ifndef REALFFT_H_
00019 #define REALFFT_H_
00020 
00021 #include "realFFTData.H"
00022 #include <fftw3.h>
00023 
00024 #include <iomanip.h>
00025 using namespace std;
00026 
00027 class realFFTData;
00028 
00029 #define PLANTYPE FFTW_ESTIMATE
00030 
00031 ///class realFFT controls fftw plans and executes fwd/inv transforms
00032 class realFFT {
00033   /// The fwd/inv plans
00034   fftw_plan fwdPlan, invPlan;
00035 
00036   /// Method to create the plans
00037   void createPlan(void);
00038   /// Method to destroy the plans
00039   void destroyPlan(void);
00040 protected:
00041   /// The pointer to the relevant data
00042   realFFTData *data;
00043 public:
00044   /// fft init ... don't forget to associate data using switchData
00045   realFFT(void);
00046   /// fft init ... data pointed to by 'd'
00047   realFFT(realFFTData *d);
00048   /// fft deconstructor
00049   ~realFFT(void);
00050 
00051   /// Use this to change associated fft data (for fft'ing)
00052   void switchData(realFFTData *d);
00053 
00054   /// Forward transform the data (in to out)
00055   void fwdTransform(); // Forward fft
00056   /// Inverse transform the data (out to in)
00057   void invTransform(); // Inverse fft
00058 };
00059 /** \example realFFTExample.cc
00060  * This is an example of how to use the class.
00061  * It transforms a sine tone stored in the .dat file and saves the
00062  * in, out, and power_spectrum results of using the class
00063  */
00064 #endif // REALFFT_H_

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/realFFTExample_8cc-example.html0000666000175000017500000001315010763157324030000 0ustar flatmaxflatmax Example Documentation
Main Page   Compound List   File List   Compound Members   Examples  

realFFTExample.cc

This is an example of how to use the class. It transforms a sine tone stored in the .dat file and saves the in, out, and power_spectrum results of using the class

/* Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
   This file is part of the MFFM FFTw Wrapper library.

   MFFM MFFM FFTw Wrapper library is free software; you can 
   redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You have received a copy of the GNU General Public License
   along with the MFFM FFTw Wrapper library
*/
#include <fstream>
#include <iomanip>

#include <mffm/realFFT.H>

#define INPUTFILE "sine.1000Hz.dat"
#define OUTPUTFILE "powerSpectrum.txt"
#define OUTPUTFILE1 "in.txt"
#define OUTPUTFILE2 "out.txt"

int main (void){
  ifstream input(INPUTFILE);
  ofstream output(OUTPUTFILE);
  ofstream output1(OUTPUTFILE1);
  ofstream output2(OUTPUTFILE2);
  int count=0;
  double var;
  // Get the file size and check file exists ....
  if (!input){
    cout <<"input not opened !"<<endl;
    exit(-1);
  }
  while (input >> var)
    count++;
  //input.close();
  
  cout<<count<<" variables in file "<<INPUTFILE<<endl;

  //input.open(INPUTFILE);
  input.clear();
  input.seekg(0);
 
  realFFTData fftData(count);
  realFFT rfft(&fftData);

  // read data into data and rdata :
  for (int i=0; i<count; i++)
    input >> fftData.in[i];
  input.close();

  // forward transform :
  rfft.fwdTransform();

  // Find the power spectrum ...
  fftData.compPowerSpec();
  /*
  // inverse transform to check what happens (have to rescale too): 
  rfft.invTransform();
  */
  // output to file :
  for (int i=0; i<(count+1)/2; i++){
    output << fftData.power_spectrum[i]<<'\n';
  }
  //  cout <<(count+1)/2<<endl;
  output.close();

  for (int i=0; i<count; i++){
    output1 << fftData.in[i]<<'\n';
    output2 << fftData.out[i]<<'\n';
  }
  output1.close();
  output2.close();
  return 0;
}

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/classreal2DFFTData.html0000666000175000017500000003152010763157324026305 0ustar flatmaxflatmax real2DFFTData class Reference
Main Page   Compound List   File List   Compound Members   Examples  

real2DFFTData Class Reference

class real2DFFTData controls and manipulates real 2D fft data More...

#include <real2DFFT.H>

List of all members.

Public Methods

 real2DFFTData (int r, int c)
 Constructor with all memory to be allocated internally.

 ~real2DFFTData ()
 Deconstructor.

int getXSize ()
 The row count.

int getYSize ()
 The column count.

int getXHalfSize ()
 The half row count.

int getYHalfSize ()
 The half column count.

void reScale (void)
 Scales the output down by the number of elements.

void compPowerSpec ()
 This function computes the power spectrum and updates the totalPower, maxPower and minPower.

void compLogPowerSpec ()
 Finds 10*log10(power spectrum) and updates the totalPower, maxPower and minPower.

void timeSpecAverage ()
 Updates timeXSum.

void complexSpecAverage ()
 Updates realXSum and imagXSum.

void powerSpecAverage ()
void findYSum (int start, int stop)
 Finds the y-sum between columns start and stop.

void findYMax (void)
 Finds the y-max for the ySum array, updates ySumMin, ySumMax, maxYSumIndex.

void clearInput (void)
 Zeros the in array.

void clearOutput (void)
 Zeros the out awway.


Public Attributes

fftw_real * in
 The input data and power spectrum.

fftw_real * power
 The input data and power spectrum.

fftw_complex * out
 The output data.

fftw_real * xSum
 Arrays which sum across rows (x) and columns (y).

fftw_real * ySum
 Arrays which sum across rows (x) and columns (y).

fftw_real * timeXSum
 A sum across the input time signal.

fftw_real * realXSum
 Power spectral sums across rows (x) and columns (y).

fftw_real * imagXSum
 Power spectral sums across rows (x) and columns (y).

double totalPower
 The total power in the power spectrum, the maximum and minimum powers too.

double maxPower
 The total power in the power spectrum, the maximum and minimum powers too.

double minPower
 The total power in the power spectrum, the maximum and minimum powers too.

double xSumMin
 The minimum/maximum row (x) and column (y) sums.

double xSumMax
 The minimum/maximum row (x) and column (y) sums.

double ySumMin
 The minimum/maximum row (x) and column (y) sums.

double ySumMax
 The minimum/maximum row (x) and column (y) sums.

int maxXSumIndex
 Row (x) and Column (y) max sum indexes.

int maxYSumIndex
 Row (x) and Column (y) max sum indexes.


Detailed Description

class real2DFFTData controls and manipulates real 2D fft data
Examples:

real2DFFTExample.cc.

Definition at line 36 of file real2DFFT.H.


Member Function Documentation

void real2DFFTData::powerSpecAverage  
 

Finds the power Spectrum averages and updates the xSumMin, xSumMax, ySumMin, ySumMax, xSum, ySum, maxXSumIndex, maxYSumIndex


The documentation for this class was generated from the following file:
Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/complexFFTExample_8cc-example.html0000666000175000017500000001027510763157324030531 0ustar flatmaxflatmax Example Documentation
Main Page   Compound List   File List   Compound Members   Examples  

complexFFTExample.cc

This is an example of how to use the class.

/* Copyright 2001,2002 Matt Flax <flatmax@ieee.org>
   This file is part of the MFFM FFTw Wrapper library.

   MFFM MFFM FFTw Wrapper library is free software; you can 
   redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   MFFM FFTw Wrapper library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You have received a copy of the GNU General Public License
   along with the MFFM FFTw Wrapper library
*/
#include <fstream>
#include <iomanip>

#include "complexFFT.H"
#include <iomanip.h>

int main (){
  int count =8;
  complexFFTData fftData(count);
  complexFFT fft(&fftData);

  for (int i=0;i<count;i++){
    c_re(fftData.in[i])=(double)i;
    //    fftData.in[i].im=(double)-i;
    c_im(fftData.in[i])=(double)i+5.0;
  }

  fftw_real *temp=&c_re(fftData.in[0]);
  for (int i=0; i<count; i++)
    cout << temp[i]<<endl;
  

  // forward transform :
  fft.fwdTransform();
  // inverse transform :
  fft.invTransform();

  //  for (int i=0; i<count; i++)
  //  cout << fftData.in[i].re<<' '<<fftData.in[i].im<<endl;

  // Find the power spectrum ...
  fftData.compPowerSpec();
  for (int i=0; i<count; i++)
    cout << fftData.power_spectrum[i]<<endl;
}

Generated on Thu Jun 19 11:21:56 2003 for MFFM FFTw Wrapper by doxygen1.2.18
home/flatmax/personal/research.flatmax/fft/html/doxygen.png0000666000175000017500000000446010763157324024314 0ustar flatmaxflatmax‰PNG  IHDRn5/pI˜tRNSÿÿÿ7X}bKGDÿÿâûËJ3IDATxÚíXklTUÞÄg44*TJw1)bD%¦`-í¶Á&úÃD%‰4¥Ñ"¿0!£‰ñ¶ñÕ¤ü&FiÒE¥QÐ>V(],Š„ÒǶ—v#?JBQ Oèõ;3çœ=Ûnw·õJÑÜÉäfvÎ73ß|»{{·Û5‡Ì3Óþ?æJé˜MYJO,›é-® ›Ž”@µeýÄŽØ•’m:RBAÛ±#v¥ds¥tÌ\)3WJÇÌ•Ò1s¥tÌ\)³iKÙ¥¤ÜïJÉ6=)ضEÞØ•’- 1&ZÖAÛ>ÍŽXKé™Üb6œ,ÿ'iÂñׯÇxÙt¤äÊ@à Ë ZV3]e`Û=¶ÝËŽ—zÿ `öCÀÎh ÍÆâZTô^âª3…Päi4Ï A@Ò0E##KéVšÞ¸•͉S“R´í°VM¹™ C)€óò^…ÇÁXMÂìÔGhŽŒÏ—Š+ ŠtS£#ï“ÁJw`ž‹ÀàŽŽeO®Uƒb ùýV­ÂV+ؤjN*¥15Ž”r[Ò±7¾+Q|ÍAÜͦ×üL}øá[ÑG;·!Á\㖃ƪÑÁ¤IBJü¹¾ÒŸqOd×ø^iYMà&¬;4Mè|:ú¶ÛTTô¬úèE’ZJcº˜›—— w㇙$™Þ¸û;8ÐmäY“¡Zä I L”b RZÝüäØiuâTåå=âóÍÏÏÏB,òÊÕs%=fŽ…L0®Œ¼èâ#ñ,5Öi6¡ZQˆï;Ý.2Õ£+Mo¬"}«Dõ­«©µ*ÍAoéÒûòóWt«r¦'ka• é)XI*씜i—¢¢U–NF­œHJ€>»ü»öîÐy¹Ë¿þúëæÌ™•ÿX&2¶qŠ#ŠO˜`6ÄÈèVeÛ˜‚¡f!q8¡G­}J½™âóÝ­›#xâñl&‰w±aï6õgz ³#ÝžÖ4í@Ã' y‚“–šbåz夤ì꨹2Ôreègqnéj¯õySxCAÔ›‚ ƒyÑK † pG͘ì†Ó$sýS*MZºÛk‹ Ÿ4Ÿ9FMé¨Õ|® ÿÜX÷ÃtþÞï×>‰wš‡BJÎóÚF…´WK¤ó°àÜøãG'FŽ0´­ä¾„äžè6)/_ª~±:YåóÎÓKz½óB'«é€zÄHRÌàj€¡¸Òà*F p«øªææã“½WÂö¯¿Æwk÷îqž`bâ$1¾û8çÏ£«þ"ÿîc?2Ìcè4';ãδ»oÉɸ“3ì¼v|’&“˜ù‰Éd†6Îû©Ï÷}zú :€ÉñÝYçY)üðJ¼Œ‰ÁÑŸ‡àãßd‰’òy–ÒYb罹ò§-±”0 Q3ƒǾ~ ?¸ì\sFsÆÑ¯Å—4&¬?˜Xó2 „ŸCUPT!F“˜…ÿÐñiK,¥Ä’¯Žýrѹ¦%ì%R&ƒá–­aãGÿ*Ãdÿì̬™ASÇiêÎ%¬ãUå<Ó¢MÎLi”PýñX㯲Žöµ,%,mÞìIm2ùWïêØ5-åË\)3WJÇÌ•Ò1s¥tÌ\)3WJÇÌ•Ò1s¥tÌ\)3WJÇÌ•Ò1s¥tÌ\)3WJÇÌ•Ò1s¥tÌþ¾cé*:MÊÂCtEXtSoftware@(#)ImageMagick 4.2.7 99/07/01 cristy@mystic.es.dupont.comkÃ*tEXtSignature5463a785bb11d367022701c77ebe81ab¾c÷tEXtPage110x53+0+0»EÑBIEND®B`‚home/flatmax/personal/research.flatmax/fft/real2DFFT.H0000666000175000017500000000763110763157324022752 0ustar flatmaxflatmax/* Copyright 2001,2002 Matt Flax This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #ifndef REAL2DFFT_H_ #define REAL2DFFT_H_ #include #include #ifndef fftw_real #define fftw_real double #endif #define c_re(c) ((c)[0]) #define c_im(c) ((c)[1]) #include using namespace std; #define PLANTYPE FFTW_ESTIMATE /// class real2DFFTData controls and manipulates real 2D fft data class real2DFFTData { /// x=row y=column int x, y; /// The total memory used by this class fftw_real *mem; /// Free the memory void memDeInit(void); public: /// The input data and power spectrum fftw_real *in, *power; /// The output data fftw_complex *out; /// Arrays which sum across rows (x) and columns (y) fftw_real *xSum, *ySum; /// A sum across the input time signal fftw_real *timeXSum; /// Power spectral sums across rows (x) and columns (y) fftw_real *realXSum, *imagXSum; /// The total power in the power spectrum, the maximum and minimum powers too double totalPower, maxPower, minPower; /// The minimum/maximum row (x) and column (y) sums double xSumMin, xSumMax, ySumMin, ySumMax; /// Row (x) and Column (y) max sum indexes int maxXSumIndex, maxYSumIndex; /// Constructor with all memory to be allocated internally real2DFFTData(int r, int c); /// Deconstructor ~real2DFFTData(); /// The row count int getXSize(){return x;} /// The column count int getYSize(){return y;} /// The half row count int getXHalfSize(){ if (!(x%2)) return x/2; else return x/2+1;} /// The half column count int getYHalfSize(){ if (!(y%2)) return y/2; else return y/2+1;} /// Scales the output down by the number of elements void reScale(void); /// This function computes the power spectrum and updates the totalPower, maxPower and minPower void compPowerSpec(); // Find the power spectrum /// Finds 10*log10(power spectrum) and updates the totalPower, maxPower and minPower void compLogPowerSpec(); // Find the log power spectrum /// Updates timeXSum void timeSpecAverage(); /// Updates realXSum and imagXSum void complexSpecAverage(); /// Finds the power Spectrum averages and /// updates the xSumMin, xSumMax, ySumMin, ySumMax, xSum, ySum, maxXSumIndex, maxYSumIndex void powerSpecAverage(); /// Finds the y-sum between columns start and stop void findYSum(int start, int stop); /// Finds the y-max for the ySum array, updates ySumMin, ySumMax, maxYSumIndex void findYMax(void); /// Zeros the in array void clearInput(void){memset(in, 0, x*2*(y/2+1)*sizeof(fftw_real));} /// Zeros the out awway void clearOutput(void){memset(out, 0, x*(y/2+1)*sizeof(fftw_complex));} }; ///class real2DFFT controls fftw plans and executes fwd/inv transforms class real2DFFT { /// The forward and inverse plans fftw_plan fwdPlan, invPlan; protected: /// The pointer to the relevant data real2DFFTData *data; public: /// fft init ... data pointed to by 'd' real2DFFT(real2DFFTData *d); /// fft deconstructor ~real2DFFT(); /// Forward transform the data (in to out) void fwdTransform(); // Forward 2D fft /// Inverse transform the data (out to in) void invTransform(); // Inverse 2D fft }; /** \example real2DFFTExample.cc * This is an example of how to use the class. */ #endif // REAL2DFFT_H_ home/flatmax/personal/research.flatmax/fft/README0000666000175000017500000000077310763157324022050 0ustar flatmaxflatmaxCopyright 1999,2000,2001,2002 Matt Flax This library acts as a C++ wrapper for the http://www.fftw.org FFT library. It provides many usefull functions, including data handling and manipulation. For API documentation, consult the html directory released with the sources For examples of how to use this library, consult the *Example* files. This library manages FFTw data. It also processes it to find power spectra and so on. It also manages the fft forward an inverse FFT routines. home/flatmax/personal/research.flatmax/fft/realFFTExample.cc0000666000175000017500000000426611271160765024275 0ustar flatmaxflatmax/* Copyright 2001,2002 Matt Flax This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #include #include using namespace std; #include #include #define INPUTFILE "sine.1000Hz.dat" #define OUTPUTFILE "powerSpectrum.txt" #define OUTPUTFILE1 "in.txt" #define OUTPUTFILE2 "out.txt" int main (void){ ifstream input(INPUTFILE); ofstream output(OUTPUTFILE); ofstream output1(OUTPUTFILE1); ofstream output2(OUTPUTFILE2); int count=0; double var; // Get the file size and check file exists .... if (!input){ cout <<"input not opened !"<> var) count++; //input.close(); cout<> fftData.in[i]; input.close(); // forward transform : rfft.fwdTransform(); // Find the power spectrum ... fftData.compPowerSpec(); for (int i=0; i This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #include #include using namespace std; #include "complexFFT.H" //#include int main (){ int count =8; complexFFTData fftData(count); complexFFT fft(&fftData); for (int i=0;i This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #include #include "real2DFFT.H" #include using namespace std; int main(void){ int x=8, y=8; real2DFFTData *fftData = new real2DFFTData(x,y); real2DFFT *fft= new real2DFFT(fftData); // clear the data fftData->clearInput(); fftData->clearOutput(); int temp=x/2, temp2=y/2; for (int j=0;jin[temp2+j*x]=10000.0; for (int j=0;jin[temp*y+j]=10000.0; // fftData->in[temp*y+(y-1)/2]=20000.0; for (int i=0;igetXSize();i++){ for (int j=0;jgetYSize();j++) cout<in[i*x+j]<<'\t'; cout<fwdTransform(); fftData->reScale(); fftData->compPowerSpec(); fft->invTransform(); for (int i=0;igetXSize();i++){ for (int j=0;jgetYSize();j++) cout<in[i*x+j]<<'\t'; cout<power[i*(y/2+1)+j]<<'\t'; cout< This file is part of the MFFM FFTw Wrapper library. MFFM MFFM FFTw Wrapper library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MFFM FFTw Wrapper library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You have received a copy of the GNU General Public License along with the MFFM FFTw Wrapper library */ #include "realFFT.H" #include #include realFFT:: realFFT(void) { // cout <<"realFFT init:"<getSize(), data->in, data->out, FFTW_R2HC, PLANTYPE); invPlan=fftw_plan_r2r_1d(data->getSize(), data->out, data->in, FFTW_HC2R, PLANTYPE); } } void realFFT:: switchData(realFFTData *d){ destroyPlan(); data=d; createPlan(); } void realFFT:: fwdTransform(){ if (!data) std::cerr<<"realFFT::fwdTransform : data not present, please switch data"<