casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: aips2-request@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 //# $Id: Array.h 21545 2015-01-22 19:36:35Z gervandiepen $
26 
27 #ifndef SCIMATH_POISSONPARAM_H
28 #define SCIMATH_POISSONPARAM_H
29 
30 //# Includes
31 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 //# Forward declarations
38 
39 // <summary> A one dimensional Poisson function
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 // A 1-dimensional Poisson.
55 // </etymology>
56 
57 // <synopsis>
58 // A <src>Poisson</src> is described by lambda
59 // The value is:
60 // <srcblock>
61 // height (|x-center| == 0.0)
62 // 0 (|x-center| != 0.0)
63 // </srcblock>
64 // The parameters are enumerated by LAMDA. They have
65 // default values of 1.
66 // </synopsis>
67 //
68 // <example>
69 // <srcblock>
70 // PoissonFunction<Double> sf(5.0);
71 // sf(25); // = 5.0
72 // </srcblock>
73 // </example>
74 
75 // <templating arg=T>
76 // <li> T should have standard numerical operators
77 // </templating>
78 
79 // <thrown>
80 // <li> AipsError if incorrect parameter number specified.
81 // </thrown>
82 
83 template<class T> class PoissonParam : public Function<T>
84 {
85 public:
86  //# Enumerations
87  // Parameter numbers
88  enum { LAMBDA=0, HEIGHT};
89 
90  //# Constructors
91  // Constructs the Poisson, Defaults:
92  // lambda=1.
93  // <note role=warning> Could not use default arguments
94  // that worked both with gcc and IRIX </note>
95  // <group>
96  PoissonParam();
97  explicit PoissonParam(const T &lambda);
98  PoissonParam( const T &lambda, const T &height );
99  // </group>
100 
101  // Copy constructor (deep copy)
102  // <group>
103  PoissonParam(const PoissonParam<T> &other);
104  template <class W>
106  Function<T>(other) {}
107  // </group>
108  // Copy assignment (deep copy)
110 
111  // Destructor
112  virtual ~PoissonParam();
113 
114  //# Operators
115  virtual uInt ndim() const { return 1; }
116 
117  //# Member functions
118  // Give name of function
119  virtual const String &name() const {
120  static String x("poisson");
121  return x;
122  }
123 
124  // Get or set lambda
125 
126  T lambda() const {
127  return param_p[LAMBDA];
128  }
129  void setLambda(const T &lambda) {
130  param_p[LAMBDA] = lambda;
131  }
132 
133  T height() const {
134  return param_p[HEIGHT];
135  }
136  void setHeight(const T &height) {
137  param_p[HEIGHT] = height;
138  }
139  //# Make members of parent classes known.
140 protected:
141  using Function<T>::param_p;
142 public:
144 };
145 
146 
147 
148 
149 
150 } //# NAMESPACE CASACORE - END
151 
152 #ifndef CASACORE_NO_AUTO_TEMPLATES
153 #include <casacore/scimath/Functionals/PoissonParam.tcc>
154 #endif //# CASACORE_NO_AUTO_TEMPLATES
155 #endif
FunctionParam< T > param_p
The parameters and masks.
Definition: Function.h:332
A one dimensional Poisson function.
Definition: PoissonParam.h:83
T lambda() const
Get or set lambda.
Definition: PoissonParam.h:126
PoissonParam(const PoissonParam< W > &other)
Definition: PoissonParam.h:105
PoissonParam< T > & operator=(const PoissonParam< T > &other)
Copy assignment (deep copy)
Numerical functional interface class.
Definition: GenericL2Fit.h:46
virtual uInt ndim() const
Returns the number of dimensions of function.
Definition: PoissonParam.h:115
void setLambda(const T &lambda)
Definition: PoissonParam.h:129
void setHeight(const T &height)
Definition: PoissonParam.h:136
PoissonParam()
Constructs the Poisson, Defaults: lambda=1.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
virtual const String & name() const
Give name of function.
Definition: PoissonParam.h:119
unsigned int uInt
Definition: aipstype.h:51
virtual ~PoissonParam()
Destructor.