casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
LatticeFFT.h
Go to the documentation of this file.
00001 //# LatticeFFT.h: Definitions for Lattice FFT functions
00002 //# Copyright (C) 1996,1997,1998,2003
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be adressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id: LatticeFFT.h 18093 2004-11-30 17:51:10Z ddebonis $
00028 
00029 #ifndef LATTICES_LATTICEFFT_H
00030 #define LATTICES_LATTICEFFT_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/BasicSL/Complex.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 template <class T> class Vector;
00038 template <class T> class Lattice;
00039 
00040 // <summary>Functions for Fourier transforming Lattices</summary>
00041 
00042 // <reviewed reviewer="" date="" tests="" demos="">
00043 // </reviewed>
00044 
00045 // <prerequisite>
00046 // </prerequisite>
00047 
00048 // <etymology>
00049 // </etymology>
00050 
00051 // <synopsis> 
00052 // </synopsis> 
00053 
00054 // <example>
00055 // <srcblock>
00056 // </srcblock>
00057 // </example>
00058 
00059 // <motivation>
00060 // </motivation>
00061 
00062 // <todo asof="">
00063 // </todo>
00064 
00065 class LatticeFFT
00066 {
00067 public: 
00068   // 2-D in-place complex->complex FFT. Transforms over the first two
00069   // dimensions and iterates over all the others. The Lattice must have two or
00070   // more dimensions otherwise an AipsError is thrown.
00071   static void cfft2d(Lattice<DComplex> & cLattice, const Bool toFrequency=True);
00072   static void cfft2d(Lattice<Complex> & cLattice, const Bool toFrequency=True);
00073   
00074   // N-D in-place complex->complex FFT. Only transform over selected
00075   // dimensions. Iterate over the others. whichAxes must be the same length as
00076   // the number of dimensions in the Lattice otherwise an AipsError is thrown.
00077   static void cfft(Lattice<DComplex> & cLattice,
00078                   const Vector<Bool> & whichAxes, const Bool toFrequency=True);
00079   static void cfft(Lattice<Complex> & cLattice,
00080                   const Vector<Bool> & whichAxes, const Bool toFrequency=True);
00081 
00082   // N-D in-place complex->complex FFT. Transform over all axes.
00083   static void cfft(Lattice<DComplex> & cLattice, const Bool toFrequency=True);
00084   static void cfft(Lattice<Complex> & cLattice, const Bool toFrequency=True);
00085 
00086   // N-D real->complex FFT. Only one half of the Hermition result is
00087   // returned. Transforms are only done on selected dimensions. The origin of
00088   // the transform is the center of the Lattice ie., [nx/2,ny/2,...] if
00089   // doShift is True. Otherwise it is the first element ie., [0,0,...]
00090   static void rcfft(Lattice<Complex> & out, const Lattice<Float> & in, 
00091                     const Vector<Bool> & whichAxes, const Bool doShift=True,
00092                     Bool doFast=False);
00093 
00094   static void myrcfft(Lattice<Complex> & out, const Lattice<Float> & in, 
00095                   const Vector<Bool> & whichAxes, const Bool doShift=True);
00096 
00097   // N-D real->complex FFT. Only one half of the Hermition result is
00098   // returned. Transform over all dimensions. The origin of
00099   // the transform is the center of the Lattice ie., [nx/2,ny/2,...] if
00100   // doShift is True. Otherwise it is the first element ie., [0,0,...]
00101   static void rcfft(Lattice<Complex> & out, const Lattice<Float> & in, 
00102                     const Bool doShift=True, Bool doFast=False);
00103   static void myrcfft(Lattice<Complex> & out, const Lattice<Float> & in, 
00104                   const Bool doShift=True);
00105 
00106   // N-D complex->real FFT. Only one half of the Hermition input is
00107   // required. If whichAxis is specified Transforms are only done on selected
00108   // dimensions otherwise they are done on all axes. The origin of the
00109   // transform is the center of the Lattice ie., [nx/2,ny/2,...] if doShift is
00110   // True, otherwise it is the first element ie., [0,0,...]  
00111 
00112   // These functions will <b>scramble the input Lattice</b> unless the versions
00113   // with const inputs are used. The const input versions are less efficient as
00114   // they create a temporary Lattice and copy the input data into it.
00115   // <group>
00116   static void crfft(Lattice<Float> & out, Lattice<Complex> & in, 
00117                     const Vector<Bool> & whichAxes,
00118                     const Bool doShift=True, Bool doFast=False);
00119   static void crfft(Lattice<Float> & out, Lattice<Complex> & in, 
00120                     const Bool doShift=True, Bool doFast=False);
00121   static void crfft(Lattice<Float> & out, const Lattice<Complex> & in, 
00122                     const Bool doShift=True, Bool doFast=False);
00123   // </group>
00124 };
00125 
00126 } //# NAMESPACE CASA - END
00127 
00128 #endif