casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
DFTServer.h
Go to the documentation of this file.
00001 //# DFTServer.h: This class contains methods for doing n-D slow Fourier transforms
00002 //# Copyright (C) 1994,1995,1996,1999,2000,2001,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 //# $Id: DFTServer.h 20229 2008-01-29 15:19:06Z gervandiepen $
00027 
00028 #ifndef SCIMATH_DFTSERVER_H
00029 #define SCIMATH_DFTSERVER_H
00030 
00031 
00032 #include <casa/aips.h>
00033 #include <casa/BasicMath/Math.h>
00034 #include <casa/Exceptions/Error.h>
00035 #include <casa/Arrays/Array.h>
00036 #include <casa/Arrays/ArrayMath.h>
00037 #include <casa/Arrays/ArrayIter.h> 
00038 #include <casa/Arrays/ArrayIO.h> 
00039 #include <casa/BasicSL/Constants.h> 
00040 #include <casa/math.h> 
00041 
00042 namespace casa { //# NAMESPACE CASA - BEGIN
00043 
00044 template<class T> class Matrix;
00045 
00046 // <summary>
00047 // Error class for <linkto class=DFTServer>DFTServer</linkto> class
00048 // </summary>
00049 
00050 // <synopsis>
00051 // Error class for <linkto class=DFTServer>DFTServer</linkto> class.
00052 // </synopsis>
00053 
00054 class DFTError: public AipsError
00055 {
00056 public:
00057    DFTError(): AipsError("DFTError") {}
00058    DFTError(const Char *m) : AipsError(m) {}
00059    DFTError(const String &m) : AipsError(m) {}
00060 
00061    virtual ~DFTError() throw() {}
00062 };
00063 
00064 // <summary>
00065 // Class containing methods for doing n-D slow Fourier transforms
00066 // </summary>
00067 
00068 // <synopsis>
00069 // The DFTServer class contains methods for doing n-dimensional 
00070 // Slow Fourier Transforms. (In practice, the maximum dimension is 3).
00071 //
00072 // </synopsis>
00073 
00074 template<class T> 
00075 class DFTServer 
00076 {
00077 public:
00078 // default constructor
00079    DFTServer();
00080 
00081 // copy constructor
00082    DFTServer(const DFTServer<T> &);
00083 
00084 // Other constructors
00085 // <group>
00086    DFTServer(Array<T> &, Array<T> &);
00087    DFTServer(int, int, int);
00088    DFTServer(IPosition &, IPosition &);
00089 // </group>
00090 
00091 // destructor
00092    ~DFTServer();
00093 
00094 // assignment
00095    DFTServer<T>  &operator=(const DFTServer<T> &);
00096 
00097 // n-d real <src> <-> </src> complex dft
00098    void rcdft(Array<T> &, Array<T> &);
00099 
00100 // n-d complex <src> <-> </src> real dft
00101    void crdft(Array<T> &, Array<T> &);
00102 
00103 // n-d complex <src> <-> </src> complex dft
00104    void cxdft(Array<T> &, Array<T> &, int);
00105 
00106 // display only the real component of the data 
00107    void showReal(Array<T> &);
00108 
00109 // display both the real and the imaginary components of the data 
00110    void showComplex(Array<T> &);
00111 
00112 private:
00113    // dimension of the both input and output data
00114    int dimension;
00115 
00116    // number of time data points
00117    int numTime;
00118 
00119    // number of frequency data points
00120    int numFreq;
00121 
00122    // set to 1 (true) if a crfft is done
00123    int crFlag;
00124 
00125 
00126 // does a complex to complex DFT
00127    void c2c(Matrix<T> &,  Matrix<T> &, int);
00128 
00129 // turn a general array into a matrix
00130    Matrix<T> getMatrix(Array<T> &);
00131 
00132 };
00133 
00134 
00135 } //# NAMESPACE CASA - END
00136 
00137 #ifndef CASACORE_NO_AUTO_TEMPLATES
00138 #include <scimath/Mathematics/DFTServer.tcc>
00139 #endif //# CASACORE_NO_AUTO_TEMPLATES
00140 #endif //DFT_SERVER