casacore
|
#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. | |
![]() | |
Function () | |
Constructors. | |
Function (const uInt n) | |
Function (const Vector< T > &in) | |
Function (const FunctionParam< T > &other) | |
template<class W , class X > | |
Function (const Function< W, X > &other) | |
virtual | ~Function () |
Destructor. | |
uInt | nparameters () const |
Returns the number of parameters. | |
virtual U | eval (FunctionArg x) const =0 |
Evaluate the function object. | |
T & | operator[] (const uInt n) |
Manipulate the nth parameter (0-based) with no index check. | |
const T & | operator[] (const uInt n) const |
virtual U | operator() () const |
Evaluate this function object at x or at x, y . | |
virtual U | operator() (const ArgType &x) const |
virtual U | operator() (const Vector< ArgType > &x) const |
virtual U | operator() (FunctionArg x) const |
virtual U | operator() (const ArgType &x, const ArgType &y) const |
virtual U | operator() (const ArgType &x, const ArgType &y, const ArgType &z) const |
Bool & | mask (const uInt n) |
Manipulate the mask associated with the nth parameter (e.g. | |
const Bool & | mask (const uInt n) const |
const FunctionParam< T > & | parameters () const |
Return the parameter interface. | |
FunctionParam< T > & | parameters () |
const Vector< ArgType > & | argp () const |
Get arg_p and parset_p . | |
Bool | parsetp () const |
void | lockParam () |
Compiler cannot always find the correct 'const' version of parameter access. | |
void | unlockParam () |
virtual void | setMode (const RecordInterface &mode) |
get/set the function mode. | |
virtual void | getMode (RecordInterface &mode) const |
virtual Bool | hasMode () const |
return True if the implementing function supports a mode. | |
ostream & | print (ostream &os) const |
Print the function (i.e. | |
virtual Function< T, U > * | clone () const =0 |
Return a copy of this object from the heap. | |
virtual Function< typename FunctionTraits< T >::DiffType > * | cloneAD () const |
virtual Function< typename FunctionTraits< T >::BaseType > * | cloneNonAD () const |
![]() | |
virtual | ~Functional () |
Destructor. | |
virtual Range | operator() (const Domain &x) const =0 |
Map a Domain x into a Range y value. | |
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. | |
![]() | |
FunctionParam< T > | param_p |
The parameters and masks. | |
Vector< ArgType > | arg_p |
Aid for non-contiguous argument storage. | |
Bool | parset_p |
Indicate parameter written. | |
Bool | locked_p |
Indicate that parameters are expected to be locked from changing. | |
Private Attributes | |
uInt | ndim_p |
Number of dimensions of underlying functions. | |
Additional Inherited Members | |
![]() | |
typedef FunctionTraits< T >::ArgType | ArgType |
typedef const ArgType * | FunctionArg |
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:
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 98 of file CompoundParam.h.
casacore::CompoundParam< T >::CompoundParam | ( | ) |
The default constructor – no functions, no parameters, nothing, the function operator returns a 0.
casacore::CompoundParam< T >::CompoundParam | ( | const CompoundParam< T > & | other | ) |
Make this object a (deep) copy of other.
|
inline |
Definition at line 108 of file CompoundParam.h.
References casacore::CompoundParam< T >::functionPtr_p, casacore::CompoundParam< T >::funpar_p, casacore::CompoundParam< T >::locpar_p, casacore::Block< T >::nelements(), and casacore::CompoundParam< T >::paroff_p.
|
inline |
Definition at line 124 of file CompoundParam.h.
References casacore::CompoundParam< T >::function(), casacore::CompoundParam< T >::functionPtr_p, casacore::CompoundParam< T >::funpar_p, casacore::CompoundParam< T >::locpar_p, casacore::Block< T >::nelements(), casacore::CompoundParam< T >::parameterFunction(), casacore::CompoundParam< T >::parameterLocation(), casacore::CompoundParam< T >::parameterOffset(), and casacore::CompoundParam< T >::paroff_p.
|
inline |
Definition at line 140 of file CompoundParam.h.
References casacore::CompoundParam< T >::function(), casacore::CompoundParam< T >::functionPtr_p, casacore::CompoundParam< T >::funpar_p, casacore::CompoundParam< T >::locpar_p, casacore::Block< T >::nelements(), casacore::CompoundParam< T >::parameterFunction(), casacore::CompoundParam< T >::parameterLocation(), casacore::CompoundParam< T >::parameterOffset(), and casacore::CompoundParam< T >::paroff_p.
|
virtual |
uInt casacore::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.
|
inline |
Return a reference to a specific Function.
Definition at line 177 of file CompoundParam.h.
References DebugAssert, casacore::CompoundParam< T >::functionPtr_p, and casacore::CompoundParam< T >::nFunctions().
Referenced by casacore::CompoundParam< T >::CompoundParam(), and casacore::CompoundParam< T >::CompoundParam().
|
inlinevirtual |
Give name of function.
Reimplemented from casacore::Function< T, U >.
Definition at line 164 of file CompoundParam.h.
|
inlinevirtual |
Returns the dimension of functions in the linear combination.
Implements casacore::Function< T, U >.
Definition at line 195 of file CompoundParam.h.
References casacore::CompoundParam< T >::ndim_p.
|
inline |
Return the number of functions in the sum.
Definition at line 173 of file CompoundParam.h.
References casacore::CompoundParam< T >::functionPtr_p.
Referenced by casacore::CompoundParam< T >::function(), and casacore::CompoundParam< T >::parameterOffset().
CompoundParam< T > & casacore::CompoundParam< T >::operator= | ( | const CompoundParam< T > & | other | ) |
Referenced by casacore::CompoundFunction< T >::operator=().
|
inline |
Get the function number belonging to parameter list element which.
Definition at line 185 of file CompoundParam.h.
References DebugAssert, casacore::CompoundParam< T >::funpar_p, and casacore::Function< T, U >::nparameters().
Referenced by casacore::CompoundParam< T >::CompoundParam(), and casacore::CompoundParam< T >::CompoundParam().
|
inline |
Return locpar.
Definition at line 190 of file CompoundParam.h.
References DebugAssert, casacore::CompoundParam< T >::locpar_p, and casacore::Function< T, U >::nparameters().
Referenced by casacore::CompoundParam< T >::CompoundParam(), and casacore::CompoundParam< T >::CompoundParam().
|
inline |
Get the offset in function parameterlist for function which.
Definition at line 182 of file CompoundParam.h.
References DebugAssert, casacore::CompoundParam< T >::nFunctions(), and casacore::CompoundParam< T >::paroff_p.
Referenced by casacore::CompoundParam< T >::CompoundParam(), and casacore::CompoundParam< T >::CompoundParam().
|
protected |
Pointer to each added function.
Definition at line 205 of file CompoundParam.h.
Referenced by casacore::CompoundParam< T >::CompoundParam(), casacore::CompoundParam< T >::CompoundParam(), casacore::CompoundParam< T >::CompoundParam(), casacore::CompoundParam< T >::function(), and casacore::CompoundParam< T >::nFunctions().
|
protected |
Index of function belonging to parameter.
Definition at line 209 of file CompoundParam.h.
Referenced by casacore::CompoundParam< T >::CompoundParam(), casacore::CompoundParam< T >::CompoundParam(), casacore::CompoundParam< T >::CompoundParam(), and casacore::CompoundParam< T >::parameterFunction().
|
protected |
Index of local parameter.
Definition at line 211 of file CompoundParam.h.
Referenced by casacore::CompoundParam< T >::CompoundParam(), casacore::CompoundParam< T >::CompoundParam(), casacore::CompoundParam< T >::CompoundParam(), and casacore::CompoundParam< T >::parameterLocation().
|
private |
Number of dimensions of underlying functions.
Definition at line 200 of file CompoundParam.h.
Referenced by casacore::CompoundParam< T >::ndim().
|
protected |
Index of offset for each function to its parameters in general list.
Definition at line 207 of file CompoundParam.h.
Referenced by casacore::CompoundParam< T >::CompoundParam(), casacore::CompoundParam< T >::CompoundParam(), casacore::CompoundParam< T >::CompoundParam(), and casacore::CompoundParam< T >::parameterOffset().