casa
$Rev:20696$
|
Parameters for sum of parameterized Functions. More...
#include <CompoundParam.h>
Public Member Functions | |
CompoundParam () | |
The default constructor -- no functions, no parameters, nothing, the function operator returns a 0. | |
CompoundParam (const CompoundParam< T > &other) | |
Make this object a (deep) copy of other. | |
CompoundParam (const CompoundParam< T > &other, Bool) | |
template<class W > | |
CompoundParam (const CompoundParam< W > &other) | |
template<class W > | |
CompoundParam (const CompoundParam< W > &other, Bool) | |
CompoundParam< T > & | operator= (const CompoundParam< T > &other) |
virtual | ~CompoundParam () |
virtual const String & | name () const |
Give name of function. | |
uInt | addFunction (const Function< T > &newFunction) |
Add a function to the sum. | |
uInt | nFunctions () const |
Return the number of functions in the sum. | |
const Function< T > & | function (uInt which) const |
Return a reference to a specific Function. | |
uInt | parameterOffset (uInt which) const |
Get the offset in function parameterlist for function which. | |
uInt | parameterFunction (uInt which) const |
Get the function number belonging to parameter list element which. | |
uInt | parameterLocation (uInt which) const |
Return locpar. | |
virtual uInt | ndim () const |
Returns the dimension of functions in the linear combination. | |
Protected Attributes | |
PtrBlock< Function< T > * > | functionPtr_p |
Pointer to each added function. | |
Block< uInt > | paroff_p |
Index of offset for each function to its parameters in general list. | |
Block< uInt > | funpar_p |
Index of function belonging to parameter. | |
Block< uInt > | locpar_p |
Index of local parameter. | |
Private Attributes | |
uInt | ndim_p |
Number of dimensions of underlying functions. |
Parameters for sum of parameterized Functions.
Internal
This class takes an arbitrary number of Function objects, and generates a new, single function object. The parameters of the compound object are the union of all the parameters in the input objects.
When CompoundFunction is evaluated, the result is the sum of all the individual function values.
Note that any Function object (including another Compound object) can be part of a compound object.
Suppose for some reason we wanted the sum of x^2
plus a gaussian. We could form it as follows:
Polynomial<Float> x2(2); x[2] = 1.0; // x^2 Gaussian1D<Float> gauss(1.0, 0.0, 1.0); // e^{-x^2} CompoundParam<Float> sum; // sum == 0.0 sum.addFunction(x2); // sum == x^2 sum.addFunction(gauss); // sum == x^2+e^{-x^2} sum(2.0); // == 4 + e^-4 CompoundParam[0] = 2.0; // sum ==2x^2+e^{-x^2} sum(2.0); // == 8 + e^-4 // Set the height of the gaussian sum[parameterOffset[1] + Gaussian1D<Float>::HEIGHT] = 2.5;
This class was created to allow a non-linear least squares fitter to fit a (potentially) arbitrary number of functions (typically gaussians).
Definition at line 101 of file CompoundParam.h.
casa::CompoundParam< T >::CompoundParam | ( | ) |
The default constructor -- no functions, no parameters, nothing, the function operator returns a 0.
casa::CompoundParam< T >::CompoundParam | ( | const CompoundParam< T > & | other | ) |
Make this object a (deep) copy of other.
casa::CompoundParam< T >::CompoundParam | ( | const CompoundParam< T > & | other, |
Bool | |||
) | [inline] |
Definition at line 111 of file CompoundParam.h.
casa::CompoundParam< T >::CompoundParam | ( | const CompoundParam< W > & | other | ) | [inline] |
Definition at line 127 of file CompoundParam.h.
casa::CompoundParam< T >::CompoundParam | ( | const CompoundParam< W > & | other, |
Bool | |||
) | [inline] |
Definition at line 143 of file CompoundParam.h.
virtual casa::CompoundParam< T >::~CompoundParam | ( | ) | [virtual] |
uInt casa::CompoundParam< T >::addFunction | ( | const Function< T > & | newFunction | ) |
Add a function to the sum.
All functions must have the same ndim()
as the first one. Returns the (zero relative) number of the function just added.
Reimplemented in casa::CompoundFunction_PS< AutoDiff< T > >.
const Function<T>& casa::CompoundParam< T >::function | ( | uInt | which | ) | const [inline] |
Return a reference to a specific Function.
Definition at line 180 of file CompoundParam.h.
Referenced by casa::CompoundParam< AutoDiff< Double > >::CompoundParam().
virtual const String& casa::CompoundParam< T >::name | ( | ) | const [inline, virtual] |
Give name of function.
Reimplemented from casa::Function< T >.
Definition at line 167 of file CompoundParam.h.
virtual uInt casa::CompoundParam< T >::ndim | ( | ) | const [inline, virtual] |
Returns the dimension of functions in the linear combination.
Implements casa::Function< T >.
Definition at line 198 of file CompoundParam.h.
uInt casa::CompoundParam< T >::nFunctions | ( | ) | const [inline] |
Return the number of functions in the sum.
Definition at line 176 of file CompoundParam.h.
Referenced by casa::CompoundParam< AutoDiff< Double > >::function(), and casa::CompoundParam< AutoDiff< Double > >::parameterOffset().
CompoundParam<T>& casa::CompoundParam< T >::operator= | ( | const CompoundParam< T > & | other | ) |
uInt casa::CompoundParam< T >::parameterFunction | ( | uInt | which | ) | const [inline] |
Get the function number belonging to parameter list element which.
Definition at line 188 of file CompoundParam.h.
Referenced by casa::CompoundParam< AutoDiff< Double > >::CompoundParam().
uInt casa::CompoundParam< T >::parameterLocation | ( | uInt | which | ) | const [inline] |
Return locpar.
Definition at line 193 of file CompoundParam.h.
Referenced by casa::CompoundParam< AutoDiff< Double > >::CompoundParam().
uInt casa::CompoundParam< T >::parameterOffset | ( | uInt | which | ) | const [inline] |
Get the offset in function parameterlist for function which.
Definition at line 185 of file CompoundParam.h.
Referenced by casa::CompoundParam< AutoDiff< Double > >::CompoundParam().
PtrBlock<Function<T> *> casa::CompoundParam< T >::functionPtr_p [protected] |
Pointer to each added function.
Definition at line 208 of file CompoundParam.h.
Referenced by casa::CompoundParam< AutoDiff< Double > >::CompoundParam(), casa::CompoundParam< AutoDiff< Double > >::function(), and casa::CompoundParam< AutoDiff< Double > >::nFunctions().
Block<uInt> casa::CompoundParam< T >::funpar_p [protected] |
Index of function belonging to parameter.
Definition at line 212 of file CompoundParam.h.
Referenced by casa::CompoundParam< AutoDiff< Double > >::CompoundParam(), and casa::CompoundParam< AutoDiff< Double > >::parameterFunction().
Block<uInt> casa::CompoundParam< T >::locpar_p [protected] |
Index of local parameter.
Definition at line 214 of file CompoundParam.h.
Referenced by casa::CompoundParam< AutoDiff< Double > >::CompoundParam(), and casa::CompoundParam< AutoDiff< Double > >::parameterLocation().
uInt casa::CompoundParam< T >::ndim_p [private] |
Number of dimensions of underlying functions.
Definition at line 203 of file CompoundParam.h.
Referenced by casa::CompoundParam< AutoDiff< Double > >::ndim().
Block<uInt> casa::CompoundParam< T >::paroff_p [protected] |
Index of offset for each function to its parameters in general list.
Definition at line 210 of file CompoundParam.h.
Referenced by casa::CompoundParam< AutoDiff< Double > >::CompoundParam(), and casa::CompoundParam< AutoDiff< Double > >::parameterOffset().