casacore
Loading...
Searching...
No Matches
HyperPlaneParam.h
Go to the documentation of this file.
1//# HyperPlaneParam.h: Parameters For a hyper plane function
2//# Copyright (C) 2001,2002,2004,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: casa-feedback@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#ifndef SCIMATH_HYPERPLANEPARAM_H
27#define SCIMATH_HYPERPLANEPARAM_H
28
29
30#include <casacore/casa/aips.h>
31#include <casacore/scimath/Functionals/Function.h>
32#include <casacore/casa/BasicSL/String.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36// <summary> Parameter handling for a hyper plane function.
37// </summary>
38//
39// <use visibility=local>
40// <reviewed reviewer="wbrouw" date="2004/05/25" tests="tHyperPlane" demos="">
41// </reviewed>
42//
43// <prerequisite>
44// <li> <linkto class="FunctionParam">FunctionParam</linkto> class
45// <li> <linkto class="Function">Function</linkto> class
46// </prerequisite>
47//
48// <synopsis>
49// This class forms a function of the form
50// f(x<sub>0</sub>,x<sub>1</sub>,..,x<sub>m-1</sub>) =
51// p<sub>0</sub>*x<sub>0</sub> + p<sub>1</sub>*x<sub>1</sub> + ...
52// + p<sub>m-1</sub>*x<sub>m-1</sub>,
53// where p<sub>i</sub> are coefficients (parameters) and x<sub>i</sub>
54// are independent arguments.
55//
56// f(x<sub>0</sub>,x<sub>1</sub>,..,x<sub>m-1</sub>) represents a hyper plane
57// of dimension <src>m</src>.
58//
59// Since the <src>HyperPlane</src> is a <src>Function</src>, the derivatives
60// can be obtained as well.
61//
62// The parameter interface (see
63// <linkto class="FunctionParam">FunctionParam</linkto> class),
64// is used to provide an interface to the
65// <linkto module="Fitting">Fitting</linkto> classes.
66//
67// This class is in general used implicitly by the <src>HyperPlane</src>
68// class only.
69// </synopsis>
70//
71// <example>
72// <srcblock>
73// // form the hyper plane function of this form:
74// // 6*x0 + 2*x3
75// HyperPlane<Double> hyper(4); // 4-dim hyperplane
76// hyper.parameters()[0] = 6;
77// hyper.parameters()[3] = 2;
78// // Evaluate at x0=5, x3=7
79// Vector<Double> x(4);
80// x=0; x[0]=5; x[3]=7;
81// cout << "Hypervalue: " << hyper(x) << endl;
82// Hypervalue: 44
83// </srcblock>
84// </example>
85
86// <templating arg=T>
87// <li> T should have standard numerical operators and exp() function. Current
88// implementation only tested for real types (and their AutoDiffs).
89// </templating>
90
91// <thrown>
92// <li> Assertion in debug mode if attempt is made to set a negative width
93// <li> AipsError if incorrect parameter number specified.
94// </thrown>
95
96// <motivation>
97// This class was created to facilitate linear constraint functions
98// for the use of least-squares fits.
99// </motivation>
100
101// <todo asof="2004/05/22">
102// <li> Nothing I know of
103// </todo>
104
105template<class T> class HyperPlaneParam : public Function<T>
106{
107public:
108 //# Constructors
109 // Construct an m-dimensional hyper plane which has m parameters. By
110 // default, the coefficients are initialized to zero. The default plane has
111 // <src>m=0</src>
112 // <group>
113 explicit HyperPlaneParam(uInt m=0);
114 // </group>
115
116 // Copy constructor (deep copy)
117 // <group>
119 template <class W>
121 Function<T>(other) {}
122 // </group>
123
124 // Copy assignment (deep copy)
126
127 // Destructor
129
130 //# Operators
131 // Comparisons.
132 // HyperPlanes are equal if they are of the same order and have the same
133 // parameters
134 // <group>
135 Bool operator==(const HyperPlaneParam<T> &other) const {
136 return (this->param_p == other.param_p); }
137 Bool operator!=(const HyperPlaneParam<T> &other) const {
138 return (this->param_p != other.param_p); }
139 // </group>
140
141 //# Member functions
142 // Give name of function
143 virtual const String &name() const { static String x("hyperplane");
144 return x; }
145
146 // What is the dimension of the parameter list
147 virtual uInt ndim() const { return this->param_p.nelements(); }
148
149 //# Make members of parent classes known.
150protected:
151 using Function<T>::param_p;
152public:
153 using Function<T>::nparameters;
154};
155
156
157} //# NAMESPACE CASACORE - END
158
159#ifndef CASACORE_NO_AUTO_TEMPLATES
160#include <casacore/scimath/Functionals/HyperPlaneParam.tcc>
161#endif //# CASACORE_NO_AUTO_TEMPLATES
162#endif
FunctionParam< T > param_p
The parameters and masks.
Definition Function.h:330
uInt nparameters() const
Returns the number of parameters.
Definition Function.h:228
HyperPlaneParam(const HyperPlaneParam &other)
Copy constructor (deep copy)
HyperPlaneParam(uInt m=0)
Construct an m-dimensional hyper plane which has m parameters.
HyperPlaneParam(const HyperPlaneParam< W > &other)
virtual const String & name() const
Give name of function.
virtual ~HyperPlaneParam()
Destructor.
virtual uInt ndim() const
What is the dimension of the parameter list.
Bool operator==(const HyperPlaneParam< T > &other) const
Comparisons.
HyperPlaneParam< T > & operator=(const HyperPlaneParam< T > &other)
Copy assignment (deep copy)
Bool operator!=(const HyperPlaneParam< T > &other) const
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40