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 addressed 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$ 00028 00029 #ifndef LATTICES_LATTICEFFT_H 00030 #define LATTICES_LATTICEFFT_H 00031 00032 #include <casacore/casa/aips.h> 00033 #include <casacore/casa/BasicSL/Complex.h> 00034 00035 namespace casacore { //# NAMESPACE CASACORE - 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 // Non-folded version 00083 static void cfft0(Lattice<Complex> & cLattice, 00084 const Vector<Bool> & whichAxes, const Bool toFrequency=True); 00085 00086 // N-D in-place complex->complex FFT. Transform over all axes. 00087 static void cfft(Lattice<DComplex> & cLattice, const Bool toFrequency=True); 00088 static void cfft(Lattice<Complex> & cLattice, const Bool toFrequency=True); 00089 00090 // N-D real->complex FFT. Only one half of the Hermition result is 00091 // returned. Transforms are only done on selected dimensions. The origin of 00092 // the transform is the center of the Lattice ie., [nx/2,ny/2,...] if 00093 // doShift is True. Otherwise it is the first element ie., [0,0,...] 00094 static void rcfft(Lattice<Complex> & out, const Lattice<Float> & in, 00095 const Vector<Bool> & whichAxes, const Bool doShift=True, 00096 Bool doFast=False); 00097 00098 static void myrcfft(Lattice<Complex> & out, const Lattice<Float> & in, 00099 const Vector<Bool> & whichAxes, const Bool doShift=True); 00100 00101 // N-D real->complex FFT. Only one half of the Hermition result is 00102 // returned. Transform over all dimensions. The origin of 00103 // the transform is the center of the Lattice ie., [nx/2,ny/2,...] if 00104 // doShift is True. Otherwise it is the first element ie., [0,0,...] 00105 static void rcfft(Lattice<Complex> & out, const Lattice<Float> & in, 00106 const Bool doShift=True, Bool doFast=False); 00107 static void myrcfft(Lattice<Complex> & out, const Lattice<Float> & in, 00108 const Bool doShift=True); 00109 00110 // N-D complex->real FFT. Only one half of the Hermition input is 00111 // required. If whichAxis is specified Transforms are only done on selected 00112 // dimensions otherwise they are done on all axes. The origin of the 00113 // transform is the center of the Lattice ie., [nx/2,ny/2,...] if doShift is 00114 // True, otherwise it is the first element ie., [0,0,...] 00115 00116 // These functions will <b>scramble the input Lattice</b> unless the versions 00117 // with const inputs are used. The const input versions are less efficient as 00118 // they create a temporary Lattice and copy the input data into it. 00119 // <group> 00120 static void crfft(Lattice<Float> & out, Lattice<Complex> & in, 00121 const Vector<Bool> & whichAxes, 00122 const Bool doShift=True, Bool doFast=False); 00123 static void crfft(Lattice<Float> & out, Lattice<Complex> & in, 00124 const Bool doShift=True, Bool doFast=False); 00125 static void crfft(Lattice<Float> & out, const Lattice<Complex> & in, 00126 const Bool doShift=True, Bool doFast=False); 00127 // </group> 00128 }; 00129 00130 } //# NAMESPACE CASACORE - END 00131 00132 #endif