casacore
Loading...
Searching...
No Matches
GNoiseParam.h
Go to the documentation of this file.
1// # GNoiseParam.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_GNOISEPARAM_H
27#define SCIMATH_GNOISEPARAM_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/scimath/Functionals/Function.h>
32#include <casacore/casa/BasicMath/Random.h>
33#include <casacore/casa/BasicSL/String.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward declarations
38
39// <summary> A one dimensional normal distribution
40// </summary>
41
42// <use visibility=local>
43
44// <reviewed reviewer="" date="" tests="tFunctionHolder"
45// demos="">
46// </reviewed>
47
48// <prerequisite>
49// <li> <linkto class="FunctionParam">FunctionParam</linkto> class
50// <li> <linkto class="Function">Function</linkto> class
51// </prerequisite>
52
53// <etymology>
54// Gaussian Noise generator.
55// </etymology>
56
57// <synopsis>
58// A <src>GNoise</src> is described by a mean and a variance (Note these are
59// not parameters in the <src>Function</src> sense, but more like the
60// order of a polynomial. The defaults are 0 and 1.
61// </synopsis>
62//
63// <example>
64// <srcblock>
65// GNoiseFunction<Double> sf;
66// sf(); // = 0.12
67// </srcblock>
68// </example>
69
70// <templating arg=T>
71// <li> T should have standard numerical operators
72// </templating>
73
74// <thrown>
75// <li> AipsError if incorrect parameter number specified.
76// </thrown>
77
78template <class T>
79class GNoiseParam : public Function<T> {
80 public:
81 // # Enumerations
82
83 // # Constructors
84 // Constructs the GNoise, Defaults:
85 // mean=0, var=1.0
86 // <group>
88 GNoiseParam(const Double &mean, const Double &var);
89 // </group>
90
91 // Copy constructor (deep copy)
92 // <group>
94 // </group>
95
96 // Copy assignment (deep copy)
98
99 // Destructor
100 virtual ~GNoiseParam();
101
102 // # Operators
103 virtual uInt ndim() const { return 0; }
104
105 // # Member functions
106 // Give name of function
107 virtual const String &name() const {
108 static String x("gaussnoise");
109 return x;
110 }
111
112 protected:
113 // # Data
114 // Random generator
116 // Normal noise
118
119 // # Make members of parent classes known.
120 protected:
121 using Function<T>::param_p;
122};
123
124} // namespace casacore
125
126#ifndef CASACORE_NO_AUTO_TEMPLATES
127#include <casacore/scimath/Functionals/GNoiseParam.tcc>
128#endif // # CASACORE_NO_AUTO_TEMPLATES
129#endif
Additive number generator.
Definition Random.h:222
FunctionParam< T > param_p
The parameters and masks.
Definition Function.h:337
Function()
Constructors.
Definition Function.h:209
ACG genit_p
Random generator.
GNoiseParam()
Constructs the GNoise, Defaults: mean=0, var=1.0.
GNoiseParam(const Double &mean, const Double &var)
Normal noise_p
Normal noise.
virtual const String & name() const
Give name of function.
virtual ~GNoiseParam()
Destructor.
GNoiseParam< T > & operator=(const GNoiseParam< T > &other)
Copy assignment (deep copy).
GNoiseParam(const GNoiseParam< T > &other)
Copy constructor (deep copy).
virtual uInt ndim() const
Returns the number of dimensions of function.
Normal or Gaussian distribution.
Definition Random.h:951
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
LatticeExprNode mean(const LatticeExprNode &expr)
unsigned int uInt
Definition aipstype.h:49
double Double
Definition aipstype.h:53