casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef SCIMATH_GNOISEFUNCTION_H
27#define SCIMATH_GNOISEFUNCTION_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/scimath/Functionals/GNoiseParam.h>
32#include <casacore/scimath/Functionals/Function.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// # Forward declarations
37
38// <summary> A one dimensional normal distribution
39// </summary>
40
41// <use visibility=export>
42
43// <reviewed reviewer="" date="" tests="tFunctionHolder"
44// demos="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class="GNoiseParam">GNoiseParam</linkto>
49// <li> <linkto class="Function">Function</linkto>
50// </prerequisite>
51
52// <etymology>
53// Gaussian Noise generator.
54// </etymology>
55
56// <synopsis>
57// A <src>GNoise</src> is described by a mean and a variance (Note these are
58// not parameters in the <src>Function</src> sense, but more like the
59// order of a polynomial. The defaults are 0 and 1.
60// </synopsis>
61//
62// <example>
63// <srcblock>
64// GNoiseFunction<Double> sf;
65// sf(); // = 0.12
66// </srcblock>
67// </example>
68
69// <templating arg=T>
70// <li> T should have standard numerical operators
71// </templating>
72
73// <thrown>
74// <li> AipsError if incorrect parameter number specified.
75// </thrown>
76//
77
78template <class T>
79class GNoiseFunction : public GNoiseParam<T> {
80 public:
81 // # Constructors
82 // Constructs the GNoise, Defaults:
83 // mean=0, var=1.0
84 // <group>
86 GNoiseFunction(const Double &mean, const Double &var) : GNoiseParam<T>(mean, var) {}
87 // </group>
88
89 // Copy constructor (deep copy)
90 // <group>
91 GNoiseFunction(const GNoiseFunction<T> &other) : GNoiseParam<T>(other) {}
92 template <class W>
93 GNoiseFunction(const GNoiseFunction<W> &other) : GNoiseParam<T>(other) {}
94 // </group>
95
96 // Copy assignment (deep copy)
99 return *this;
100 }
101
102 // Destructor
103 virtual ~GNoiseFunction() {}
104
105 // # Operators
106 // Evaluate the GNoise at <src>x</src>.
107 // If a vector is used as the argument only its first element is used.
108 // <group>
109 virtual T eval(typename Function<T>::FunctionArg x) const;
110 // </group>
111
112 // # Member functions
113 // Return a copy of this object from the heap. The caller is responsible
114 // for deleting this pointer.
115 // <group>
116 virtual Function<T> *clone() const { return new GNoiseFunction<T>(*this); }
117 // </group>
118
119 // # Make members of parent classes known.
120 protected:
121 using GNoiseParam<T>::param_p;
122
123 public:
124 using GNoiseParam<T>::noise_p;
125};
126
127} // namespace casacore
128
129#ifndef CASACORE_NO_AUTO_TEMPLATES
130#include <casacore/scimath/Functionals/GNoiseFunction.tcc>
131#endif // # CASACORE_NO_AUTO_TEMPLATES
132#endif
FunctionParam< T > param_p
The parameters and masks.
Definition Function.h:337
const ArgType * FunctionArg
Definition Function.h:204
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).
GNoiseFunction(const GNoiseFunction< W > &other)
GNoiseFunction()
Constructs the GNoise, Defaults: mean=0, var=1.0.
virtual Function< T > * clone() const
Return a copy of this object from the heap.
GNoiseFunction(const GNoiseFunction< T > &other)
Copy constructor (deep copy).
GNoiseParam()
Constructs the GNoise, Defaults: mean=0, var=1.0.
Normal noise_p
Normal noise.
GNoiseParam< T > & operator=(const GNoiseParam< T > &other)
Copy assignment (deep copy).
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
LatticeExprNode mean(const LatticeExprNode &expr)
double Double
Definition aipstype.h:53