FunctionParam.h

Classes

FunctionParam -- Container of function parameters with masking flags (full description)
Global Functions -- Global functions (full description)

template<class T> class FunctionParam

Interface

Public Members
FunctionParam()
explicit FunctionParam(const uInt n)
explicit FunctionParam(const Vector<T> &in)
FunctionParam(const FunctionParam<T> &other)
template <class W> FunctionParam(const FunctionParam<W> &other) : npar_p(other.getParameters().nelements()), param_p(npar_p), mask_p(npar_p), maskedPtr_p(0)
virtual ~FunctionParam()
FunctionParam &operator=(const FunctionParam<T> &other)
T &operator[](const uInt n)
const T &operator[](const uInt n) const
Bool operator==(const FunctionParam<T> &other) const
Bool operator!=(const FunctionParam<T> &other) const
uInt nelements() const
T &parameter(const uInt n)
const T &parameter(const uInt n) const
Bool &mask(const uInt n)
const Bool &mask(const uInt n) const
const Vector<T> &getParameters() const
void setParameters(const Vector<T> &params)
const Vector<Bool> &getParamMasks() const
void setParamMasks(const Vector<Bool> &masks)
uInt nMaskedParameters() const
Vector<T> &getMaskedParameters() const
void setMaskedParameters(Vector<T> &in)
ostream &print(ostream &os) const
Private Members
void createMaskedPtr() const
void clearMaskedPtr() const

Description

Synopsis

FunctionParam is used to provide an interface to an entity which has parameters that can be flagged. This is useful, for example, in implementing parameter fitting which operates on generic function objects.

Each parameter can be masked. The mask can, e.g., be used to indicate to a generic least-squares fitting routine to only adjust parameters with a True mask (the default). For that reason methods that only handle True data items have names with Adjust in the names. In general the user should not be concerned with these methods, but should only manipulate the parameter flags and values.

Example

See the Function class for a usage interface.

Motivation

Generically manipulatable adjustable parameters are important for fitting.

Template Type Argument Requirements (T)

To Do

Member Description

FunctionParam()

Construct a default FunctionParam with 0 parameters

explicit FunctionParam(const uInt n)

Construct a FunctionParam with n parameters with zero value and all masks True

explicit FunctionParam(const Vector<T> &in)

Construct a FunctionParam from the given vector, with all masks True

FunctionParam(const FunctionParam<T> &other)

Copy constructor (deep copy)

template <class W> FunctionParam(const FunctionParam<W> &other) : npar_p(other.getParameters().nelements()), param_p(npar_p), mask_p(npar_p), maskedPtr_p(0)

Copy from different type (deep copy)

virtual ~FunctionParam()

Destructor

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

Copy assignment (deep copy)

T &operator[](const uInt n)
const T &operator[](const uInt n) const

Manipulate the nth parameter (0-based) with no index check

Bool operator==(const FunctionParam<T> &other) const
Bool operator!=(const FunctionParam<T> &other) const

Compare two parameter sets for equal size, values and masks.

uInt nelements() const

Return the number of parameters

T &parameter(const uInt n)
const T &parameter(const uInt n) const

Manipulate the nth parameter (0-based) with no index check

Bool &mask(const uInt n)
const Bool &mask(const uInt n) const

Manipulate the mask associated with the nth parameter (e.g. to indicate whether the parameter is adjustable or nonadjustable). Note no index check.

const Vector<T> &getParameters() const

Get all parameters at once. Returns zero length Vector if there are no parameters.

void setParameters(const Vector<T> &params)

Set all the parameters at once. Only the minimum of the input number and the object number of parameters will be set.

const Vector<Bool> &getParamMasks() const

Get all parameter masks at once. Returns zero length Vector if there are no parameters.

void setParamMasks(const Vector<Bool> &masks)

Set all parameter masks at once. Only the minimum of the input number and the object number of parameters will be set.

uInt nMaskedParameters() const

Operations on the masked parameters only. For possible re-use the results are cached.

Number of masked (=True) parameters

Vector<T> &getMaskedParameters() const
void setMaskedParameters(Vector<T> &in)

Operations on the masked parameters only. For possible re-use the results are cached.

ostream &print(ostream &os) const

Output the parameters

void createMaskedPtr() const

Create a cached version of the masked parameter list

void clearMaskedPtr() const

Clear the masked parameter list

Global functions (source)

Interface

ostream &operator<<(ostream &os, const FunctionParam<T> &par)

Description

Member Description

ostream &operator<<(ostream &os, const FunctionParam<T> &par)

Output declaration