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