CombiParam.h

Classes

CombiParam -- Parameters for a linear combination of function objects. (full description)

template <class T> class CombiParam : public Function<T>

Interface

Public Members
CombiParam()
CombiParam(const CombiParam<T> &other)
CombiParam(const CombiParam<T> &other, Bool) : other<T>(other), ndim_p(other.ndim_p), functionPtr_p(other.functionPtr_p.nelements())
template <class W> CombiParam(const CombiParam<W> &other) : Function<T>(other), ndim_p(other.ndim()), functionPtr_p(other.nFunctions())
template <class W> CombiParam(const CombiParam<W> &other, Bool) : Function<T>(other), ndim_p(other.ndim()), functionPtr_p(other.nFunctions())
CombiParam<T> &operator=(const CombiParam<T> &other)
virtual ~CombiParam()
virtual const String &name() const
uInt addFunction(const Function<T> &newFunction)
uInt nFunctions() const
const Function<T> &function(uInt which) const
const Function<T> &function(uInt which)
virtual uInt ndim() const

Description

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Programs:
Tests:

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.

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
    
    CombiParam<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

Member Description

CombiParam()

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

CombiParam(const CombiParam<T> &other)
CombiParam(const CombiParam<T> &other, Bool) : other<T>(other), ndim_p(other.ndim_p), functionPtr_p(other.functionPtr_p.nelements())
template <class W> CombiParam(const CombiParam<W> &other) : Function<T>(other), ndim_p(other.ndim()), functionPtr_p(other.nFunctions())
template <class W> CombiParam(const CombiParam<W> &other, Bool) : Function<T>(other), ndim_p(other.ndim()), functionPtr_p(other.nFunctions())

Make this object a (deep) copy of other.

CombiParam<T> &operator=(const CombiParam<T> &other)

Make this object a (deep) copy of other.

virtual ~CombiParam()

Destructor

virtual const String &name() const

Give name of function

uInt addFunction(const Function<T> &newFunction)

Add a function. All functions must have the same ndim() as the first one. Returns the (zero relative) number (i) of the function just added. The default initial parameter value (a(i)) is initialized to 1. The parameter mask is set True.

uInt nFunctions() const

Return the total number of functions. The number is equal to the number of functions that have been added.

const Function<T> &function(uInt which) const
const Function<T> &function(uInt which)

Return a reference to a specific Function in the combination.

virtual uInt ndim() const

Returns the dimension of functions in the linear combination