casa
$Rev:20696$
|
00001 //# GNoiseFunction.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: GNoiseFunction.h 21024 2011-03-01 11:46:18Z gervandiepen $ 00027 00028 #ifndef SCIMATH_GNOISEFUNCTION_H 00029 #define SCIMATH_GNOISEFUNCTION_H 00030 00031 //# Includes 00032 #include <casa/aips.h> 00033 #include <scimath/Functionals/GNoiseParam.h> 00034 #include <scimath/Functionals/Function.h> 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 //# Forward declarations 00039 00040 // <summary> A one dimensional normal distribution 00041 // </summary> 00042 00043 // <use visibility=export> 00044 00045 // <reviewed reviewer="" date="" tests="tFunctionHolder" 00046 // demos=""> 00047 // </reviewed> 00048 00049 // <prerequisite> 00050 // <li> <linkto class="GNoiseParam">GNoiseParam</linkto> 00051 // <li> <linkto class="Function">Function</linkto> 00052 // </prerequisite> 00053 00054 // <etymology> 00055 // Gaussian Noise generator. 00056 // </etymology> 00057 00058 // <synopsis> 00059 // A <src>GNoise</src> is described by a mean and a variance (Note these are 00060 // not parameters in the <src>Function</src> sense, but more like the 00061 // order of a polynomial. The defaults are 0 and 1. 00062 // </synopsis> 00063 // 00064 // <example> 00065 // <srcblock> 00066 // GNoiseFunction<Double> sf; 00067 // sf(); // = 0.12 00068 // </srcblock> 00069 // </example> 00070 00071 // <templating arg=T> 00072 // <li> T should have standard numerical operators 00073 // </templating> 00074 00075 // <thrown> 00076 // <li> AipsError if incorrect parameter number specified. 00077 // </thrown> 00078 // 00079 00080 template<class T> class GNoiseFunction : public GNoiseParam<T> 00081 { 00082 public: 00083 //# Constructors 00084 // Constructs the GNoise, Defaults: 00085 // mean=0, var=1.0 00086 // <group> 00087 GNoiseFunction() : GNoiseParam<T>() {} 00088 GNoiseFunction(const Double &mean, const Double &var) : 00089 GNoiseParam<T>(mean, var) {} 00090 // </group> 00091 00092 // Copy constructor (deep copy) 00093 // <group> 00094 GNoiseFunction(const GNoiseFunction<T> &other) : GNoiseParam<T>(other) {} 00095 template <class W> 00096 GNoiseFunction(const GNoiseFunction<W> &other) : GNoiseParam<T>(other) {} 00097 // </group> 00098 00099 // Copy assignment (deep copy) 00100 GNoiseFunction<T> &operator=(const GNoiseFunction<T> &other) { 00101 GNoiseParam<T>::operator=(other); return *this; } 00102 00103 // Destructor 00104 virtual ~GNoiseFunction() {} 00105 00106 //# Operators 00107 // Evaluate the GNoise at <src>x</src>. 00108 // If a vector is used as the argument only its first element is used. 00109 // <group> 00110 virtual T eval(typename Function<T>::FunctionArg x) const; 00111 // </group> 00112 00113 //# Member functions 00114 // Return a copy of this object from the heap. The caller is responsible 00115 // for deleting this pointer. 00116 // <group> 00117 virtual Function<T> *clone() const { return new GNoiseFunction<T>(*this); } 00118 // </group> 00119 00120 //# Make members of parent classes known. 00121 protected: 00122 using GNoiseParam<T>::param_p; 00123 public: 00124 using GNoiseParam<T>::noise_p; 00125 }; 00126 00127 00128 } //# NAMESPACE CASA - END 00129 00130 #ifndef CASACORE_NO_AUTO_TEMPLATES 00131 #include <scimath/Functionals/GNoiseFunction.tcc> 00132 #endif //# CASACORE_NO_AUTO_TEMPLATES 00133 #endif