casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Attributes | Private Attributes
casa::CompoundParam< T > Class Template Reference

Parameters for sum of parameterized Functions. More...

#include <CompoundParam.h>

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

List of all members.

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 Stringname () 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< uIntparoff_p
 Index of offset for each function to its parameters in general list.
Block< uIntfunpar_p
 Index of function belonging to parameter.
Block< uIntlocpar_p
 Index of local parameter.

Private Attributes

uInt ndim_p
 Number of dimensions of underlying functions.

Detailed Description

template<class T>
class casa::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>
casa::CompoundParam< T >::CompoundParam ( )

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

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

Make this object a (deep) copy of other.

template<class T>
casa::CompoundParam< T >::CompoundParam ( const CompoundParam< T > &  other,
Bool   
) [inline]

Definition at line 111 of file CompoundParam.h.

template<class T>
template<class W >
casa::CompoundParam< T >::CompoundParam ( const CompoundParam< W > &  other) [inline]

Definition at line 127 of file CompoundParam.h.

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

Definition at line 143 of file CompoundParam.h.

template<class T>
virtual casa::CompoundParam< T >::~CompoundParam ( ) [virtual]

   


Member Function Documentation

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

template<class 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().

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

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

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

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

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

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


Member Data Documentation

template<class T>
PtrBlock<Function<T> *> casa::CompoundParam< T >::functionPtr_p [protected]
template<class T>
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().

template<class T>
Block<uInt> casa::CompoundParam< T >::locpar_p [protected]
template<class T>
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().

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


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