casacore
|
#include <CompoundParam.h>
Public Member Functions | |
CompoundParam () | |
The default constructor – no functions, no parameters, nothing, the function operator returns a 0. More... | |
CompoundParam (const CompoundParam< T > &other) | |
Make this object a (deep) copy of other. More... | |
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. More... | |
uInt | addFunction (const Function< T > &newFunction) |
Add a function to the sum. More... | |
uInt | nFunctions () const |
Return the number of functions in the sum. More... | |
const Function< T > & | function (uInt which) const |
Return a reference to a specific Function. More... | |
uInt | parameterOffset (uInt which) const |
Get the offset in function parameterlist for function which. More... | |
uInt | parameterFunction (uInt which) const |
Get the function number belonging to parameter list element which. More... | |
uInt | parameterLocation (uInt which) const |
Return locpar. More... | |
virtual uInt | ndim () const |
Returns the dimension of functions in the linear combination. More... | |
Public Member Functions inherited from casacore::Function< T, U > | |
Function () | |
Constructors. More... | |
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. More... | |
uInt | nparameters () const |
Returns the number of parameters. More... | |
virtual U | eval (FunctionArg x) const =0 |
Evaluate the function object. More... | |
T & | operator[] (const uInt n) |
Manipulate the nth parameter (0-based) with no index check. More... | |
const T & | operator[] (const uInt n) const |
virtual U | operator() () const |
Evaluate this function object at x or at x, y . More... | |
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. More... | |
const Bool & | mask (const uInt n) const |
const FunctionParam< T > & | parameters () const |
Return the parameter interface. More... | |
FunctionParam< T > & | parameters () |
const Vector< ArgType > & | argp () const |
Get arg_p and parset_p . More... | |
Bool | parsetp () const |
void | lockParam () |
Compiler cannot always find the correct 'const' version of parameter access. More... | |
void | unlockParam () |
virtual void | setMode (const RecordInterface &mode) |
get/set the function mode. More... | |
virtual void | getMode (RecordInterface &mode) const |
virtual Bool | hasMode () const |
return True if the implementing function supports a mode. More... | |
ostream & | print (ostream &os) const |
Print the function (i.e. More... | |
virtual Function< T, U > * | clone () const =0 |
Return a copy of this object from the heap. More... | |
virtual Function< typename FunctionTraits< T >::DiffType > * | cloneAD () const |
virtual Function< typename FunctionTraits< T >::BaseType > * | cloneNonAD () const |
Public Member Functions inherited from casacore::Functional< FunctionTraits< T >::ArgType, T > | |
virtual | ~Functional () |
Destructor. More... | |
virtual T | operator() (const FunctionTraits< T >::ArgType &x) const=0 |
Map a Domain x into a Range y value. More... | |
Public Member Functions inherited from casacore::Functional< Vector< FunctionTraits< T >::ArgType >, T > | |
virtual | ~Functional () |
Destructor. More... | |
virtual T | operator() (const Vector< FunctionTraits< T >::ArgType > &x) const=0 |
Map a Domain x into a Range y value. More... | |
Protected Attributes | |
PtrBlock< Function< T > * > | functionPtr_p |
Pointer to each added function. More... | |
Block< uInt > | paroff_p |
Index of offset for each function to its parameters in general list. More... | |
Block< uInt > | funpar_p |
Index of function belonging to parameter. More... | |
Block< uInt > | locpar_p |
Index of local parameter. More... | |
Protected Attributes inherited from casacore::Function< T, U > | |
FunctionParam< T > | param_p |
The parameters and masks. More... | |
Vector< ArgType > | arg_p |
Aid for non-contiguous argument storage. More... | |
Bool | parset_p |
Indicate parameter written. More... | |
Bool | locked_p |
Indicate that parameters are expected to be locked from changing. More... | |
Private Attributes | |
uInt | ndim_p |
Number of dimensions of underlying functions. More... | |
Additional Inherited Members | |
Public Types inherited from casacore::Function< T, U > | |
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 101 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 111 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 127 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 143 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 180 of file CompoundParam.h.
References DebugAssert, casacore::CompoundParam< T >::functionPtr_p, and casacore::CompoundParam< T >::nFunctions().
Referenced by casacore::CompoundParam< T >::CompoundParam().
|
inlinevirtual |
Give name of function.
Reimplemented from casacore::Function< T, U >.
Definition at line 167 of file CompoundParam.h.
|
inlinevirtual |
Returns the dimension of functions in the linear combination.
Implements casacore::Function< T, U >.
Definition at line 198 of file CompoundParam.h.
References casacore::CompoundParam< T >::ndim_p.
|
inline |
Return the number of functions in the sum.
Definition at line 176 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 188 of file CompoundParam.h.
References DebugAssert, casacore::CompoundParam< T >::funpar_p, and casacore::Function< T, U >::nparameters().
Referenced by casacore::CompoundParam< T >::CompoundParam().
|
inline |
Return locpar.
Definition at line 193 of file CompoundParam.h.
References DebugAssert, casacore::CompoundParam< T >::locpar_p, and casacore::Function< T, U >::nparameters().
Referenced by casacore::CompoundParam< T >::CompoundParam().
|
inline |
Get the offset in function parameterlist for function which.
Definition at line 185 of file CompoundParam.h.
References DebugAssert, casacore::CompoundParam< T >::nFunctions(), and casacore::CompoundParam< T >::paroff_p.
Referenced by casacore::CompoundParam< T >::CompoundParam().
|
protected |
Pointer to each added function.
Definition at line 208 of file CompoundParam.h.
Referenced by casacore::CompoundParam< T >::CompoundParam(), casacore::CompoundParam< T >::function(), and casacore::CompoundParam< T >::nFunctions().
|
protected |
Index of function belonging to parameter.
Definition at line 212 of file CompoundParam.h.
Referenced by casacore::CompoundParam< T >::CompoundParam(), and casacore::CompoundParam< T >::parameterFunction().
|
protected |
Index of local parameter.
Definition at line 214 of file CompoundParam.h.
Referenced by casacore::CompoundParam< T >::CompoundParam(), and casacore::CompoundParam< T >::parameterLocation().
|
private |
Number of dimensions of underlying functions.
Definition at line 203 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 210 of file CompoundParam.h.
Referenced by casacore::CompoundParam< T >::CompoundParam(), and casacore::CompoundParam< T >::parameterOffset().