casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | Private Attributes | List of all members
casacore::CompoundParam< T > Class Template Reference

Parameters for sum of parameterized Functions. More...

#include <CompoundParam.h>

Inheritance diagram for casacore::CompoundParam< T >:
casacore::Function< T > casacore::Functional< FunctionTraits< T >::ArgType, U > casacore::Functional< Vector< FunctionTraits< T >::ArgType >, U > casacore::CompoundFunction< T >

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 Stringname () 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 >
 Function ()
 Constructors. More...
 
 Function (const uInt n)
 
 Function (const Vector< T > &in)
 
 Function (const FunctionParam< T > &other)
 
 Function (const Function< W, X > &other)
 
 Function (const Function< T, U > &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 xor 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
 
Boolmask (const uInt n)
 Manipulate the mask associated with the nth parameter (e.g. More...
 
const Boolmask (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, U >
virtual ~Functional ()
 Destructor. More...
 
virtual U 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 >, U >
virtual ~Functional ()
 Destructor. More...
 
virtual U 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< uIntparoff_p
 Index of offset for each function to its parameters in general list. More...
 
Block< uIntfunpar_p
 Index of function belonging to parameter. More...
 
Block< uIntlocpar_p
 Index of local parameter. More...
 
- Protected Attributes inherited from casacore::Function< T >
FunctionParam< T > param_p
 The parameters and masks. More...
 
Vector< ArgTypearg_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 >
typedef FunctionTraits< T >
::ArgType 
ArgType
 
typedef const ArgTypeFunctionArg
 

Detailed Description

template<class T>
class casacore::CompoundParam< T >

Parameters for sum of parameterized Functions.

Intended use:

Internal

Review Status

Reviewed By:
tcornwel
Date Reviewed:
1996/02/22
Test programs:
tCompoundFunction

Prerequisite

Synopsis

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.

Example

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;

Template Type Argument Requirements (T)

Thrown Exceptions

Motivation

This class was created to allow a non-linear least squares fitter to fit a (potentially) arbitrary number of functions (typically gaussians).

To Do

Definition at line 101 of file CompoundParam.h.

Constructor & Destructor Documentation

template<class T>
casacore::CompoundParam< T >::CompoundParam ( )

The default constructor – no functions, no parameters, nothing, the function operator returns a 0.

template<class T>
casacore::CompoundParam< T >::CompoundParam ( const CompoundParam< T > &  other)

Make this object a (deep) copy of other.

template<class T>
casacore::CompoundParam< T >::CompoundParam ( const CompoundParam< T > &  other,
Bool   
)
inline

Definition at line 111 of file CompoundParam.h.

template<class T>
template<class W >
casacore::CompoundParam< T >::CompoundParam ( const CompoundParam< W > &  other)
inline

Definition at line 127 of file CompoundParam.h.

template<class T>
template<class W >
casacore::CompoundParam< T >::CompoundParam ( const CompoundParam< W > &  other,
Bool   
)
inline

Definition at line 143 of file CompoundParam.h.

template<class T>
virtual casacore::CompoundParam< T >::~CompoundParam ( )
virtual

Member Function Documentation

template<class T>
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.

template<class T>
const Function<T>& casacore::CompoundParam< T >::function ( uInt  which) const
inline

Return a reference to a specific Function.

Definition at line 180 of file CompoundParam.h.

Referenced by casacore::CompoundParam< AutoDiff< T > >::CompoundParam().

template<class T>
virtual const String& casacore::CompoundParam< T >::name ( ) const
inlinevirtual

Give name of function.

Reimplemented from casacore::Function< T >.

Definition at line 167 of file CompoundParam.h.

template<class T>
virtual uInt casacore::CompoundParam< T >::ndim ( ) const
inlinevirtual

Returns the dimension of functions in the linear combination.

Implements casacore::Function< T >.

Definition at line 198 of file CompoundParam.h.

template<class T>
uInt casacore::CompoundParam< T >::nFunctions ( ) const
inline

Return the number of functions in the sum.

Definition at line 176 of file CompoundParam.h.

Referenced by casacore::CompoundParam< AutoDiff< T > >::function(), and casacore::CompoundParam< AutoDiff< T > >::parameterOffset().

template<class T>
CompoundParam<T>& casacore::CompoundParam< T >::operator= ( const CompoundParam< T > &  other)
template<class T>
uInt casacore::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 casacore::CompoundParam< AutoDiff< T > >::CompoundParam().

template<class T>
uInt casacore::CompoundParam< T >::parameterLocation ( uInt  which) const
inline

Return locpar.

Definition at line 193 of file CompoundParam.h.

Referenced by casacore::CompoundParam< AutoDiff< T > >::CompoundParam().

template<class T>
uInt casacore::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 casacore::CompoundParam< AutoDiff< T > >::CompoundParam().

Member Data Documentation

template<class T>
PtrBlock<Function<T> *> casacore::CompoundParam< T >::functionPtr_p
protected
template<class T>
Block<uInt> casacore::CompoundParam< T >::funpar_p
protected

Index of function belonging to parameter.

Definition at line 212 of file CompoundParam.h.

Referenced by casacore::CompoundParam< AutoDiff< T > >::CompoundParam(), and casacore::CompoundParam< AutoDiff< T > >::parameterFunction().

template<class T>
Block<uInt> casacore::CompoundParam< T >::locpar_p
protected
template<class T>
uInt casacore::CompoundParam< T >::ndim_p
private

Number of dimensions of underlying functions.

Definition at line 203 of file CompoundParam.h.

Referenced by casacore::CompoundParam< AutoDiff< T > >::ndim().

template<class T>
Block<uInt> casacore::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 casacore::CompoundParam< AutoDiff< T > >::CompoundParam(), and casacore::CompoundParam< AutoDiff< T > >::parameterOffset().


The documentation for this class was generated from the following file: