PoissonParam.h

Go to the documentation of this file.
00001 //# Copyright (C) 2002,2005
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 //# $Id: Array.h 21545 2015-01-22 19:36:35Z gervandiepen $
00026 
00027 #ifndef SCIMATH_POISSONPARAM_H
00028 #define SCIMATH_POISSONPARAM_H
00029 
00030 //# Includes
00031 #include <casacore/casa/aips.h>
00032 #include <casacore/scimath/Functionals/Function.h>
00033 #include <casacore/casa/BasicSL/String.h>
00034 
00035 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00036 
00037 //# Forward declarations
00038 
00039 // <summary> A one dimensional Poisson function
00040 // </summary>
00041 
00042 // <use visibility=local>
00043 
00044 // <reviewed reviewer="" date="" tests="tFunctionHolder" 
00045 // demos="">
00046 // </reviewed>
00047 
00048 // <prerequisite>
00049 //   <li> <linkto class="FunctionParam">FunctionParam</linkto> class
00050 //   <li> <linkto class="Function">Function</linkto> class
00051 // </prerequisite>
00052 
00053 // <etymology> 
00054 // A 1-dimensional Poisson.
00055 // </etymology>
00056 
00057 // <synopsis> 
00058 // A <src>Poisson</src> is described by lambda
00059 // The value is:
00060 // <srcblock>
00061 //      height          (|x-center| == 0.0)
00062 //      0               (|x-center| != 0.0)
00063 // </srcblock>
00064 // The parameters are enumerated by LAMDA. They have
00065 // default values of 1.
00066 // </synopsis> 
00067 //
00068 // <example>
00069 // <srcblock>
00070 //    PoissonFunction<Double> sf(5.0);
00071 //    sf(25);            // = 5.0
00072 // </srcblock>
00073 // </example>
00074 
00075 // <templating arg=T>
00076 //  <li> T should have standard numerical operators
00077 // </templating>
00078 
00079 // <thrown>
00080 //    <li> AipsError if incorrect parameter number specified.
00081 // </thrown>
00082 
00083 template<class T> class PoissonParam : public Function<T>
00084 {
00085 public:
00086   //# Enumerations
00087   // Parameter numbers
00088   enum { LAMBDA=0, HEIGHT};
00089   
00090   //# Constructors
00091   // Constructs the Poisson, Defaults:
00092   // lambda=1.
00093   // <note role=warning> Could not use default arguments
00094   // that worked both with gcc and IRIX </note>
00095   // <group>
00096   PoissonParam();
00097   explicit PoissonParam(const T &lambda);
00098   PoissonParam( const T &lambda, const T &height );
00099   // </group>
00100   
00101   // Copy constructor (deep copy)
00102   // <group>
00103   PoissonParam(const PoissonParam<T> &other);
00104   template <class W>
00105     PoissonParam(const PoissonParam<W> &other) :
00106     Function<T>(other) {}
00107   // </group>
00108   // Copy assignment (deep copy)
00109   PoissonParam<T> &operator=(const PoissonParam<T> &other);
00110     
00111   // Destructor
00112   virtual ~PoissonParam();
00113 
00114   //# Operators    
00115   virtual uInt ndim() const { return 1; }
00116 
00117   //# Member functions
00118   // Give name of function
00119   virtual const String &name() const {
00120           static String x("poisson");
00121           return x;
00122   }
00123 
00124   // Get or set lambda
00125 
00126    T lambda() const {
00127            return param_p[LAMBDA];
00128    }
00129    void setLambda(const T &lambda) {
00130            param_p[LAMBDA] = lambda;
00131    }
00132 
00133    T height() const {
00134            return param_p[HEIGHT];
00135       }
00136       void setHeight(const T &height) {
00137            param_p[HEIGHT] = height;
00138       }
00139   //# Make members of parent classes known.
00140 protected:
00141   using Function<T>::param_p;
00142 public:
00143   using Function<T>::nparameters;
00144 };
00145 
00146 
00147 
00148 
00149 
00150 } //# NAMESPACE CASACORE - END
00151 
00152 #ifndef CASACORE_NO_AUTO_TEMPLATES
00153 #include <casacore/scimath/Functionals/PoissonParam.tcc>
00154 #endif //# CASACORE_NO_AUTO_TEMPLATES
00155 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1