casacore
GNoiseFunction.h
Go to the documentation of this file.
1 //# GNoiseFunction.h: A one dimensional normal distribution
2 //# Copyright (C) 2002,2005
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef SCIMATH_GNOISEFUNCTION_H
29 #define SCIMATH_GNOISEFUNCTION_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/scimath/Functionals/GNoiseParam.h>
34 #include <casacore/scimath/Functionals/Function.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward declarations
39 
40 // <summary> A one dimensional normal distribution
41 // </summary>
42 
43 // <use visibility=export>
44 
45 // <reviewed reviewer="" date="" tests="tFunctionHolder"
46 // demos="">
47 // </reviewed>
48 
49 // <prerequisite>
50 // <li> <linkto class="GNoiseParam">GNoiseParam</linkto>
51 // <li> <linkto class="Function">Function</linkto>
52 // </prerequisite>
53 
54 // <etymology>
55 // Gaussian Noise generator.
56 // </etymology>
57 
58 // <synopsis>
59 // A <src>GNoise</src> is described by a mean and a variance (Note these are
60 // not parameters in the <src>Function</src> sense, but more like the
61 // order of a polynomial. The defaults are 0 and 1.
62 // </synopsis>
63 //
64 // <example>
65 // <srcblock>
66 // GNoiseFunction<Double> sf;
67 // sf(); // = 0.12
68 // </srcblock>
69 // </example>
70 
71 // <templating arg=T>
72 // <li> T should have standard numerical operators
73 // </templating>
74 
75 // <thrown>
76 // <li> AipsError if incorrect parameter number specified.
77 // </thrown>
78 //
79 
80 template<class T> class GNoiseFunction : public GNoiseParam<T>
81 {
82 public:
83  //# Constructors
84  // Constructs the GNoise, Defaults:
85  // mean=0, var=1.0
86  // <group>
88  GNoiseFunction(const Double &mean, const Double &var) :
89  GNoiseParam<T>(mean, var) {}
90  // </group>
91 
92  // Copy constructor (deep copy)
93  // <group>
94  GNoiseFunction(const GNoiseFunction<T> &other) : GNoiseParam<T>(other) {}
95  template <class W>
96  GNoiseFunction(const GNoiseFunction<W> &other) : GNoiseParam<T>(other) {}
97  // </group>
98 
99  // Copy assignment (deep copy)
101  GNoiseParam<T>::operator=(other); return *this; }
102 
103  // Destructor
104  virtual ~GNoiseFunction() {}
105 
106  //# Operators
107  // Evaluate the GNoise at <src>x</src>.
108  // If a vector is used as the argument only its first element is used.
109  // <group>
110  virtual T eval(typename Function<T>::FunctionArg x) const;
111  // </group>
112 
113  //# Member functions
114  // Return a copy of this object from the heap. The caller is responsible
115  // for deleting this pointer.
116  // <group>
117  virtual Function<T> *clone() const { return new GNoiseFunction<T>(*this); }
118  // </group>
119 
120  //# Make members of parent classes known.
121 protected:
123 public:
125 };
126 
127 
128 } //# NAMESPACE CASACORE - END
129 
130 #ifndef CASACORE_NO_AUTO_TEMPLATES
131 #include <casacore/scimath/Functionals/GNoiseFunction.tcc>
132 #endif //# CASACORE_NO_AUTO_TEMPLATES
133 #endif
const ArgType * FunctionArg
Definition: Function.h:207
GNoiseFunction(const Double &mean, const Double &var)
virtual T eval(typename Function< T >::FunctionArg x) const
Evaluate the GNoise at x.
virtual ~GNoiseFunction()
Destructor.
GNoiseFunction< T > & operator=(const GNoiseFunction< T > &other)
Copy assignment (deep copy)
virtual Function< T > * clone() const
Return a copy of this object from the heap.
GNoiseFunction(const GNoiseFunction< W > &other)
GNoiseFunction()
Constructs the GNoise, Defaults: mean=0, var=1.0.
GNoiseFunction(const GNoiseFunction< T > &other)
Copy constructor (deep copy)
GNoiseParam< T > & operator=(const GNoiseParam< T > &other)
Copy assignment (deep copy)
this file contains all the compiler specific defines
Definition: mainpage.dox:28
LatticeExprNode mean(const LatticeExprNode &expr)
double Double
Definition: aipstype.h:55