casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DiracDFunction.h
Go to the documentation of this file.
1 //# DiracDFunction.h: A one dimensional Dirac delta function
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_DIRACDFUNCTION_H
29 #define SCIMATH_DIRACDFUNCTION_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward declarations
39 
40 // <summary> A one dimensional Dirac delta function
41 // </summary>
42 
43 // <use visibility=export>
44 
45 // <reviewed reviewer="" date="" tests="tFunctionHolder"
46 // demos="">
47 // </reviewed>
48 
49 // <prerequisite>
50 // <li> <linkto class="DiracDParam">DiracDParam</linkto>
51 // <li> <linkto class="Function">Function</linkto>
52 // </prerequisite>
53 
54 // <etymology>
55 // A 1-dimensional Dirac delta.
56 // </etymology>
57 
58 // <synopsis>
59 // A <src>DiracD</src> is described by a height, a center and a width
60 // (halfwidth). The value is:
61 // <srcblock>
62 // height (|x-center| == 0.0)
63 // 0 (|x-center| != 0.0)
64 // </srcblock>
65 // The parameters are enumerated by HEIGHT, CENTER and WIDTH. They have
66 // default values of (1, 0).
67 // </synopsis>
68 //
69 // <example>
70 // <srcblock>
71 // DiracDFunction<Double> sf(5.0, 25.0);
72 // sf(25); // = 5.0
73 // </srcblock>
74 // </example>
75 
76 // <templating arg=T>
77 // <li> T should have standard numerical operators
78 // </templating>
79 
80 // <thrown>
81 // <li> AipsError if incorrect parameter number specified.
82 // </thrown>
83 //
84 
85 template<class T> class DiracDFunction : public DiracDParam<T>
86 {
87 public:
88  //# Constructors
89  // Constructs the DiracDFunction, Defaults:
90  // height=1, center=0.
91  // <note role=warning> Could not use default arguments
92  // that worked both with gcc and IRIX </note>
93  // <group>
95  explicit DiracDFunction(const T &height) :
96  DiracDParam<T>(height) {}
97  DiracDFunction(const T &height, const T &center) :
98  DiracDParam<T>(height, center) {}
99  // </group>
100 
101  // Copy constructor (deep copy)
102  // <group>
103  DiracDFunction(const DiracDFunction<T> &other) : DiracDParam<T>(other) {}
104  template <class W>
105  DiracDFunction(const DiracDFunction<W> &other) : DiracDParam<T>(other) {}
106  // </group>
107 
108  // Copy assignment (deep copy)
110  DiracDParam<T>::operator=(other); return *this; }
111 
112  // Destructor
113  virtual ~DiracDFunction() {}
114 
115  //# Operators
116  // Evaluate the DiracD at <src>x</src>.
117  // If a vector is used as the argument only its first element is used.
118  // <group>
119  virtual T eval(typename Function<T>::FunctionArg x) const;
120  // </group>
121 
122  //# Member functions
123  // Return a copy of this object from the heap. The caller is responsible
124  // for deleting this pointer.
125  // <group>
126  virtual Function<T> *clone() const { return new DiracDFunction<T>(*this); }
131  // </group>
132 
133  //# Make members of parent classes known.
134 protected:
136 public:
140 };
141 
142 
143 } //# NAMESPACE CASACORE - END
144 
145 #ifndef CASACORE_NO_AUTO_TEMPLATES
146 #include <casacore/scimath/Functionals/DiracDFunction.tcc>
147 #endif //# CASACORE_NO_AUTO_TEMPLATES
148 #endif
virtual ~DiracDFunction()
Destructor.
virtual T eval(typename Function< T >::FunctionArg x) const
Evaluate the DiracD at x.
DiracDParam< T > & operator=(const DiracDParam< T > &other)
Copy assignment (deep copy)
virtual Function< typename FunctionTraits< T >::BaseType > * cloneNonAD() const
DiracDFunction(const T &height)
virtual Function< T > * clone() const
Return a copy of this object from the heap.
DiracDFunction(const T &height, const T &center)
DiracDFunction()
Constructs the DiracDFunction, Defaults: height=1, center=0.
Numerical functional interface class.
Definition: GenericL2Fit.h:46
DiracDFunction(const DiracDFunction< W > &other)
DiracDFunction(const DiracDFunction< T > &other)
Copy constructor (deep copy)
A one dimensional Dirac delta function.
Definition: DiracDParam.h:84
DiracDFunction< T > & operator=(const DiracDFunction< T > &other)
Copy assignment (deep copy)
virtual Function< typename FunctionTraits< T >::DiffType > * cloneAD() const
A one dimensional Dirac delta function.