Loading...
Searching...
No Matches
casacore::FunctionParam< T > Class Template Reference
scimath package (libcasa_scimath) » Functionals_module

More...

`#include <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.
FunctionParam & | operator= (const FunctionParam< T > &other)
| Copy assignment (deep copy).
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
uInt | nelements () const
| Return the number of parameters.
T & | parameter (const uInt n)
| Manipulate the nth parameter (0-based) with no index check.
const T & | parameter (const uInt n) const
Bool & | mask (const uInt n)
| Manipulate the mask associated with the nth parameter (e.g.
const Bool & | mask (const uInt n) const
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.
uInt | nMaskedParameters () const
| Operations on the masked parameters only.
Vector< T > & | getMaskedParameters () const
| All masked parameters only.
void | setMaskedParameters (Vector< T > &in)
ostream & | print (ostream &os) const
| Output the parameters.

## 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< Bool > | mask_p
| Masks.
Vector< T > * | maskedPtr_p
| Cached masked data.

## Detailed Description

template<class T>
class casacore::FunctionParam< T >

Container of function parameters with masking flags

### Intended use:

Public interface

### 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)

- T must have a default constructor, assignment operator, and copy constructor (for the Vector interface).
- all standard mathematical should be applicable if the parameter interface is used for the calculation of Functions.

### To Do

- Nothing I know of

Definition at line 85 of file FunctionParam.h.

## Constructor & Destructor Documentation

## FunctionParam() [1/5]

template<class T>

casacore::FunctionParam< T >::FunctionParam | ( |  | ) |

Construct a default FunctionParam with 0 parameters.

Referenced by FunctionParam(), FunctionParam(), operator!=(), operator=(), and operator==().

## FunctionParam() [2/5]

template<class T>

casacore::FunctionParam< T >::FunctionParam | ( | const uInt | n | ) |

explicit

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

## FunctionParam() [3/5]

template<class T>

casacore::FunctionParam< T >::FunctionParam | ( | const Vector< T > & | in | ) |

explicit

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

## FunctionParam() [4/5]

template<class T>

casacore::FunctionParam< T >::FunctionParam | ( | const FunctionParam< T > & | other | ) |

Copy constructor (deep copy).

References FunctionParam().

## FunctionParam() [5/5]

template<class T>
template<class W>

casacore::FunctionParam< T >::FunctionParam | ( | const FunctionParam< W > & | other | ) |

inline

Copy from different type (deep copy).

Definition at line 100 of file FunctionParam.h.

References FunctionParam(), getParameters(), getParamMasks(), casacore::FunctionTraits< T >::getValue(), mask_p, maskedPtr_p, nelements(), npar_p, param_p, and casacore::FunctionTraits< T >::setValue().

## ~FunctionParam()

template<class T>

virtual casacore::FunctionParam< T >::~FunctionParam | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## clearMaskedPtr()

template<class T>

void casacore::FunctionParam< T >::clearMaskedPtr | ( |  | ) | const

private

Clear the masked parameter list.

## createMaskedPtr()

template<class T>

void casacore::FunctionParam< T >::createMaskedPtr | ( |  | ) | const

private

Create a cached version of the masked parameter list.

## getMaskedParameters()

template<class T>

Vector< T > & casacore::FunctionParam< T >::getMaskedParameters | ( |  | ) | const

All masked parameters only.

## getParameters()

template<class T>

const Vector< T > & casacore::FunctionParam< T >::getParameters | ( |  | ) | const

inline

Get all parameters at once.

Returns zero length Vector if there are no parameters.

Definition at line 149 of file FunctionParam.h.

References param_p.

Referenced by FunctionParam().

## getParamMasks()

template<class T>

const Vector< Bool > & casacore::FunctionParam< T >::getParamMasks | ( |  | ) | const

inline

Get all parameter masks at once.

Returns zero length Vector if there are no parameters.

Definition at line 157 of file FunctionParam.h.

References mask_p.

Referenced by FunctionParam().

## mask() [1/2]

template<class T>

Bool & casacore::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.

## mask() [2/2]

template<class T>

const Bool & casacore::FunctionParam< T >::mask | ( | const uInt | n | ) | const

inline

Definition at line 144 of file FunctionParam.h.

References mask_p.

## nelements()

template<class T>

uInt casacore::FunctionParam< T >::nelements | ( |  | ) | const

inline

Return the number of parameters.

Definition at line 132 of file FunctionParam.h.

References param_p.

Referenced by FunctionParam().

## nMaskedParameters()

template<class T>

uInt casacore::FunctionParam< T >::nMaskedParameters | ( |  | ) | const

Operations on the masked parameters only.

For possible re-use the results are cached.

Number of masked (=True) parameters

## operator!=()

template<class T>

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

References FunctionParam().

## operator=()

template<class T>

FunctionParam & casacore::FunctionParam< T >::operator= | ( | const FunctionParam< T > & | other | ) |

Copy assignment (deep copy).

References FunctionParam().

## operator==()

template<class T>

Bool casacore::FunctionParam< T >::operator== | ( | const FunctionParam< T > & | other | ) | const

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

References FunctionParam().

## operator[]() [1/2]

template<class T>

T & casacore::FunctionParam< T >::operator[] | ( | const uInt | n | ) |

inline

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

Definition at line 121 of file FunctionParam.h.

References param_p.

## operator[]() [2/2]

template<class T>

const T & casacore::FunctionParam< T >::operator[] | ( | const uInt | n | ) | const

inline

Definition at line 122 of file FunctionParam.h.

References param_p.

## parameter() [1/2]

template<class T>

T & casacore::FunctionParam< T >::parameter | ( | const uInt | n | ) |

inline

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

Definition at line 135 of file FunctionParam.h.

References param_p.

## parameter() [2/2]

template<class T>

const T & casacore::FunctionParam< T >::parameter | ( | const uInt | n | ) | const

inline

Definition at line 136 of file FunctionParam.h.

References param_p.

## print()

template<class T>

ostream & casacore::FunctionParam< T >::print | ( | ostream & | os | ) | const

Output the parameters.

Referenced by casacore::operator<<().

## setMaskedParameters()

template<class T>

void casacore::FunctionParam< T >::setMaskedParameters | ( | Vector< T > & | in | ) |

## setParameters()

template<class T>

void casacore::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.

## setParamMasks()

template<class T>

void casacore::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.

## Member Data Documentation

## mask_p

template<class T>

Vector<Bool> casacore::FunctionParam< T >::mask_p

private

Masks.

Definition at line 185 of file FunctionParam.h.

Referenced by FunctionParam(), getParamMasks(), and mask().

## maskedPtr_p

template<class T>

Vector<T>* casacore::FunctionParam< T >::maskedPtr_p

mutable private

Cached masked data.

Definition at line 187 of file FunctionParam.h.

Referenced by FunctionParam().

## npar_p

template<class T>

uInt casacore::FunctionParam< T >::npar_p

private

Number of parameters.

Definition at line 181 of file FunctionParam.h.

Referenced by FunctionParam().

## param_p

template<class T>

Vector<T> casacore::FunctionParam< T >::param_p

private

Parameters.

Definition at line 183 of file FunctionParam.h.

Referenced by FunctionParam(), getParameters(), nelements(), operator[](), operator[](), parameter(), and parameter().

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

- scimath/Functionals/FunctionParam.h