casa
5.7.0-16
|
Container of function parameters with masking flags. More...
#include <FunctionParam.h>
Public Member Functions | |
FunctionParam () | |
Construct a default FunctionParam with 0 parameters. More... | |
FunctionParam (const uInt n) | |
Construct a FunctionParam with n parameters with zero value and all masks True More... | |
FunctionParam (const Vector< T > &in) | |
Construct a FunctionParam from the given vector, with all masks True More... | |
FunctionParam (const FunctionParam< T > &other) | |
Copy constructor (deep copy) More... | |
template<class W > | |
FunctionParam (const FunctionParam< W > &other) | |
Copy from different type (deep copy) More... | |
virtual | ~FunctionParam () |
Destructor. More... | |
FunctionParam & | operator= (const FunctionParam< T > &other) |
Copy assignment (deep copy) More... | |
T & | operator[] (const uInt n) |
Manipulate the nth parameter (0-based) with no index check. More... | |
const T & | operator[] (const uInt n) const |
Bool | operator== (const FunctionParam< T > &other) const |
Compare two parameter sets for equal size, values and masks. More... | |
Bool | operator!= (const FunctionParam< T > &other) const |
uInt | nelements () const |
Return the number of parameters. More... | |
T & | parameter (const uInt n) |
Manipulate the nth parameter (0-based) with no index check. More... | |
const T & | parameter (const uInt n) const |
Bool & | mask (const uInt n) |
Manipulate the mask associated with the nth parameter (e.g. More... | |
const Bool & | mask (const uInt n) const |
const Vector< T > & | getParameters () const |
Get all parameters at once. More... | |
void | setParameters (const Vector< T > ¶ms) |
Set all the parameters at once. More... | |
const Vector< Bool > & | getParamMasks () const |
Get all parameter masks at once. More... | |
void | setParamMasks (const Vector< Bool > &masks) |
Set all parameter masks at once. More... | |
uInt | nMaskedParameters () const |
Operations on the masked parameters only. More... | |
Vector< T > & | getMaskedParameters () const |
All masked parameters only. More... | |
void | setMaskedParameters (Vector< T > &in) |
ostream & | print (ostream &os) const |
Output the parameters. More... | |
Private Member Functions | |
void | createMaskedPtr () const |
Create a cached version of the masked parameter list. More... | |
void | clearMaskedPtr () const |
Clear the masked parameter list. More... | |
Private Attributes | |
uInt | npar_p |
Number of parameters. More... | |
Vector< T > | param_p |
Parameters. More... | |
Vector< Bool > | mask_p |
Masks. More... | |
Vector< T > * | maskedPtr_p |
Cached masked data. More... | |
Container of function parameters with masking flags.
Public interface
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
.
See the Function class for a usage interface.
Generically manipulatable adjustable parameters are important for fitting.
T
must have a default constructor, assignment operator, and copy constructor (for the Vector interface). Functions
. Definition at line 87 of file FunctionParam.h.
casacore::FunctionParam< T >::FunctionParam | ( | ) |
Construct a default FunctionParam with 0 parameters.
|
explicit |
Construct a FunctionParam with n
parameters with zero value and all masks True
|
explicit |
Construct a FunctionParam from the given vector, with all masks True
casacore::FunctionParam< T >::FunctionParam | ( | const FunctionParam< T > & | other | ) |
Copy constructor (deep copy)
|
inline |
Copy from different type (deep copy)
Definition at line 102 of file FunctionParam.h.
|
virtual |
Destructor.
|
private |
Clear the masked parameter list.
|
private |
Create a cached version of the masked parameter list.
Vector<T>& casacore::FunctionParam< T >::getMaskedParameters | ( | ) | const |
All masked parameters only.
|
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 casacore::FunctionParam< Type >::FunctionParam().
|
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 casacore::FunctionParam< Type >::FunctionParam().
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.
|
inline |
Definition at line 146 of file FunctionParam.h.
|
inline |
Return the number of parameters.
Definition at line 134 of file FunctionParam.h.
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
Bool casacore::FunctionParam< T >::operator!= | ( | const FunctionParam< T > & | other | ) | const |
FunctionParam& casacore::FunctionParam< T >::operator= | ( | const FunctionParam< T > & | other | ) |
Copy assignment (deep copy)
Bool casacore::FunctionParam< T >::operator== | ( | const FunctionParam< T > & | other | ) | const |
Compare two parameter sets for equal size, values and masks.
|
inline |
Manipulate the nth parameter (0-based) with no index check.
Definition at line 123 of file FunctionParam.h.
|
inline |
Definition at line 124 of file FunctionParam.h.
|
inline |
Manipulate the nth parameter (0-based) with no index check.
Definition at line 137 of file FunctionParam.h.
|
inline |
Definition at line 138 of file FunctionParam.h.
ostream& casacore::FunctionParam< T >::print | ( | ostream & | os | ) | const |
Output the parameters.
void casacore::FunctionParam< T >::setMaskedParameters | ( | Vector< T > & | in | ) |
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.
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.
|
private |
Masks.
Definition at line 187 of file FunctionParam.h.
Referenced by casacore::FunctionParam< Type >::FunctionParam(), casacore::FunctionParam< Type >::getParamMasks(), and casacore::FunctionParam< Type >::mask().
|
mutableprivate |
Cached masked data.
Definition at line 189 of file FunctionParam.h.
|
private |
Number of parameters.
Definition at line 183 of file FunctionParam.h.
Referenced by casacore::FunctionParam< Type >::FunctionParam().
|
private |
Parameters.
Definition at line 185 of file FunctionParam.h.
Referenced by casacore::FunctionParam< Type >::FunctionParam(), casacore::FunctionParam< Type >::getParameters(), casacore::FunctionParam< Type >::nelements(), casacore::FunctionParam< Type >::operator[](), and casacore::FunctionParam< Type >::parameter().