casacore
Loading...
Searching...
No Matches
PoissonParam.h
Go to the documentation of this file.
1// # Copyright (C) 2002,2005
2// # Associated Universities, Inc. Washington DC, USA.
3// #
4// # This library is free software; you can redistribute it and/or modify it
5// # under the terms of the GNU Library General Public License as published by
6// # the Free Software Foundation; either version 2 of the License, or (at your
7// # option) any later version.
8// #
9// # This library is distributed in the hope that it will be useful, but WITHOUT
10// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12// # License for more details.
13// #
14// # You should have received a copy of the GNU Library General Public License
15// # along with this library; if not, write to the Free Software Foundation,
16// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17// #
18// # Correspondence concerning AIPS++ should be addressed as follows:
19// # Internet email: casa-feedback@nrao.edu.
20// # Postal address: AIPS++ Project Office
21// # National Radio Astronomy Observatory
22// # 520 Edgemont Road
23// # Charlottesville, VA 22903-2475 USA
24
25#ifndef SCIMATH_POISSONPARAM_H
26#define SCIMATH_POISSONPARAM_H
27
28// # Includes
29#include <casacore/casa/aips.h>
30#include <casacore/scimath/Functionals/Function.h>
31#include <casacore/casa/BasicSL/String.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// # Forward declarations
36
37// <summary> A one dimensional Poisson function
38// </summary>
39
40// <use visibility=local>
41
42// <reviewed reviewer="" date="" tests="tFunctionHolder"
43// demos="">
44// </reviewed>
45
46// <prerequisite>
47// <li> <linkto class="FunctionParam">FunctionParam</linkto> class
48// <li> <linkto class="Function">Function</linkto> class
49// </prerequisite>
50
51// <etymology>
52// A 1-dimensional Poisson.
53// </etymology>
54
55// <synopsis>
56// A <src>Poisson</src> is described by lambda
57// The value is:
58// <srcblock>
59// height (|x-center| == 0.0)
60// 0 (|x-center| != 0.0)
61// </srcblock>
62// The parameters are enumerated by LAMDA. They have
63// default values of 1.
64// </synopsis>
65//
66// <example>
67// <srcblock>
68// PoissonFunction<Double> sf(5.0);
69// sf(25); // = 5.0
70// </srcblock>
71// </example>
72
73// <templating arg=T>
74// <li> T should have standard numerical operators
75// </templating>
76
77// <thrown>
78// <li> AipsError if incorrect parameter number specified.
79// </thrown>
80
81template <class T>
82class PoissonParam : public Function<T> {
83 public:
84 // # Enumerations
85 // Parameter numbers
86 enum { LAMBDA = 0, HEIGHT };
87
88 // # Constructors
89 // Constructs the Poisson, Defaults:
90 // lambda=1.
91 // <note role=warning> Could not use default arguments
92 // that worked both with gcc and IRIX </note>
93 // <group>
95 explicit PoissonParam(const T &lambda);
96 PoissonParam(const T &lambda, const T &height);
97 // </group>
98
99 // Copy constructor (deep copy)
100 // <group>
102 template <class W>
103 PoissonParam(const PoissonParam<W> &other) : Function<T>(other) {}
104 // </group>
105 // Copy assignment (deep copy)
107
108 // Destructor
109 virtual ~PoissonParam();
110
111 // # Operators
112 virtual uInt ndim() const { return 1; }
113
114 // # Member functions
115 // Give name of function
116 virtual const String &name() const {
117 static String x("poisson");
118 return x;
119 }
120
121 // Get or set lambda
122
123 T lambda() const { return param_p[LAMBDA]; }
124 void setLambda(const T &lambda) { param_p[LAMBDA] = lambda; }
125
126 T height() const { return param_p[HEIGHT]; }
127 void setHeight(const T &height) { param_p[HEIGHT] = height; }
128 // # Make members of parent classes known.
129 protected:
130 using Function<T>::param_p;
131
132 public:
133 using Function<T>::nparameters;
134};
135
136} // namespace casacore
137
138#ifndef CASACORE_NO_AUTO_TEMPLATES
139#include <casacore/scimath/Functionals/PoissonParam.tcc>
140#endif // # CASACORE_NO_AUTO_TEMPLATES
141#endif
FunctionParam< T > param_p
The parameters and masks.
Definition Function.h:337
Function()
Constructors.
Definition Function.h:209
uInt nparameters() const
Returns the number of parameters.
Definition Function.h:226
PoissonParam< T > & operator=(const PoissonParam< T > &other)
Copy assignment (deep copy).
void setLambda(const T &lambda)
PoissonParam()
Constructs the Poisson, Defaults: lambda=1.
T lambda() const
Get or set lambda.
void setHeight(const T &height)
PoissonParam(const PoissonParam< W > &other)
virtual ~PoissonParam()
Destructor.
PoissonParam(const PoissonParam< T > &other)
Copy constructor (deep copy).
virtual const String & name() const
Give name of function.
PoissonParam(const T &lambda)
virtual uInt ndim() const
Returns the number of dimensions of function.
PoissonParam(const T &lambda, const T &height)
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
unsigned int uInt
Definition aipstype.h:49