casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GNoiseParam.h
Go to the documentation of this file.
00001 //# GNoiseParam.h: A one dimensional normal distribution 
00002 //# Copyright (C) 2002,2005
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: GNoiseParam.h 21024 2011-03-01 11:46:18Z gervandiepen $
00027 
00028 #ifndef SCIMATH_GNOISEPARAM_H
00029 #define SCIMATH_GNOISEPARAM_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <scimath/Functionals/Function.h>
00034 #include <casa/BasicMath/Random.h>
00035 #include <casa/BasicSL/String.h>
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 //# Forward declarations
00040 
00041 // <summary> A one dimensional normal distribution 
00042 // </summary>
00043 
00044 // <use visibility=local>
00045 
00046 // <reviewed reviewer="" date="" tests="tFunctionHolder" 
00047 // demos="">
00048 // </reviewed>
00049 
00050 // <prerequisite>
00051 //   <li> <linkto class="FunctionParam">FunctionParam</linkto> class
00052 //   <li> <linkto class="Function">Function</linkto> class
00053 // </prerequisite>
00054 
00055 // <etymology> 
00056 // Gaussian Noise generator.
00057 // </etymology>
00058 
00059 // <synopsis> 
00060 // A <src>GNoise</src> is described by a mean and a variance (Note these are
00061 // not parameters in the <src>Function</src> sense, but more like the
00062 // order of a polynomial. The defaults are 0 and 1.
00063 // </synopsis> 
00064 //
00065 // <example>
00066 // <srcblock>
00067 //    GNoiseFunction<Double> sf;
00068 //    sf();            // = 0.12
00069 // </srcblock>
00070 // </example>
00071 
00072 // <templating arg=T>
00073 //  <li> T should have standard numerical operators
00074 // </templating>
00075 
00076 // <thrown>
00077 //    <li> AipsError if incorrect parameter number specified.
00078 // </thrown>
00079 
00080 template<class T> class GNoiseParam : public Function<T>
00081 {
00082 public:
00083   //# Enumerations
00084   
00085   //# Constructors
00086   // Constructs the GNoise, Defaults:
00087   // mean=0, var=1.0
00088   // <group>
00089   GNoiseParam();
00090   GNoiseParam(const Double &mean, const Double &var);
00091   // </group>
00092 
00093   // Copy constructor (deep copy)
00094   // <group>
00095   GNoiseParam(const GNoiseParam<T> &other);
00096   // </group>
00097 
00098   // Copy assignment (deep copy)
00099   GNoiseParam<T> &operator=(const GNoiseParam<T> &other);
00100     
00101   // Destructor
00102   virtual ~GNoiseParam();
00103 
00104   //# Operators    
00105   virtual uInt ndim() const { return 0; }
00106 
00107   //# Member functions
00108   // Give name of function
00109   virtual const String &name() const { static String x("gaussnoise");
00110     return x; }
00111 
00112 protected:
00113   //# Data
00114   // Random generator
00115   ACG genit_p;
00116   // Normal noise
00117   mutable Normal noise_p;
00118 
00119   //# Make members of parent classes known.
00120 protected:
00121   using Function<T>::param_p;
00122 };
00123 
00124 
00125 } //# NAMESPACE CASA - END
00126 
00127 #ifndef CASACORE_NO_AUTO_TEMPLATES
00128 #include <scimath/Functionals/GNoiseParam.tcc>
00129 #endif //# CASACORE_NO_AUTO_TEMPLATES
00130 #endif