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

Form a linear combination of function objects. More...

#include <CombiFunction.h>

Inheritance diagram for casa::CombiFunction< T >:
casa::CombiParam< T > casa::Function< T > casa::Functional< FunctionTraits< T >::ArgType, T > casa::Functional< Vector< FunctionTraits< T >::ArgType >, T >

List of all members.

Public Member Functions

 CombiFunction ()
 The default constructor -- no functions, no parameters, nothing, the function operator returns a 0.
 CombiFunction (const CombiFunction< T > &other)
 Make this object a (deep) copy of other.
 CombiFunction (const CombiFunction< T > &other, Bool)
template<class W >
 CombiFunction (const CombiFunction< W > &other)
template<class W >
 CombiFunction (const CombiFunction< W > &other, Bool)
CombiFunction< T > & operator= (const CombiFunction< T > &other)
 Make this object a (deep) copy of other.
virtual ~CombiFunction ()
 Destructor.
virtual T eval (typename Function< T >::FunctionArg x) const
 Evaluate the function at x.
virtual Function< T > * clone () const
 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

Detailed Description

template<class T>
class casa::CombiFunction< T >

Form a linear combination of function objects.

Intended use:

Public interface

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Test programs:
tCombiFunction

Prerequisite

Synopsis

Given N function objects, the class describes a linear combination of the form:

    f(x) = a(0)*f(0)(x) + a(1)*f(1)(x) + ... + a(N-1)*f(N-1)(x)

where a = {a(n)} are parameters. If the combi function is used in a functional fitting process (see LinearFit ) these parameters canm be solved for. In all aspects they behave as FunctionParam values.

Member functions are added with the addFunction() method.


Tip: Check CompoundFunction class for a combination of functions behaving as one object;

Example

In the following example a second order polynomial is built from 3 separate polynomials.

    Polynomial<Double> constant(0); 
    Polynomial<Double> linear(1); 
    Polynomial<Double> square(2);
    
    constant.setCoefficient(0, 1.0);   // 1
    linear.setCoefficient(1, 1.0);     // x
    square[2] = 1.0;     // x^2
    
    CombiFunction<Double> combination;
    
    // form function, e0 + e1*x + e2*x^2
    combination.addFunction(constant);
    combination.addFunction(linear);
    combination.addFunction(square);

Template Type Argument Requirements (T)

Thrown Exceptions

Motivation

This class was created to allow specialization of the evaluation in a simple way.

To Do

Definition at line 114 of file CombiFunction.h.


Constructor & Destructor Documentation

template<class T>
casa::CombiFunction< T >::CombiFunction ( ) [inline]

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

Definition at line 119 of file CombiFunction.h.

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

Make this object a (deep) copy of other.

Definition at line 122 of file CombiFunction.h.

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

Definition at line 124 of file CombiFunction.h.

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

Definition at line 127 of file CombiFunction.h.

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

Definition at line 129 of file CombiFunction.h.

template<class T>
virtual casa::CombiFunction< T >::~CombiFunction ( ) [inline, virtual]

Destructor.

Definition at line 137 of file CombiFunction.h.


Member Function Documentation

template<class T>
virtual Function<T>* casa::CombiFunction< T >::clone ( ) const [inline, virtual]

Return a copy of this object from the heap.

The caller is responsible for deleting the pointer.

Implements casa::Function< T >.

Definition at line 147 of file CombiFunction.h.

template<class T>
virtual Function<typename FunctionTraits<T>::DiffType>* casa::CombiFunction< T >::cloneAD ( ) const [inline, virtual]

Reimplemented from casa::Function< T >.

Definition at line 148 of file CombiFunction.h.

template<class T>
virtual Function<typename FunctionTraits<T>::BaseType>* casa::CombiFunction< T >::cloneNonAD ( ) const [inline, virtual]

Reimplemented from casa::Function< T >.

Definition at line 150 of file CombiFunction.h.

References casa::True.

template<class T>
virtual T casa::CombiFunction< T >::eval ( typename Function< T >::FunctionArg  x) const [virtual]

Evaluate the function at x.

template<class T>
CombiFunction<T>& casa::CombiFunction< T >::operator= ( const CombiFunction< T > &  other) [inline]

Make this object a (deep) copy of other.

Definition at line 133 of file CombiFunction.h.


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