casa::FunctionParam< T > Class Template Reference
[Functionals]

#include <FunctionParam.h>

List of all members.


Detailed Description

template<class T>
class casa::FunctionParam< T >

Container of function parameters with masking flags.

Intended use:

Part of API

Review Status

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

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

Definition at line 87 of file FunctionParam.h.

Public Member Functions

 FunctionParam ()
 Construct a default FunctionParam with 0 parameters.
 FunctionParam (const uInt n)
 Construct a FunctionParam with n parameters with zero value and all masks True.
 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)
 Copy from different type (deep copy).
virtual ~FunctionParam ()
 Destructor.
FunctionParamoperator= (const FunctionParam< T > &other)
 Copy assignment (deep copy).
uInt nelements () const
 Return the number of parameters.
const Vector< T > & getParameters () const
 Get all parameters at once.
void setParameters (const Vector< T > &params)
 Set all the parameters at once.
const Vector< Bool > & getParamMasks () const
 Get all parameter masks at once.
void setParamMasks (const Vector< Bool > &masks)
 Set all parameter masks at once.
ostream & print (ostream &os) const
 Output the parameters.
T & operator[] (const uInt n)
 Manipulate the nth parameter (0-based) with no index check.
const T & operator[] (const uInt n) const
Bool operator== (const FunctionParam< T > &other) const
 Compare two parameter sets for equal size, values and masks.
Bool operator!= (const FunctionParam< T > &other) const
T & parameter (const uInt n)
 Manipulate the nth parameter (0-based) with no index check.
const T & parameter (const uInt n) const
Boolmask (const uInt n)
 Manipulate the mask associated with the nth parameter (e.g.
const Boolmask (const uInt n) const
uInt nMaskedParameters () const
 Number of masked (=True) parameters.
Vector< T > & getMaskedParameters () const
 All masked parameters only.
void setMaskedParameters (Vector< T > &in)

Private Member Functions

void createMaskedPtr () const
 Create a cached version of the masked parameter list.
void clearMaskedPtr () const
 Clear the masked parameter list.

Private Attributes

uInt npar_p
 Number of parameters.
Vector< T > param_p
 Parameters.
Vector< Boolmask_p
 Masks.
Vector< T > * maskedPtr_p
 Cached masked data.


Constructor & Destructor Documentation

template<class T>
casa::FunctionParam< T >::FunctionParam (  ) 

Construct a default FunctionParam with 0 parameters.

template<class T>
casa::FunctionParam< T >::FunctionParam ( const uInt  n  )  [explicit]

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

template<class T>
casa::FunctionParam< T >::FunctionParam ( const Vector< T > &  in  )  [explicit]

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

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

Copy constructor (deep copy).

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

Copy from different type (deep copy).

Definition at line 102 of file FunctionParam.h.

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

Destructor.


Member Function Documentation

template<class T>
FunctionParam& casa::FunctionParam< T >::operator= ( const FunctionParam< T > &  other  ) 

Copy assignment (deep copy).

template<class T>
T& casa::FunctionParam< T >::operator[] ( const uInt  n  )  [inline]

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

Definition at line 123 of file FunctionParam.h.

template<class T>
const T& casa::FunctionParam< T >::operator[] ( const uInt  n  )  const [inline]

Definition at line 124 of file FunctionParam.h.

template<class T>
Bool casa::FunctionParam< T >::operator== ( const FunctionParam< T > &  other  )  const

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

template<class T>
Bool casa::FunctionParam< T >::operator!= ( const FunctionParam< T > &  other  )  const

template<class T>
uInt casa::FunctionParam< T >::nelements (  )  const [inline]

Return the number of parameters.

Definition at line 134 of file FunctionParam.h.

template<class T>
T& casa::FunctionParam< T >::parameter ( const uInt  n  )  [inline]

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

Definition at line 137 of file FunctionParam.h.

template<class T>
const T& casa::FunctionParam< T >::parameter ( const uInt  n  )  const [inline]

Definition at line 138 of file FunctionParam.h.

template<class T>
Bool& casa::FunctionParam< T >::mask ( const uInt  n  ) 

Manipulate the mask associated with the nth parameter (e.g.

to indicate whether the parameter is adjustable or nonadjustable). Note no index check.

template<class T>
const Bool& casa::FunctionParam< T >::mask ( const uInt  n  )  const [inline]

Definition at line 146 of file FunctionParam.h.

template<class T>
const Vector<T>& casa::FunctionParam< T >::getParameters (  )  const [inline]

Get all parameters at once.

Returns zero length Vector if there are no parameters.

Definition at line 151 of file FunctionParam.h.

Referenced by casa::FunctionParam< casa::AutoDiff< T > >::FunctionParam().

template<class T>
void casa::FunctionParam< T >::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.

template<class T>
const Vector<Bool>& casa::FunctionParam< T >::getParamMasks (  )  const [inline]

Get all parameter masks at once.

Returns zero length Vector if there are no parameters.

Definition at line 159 of file FunctionParam.h.

Referenced by casa::FunctionParam< casa::AutoDiff< T > >::FunctionParam().

template<class T>
void casa::FunctionParam< T >::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.

template<class T>
uInt casa::FunctionParam< T >::nMaskedParameters (  )  const

Number of masked (=True) parameters.

template<class T>
Vector<T>& casa::FunctionParam< T >::getMaskedParameters (  )  const

All masked parameters only.

template<class T>
void casa::FunctionParam< T >::setMaskedParameters ( Vector< T > &  in  ) 

template<class T>
ostream& casa::FunctionParam< T >::print ( ostream &  os  )  const

Output the parameters.

template<class T>
void casa::FunctionParam< T >::createMaskedPtr (  )  const [private]

Create a cached version of the masked parameter list.

template<class T>
void casa::FunctionParam< T >::clearMaskedPtr (  )  const [private]

Clear the masked parameter list.


Member Data Documentation

template<class T>
uInt casa::FunctionParam< T >::npar_p [private]

Number of parameters.

Definition at line 183 of file FunctionParam.h.

Referenced by casa::FunctionParam< casa::AutoDiff< T > >::FunctionParam().

template<class T>
Vector<T> casa::FunctionParam< T >::param_p [private]

Parameters.

Definition at line 185 of file FunctionParam.h.

Referenced by casa::FunctionParam< casa::AutoDiff< T > >::FunctionParam(), casa::FunctionParam< casa::AutoDiff< T > >::getParameters(), casa::FunctionParam< casa::AutoDiff< T > >::nelements(), casa::FunctionParam< casa::AutoDiff< T > >::operator[](), and casa::FunctionParam< casa::AutoDiff< T > >::parameter().

template<class T>
Vector<Bool> casa::FunctionParam< T >::mask_p [private]

Masks.

Definition at line 187 of file FunctionParam.h.

Referenced by casa::FunctionParam< casa::AutoDiff< T > >::FunctionParam(), casa::FunctionParam< casa::AutoDiff< T > >::getParamMasks(), and casa::FunctionParam< casa::AutoDiff< T > >::mask().

template<class T>
Vector<T>* casa::FunctionParam< T >::maskedPtr_p [mutable, private]

Cached masked data.

Definition at line 189 of file FunctionParam.h.


The documentation for this class was generated from the following file:
Generated on Mon Sep 1 22:44:51 2008 for NRAOCASA by  doxygen 1.5.1