Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/classcasa_1_1CompiledParam.html
Дата изменения: Unknown Дата индексирования: Mon Feb 14 22:12:20 2011 Кодировка: Поисковые слова: martian surface |
Parameters for a compiled string function object. More...
#include <CompiledParam.h>
Public Member Functions | |
CompiledParam () | |
The default constructor -- no functions, no parameters, nothing, the function operator returns a 0. | |
CompiledParam (const CompiledParam< T > &other) | |
Make this object a (deep) copy of other. | |
template<class W > | |
CompiledParam (const CompiledParam< W > &other) | |
CompiledParam< T > & | operator= (const CompiledParam< T > &other) |
Make this object a (deep) copy of other. | |
virtual | ~CompiledParam () |
Destructor. | |
virtual const String & | name () const |
Give name of function. | |
Bool | setFunction (const String &newFunction) |
Set a function. | |
const String & | errorMessage () const |
Return the error message of the compilation. | |
const FuncExpression & | function () const |
Return the expression. | |
virtual uInt | ndim () const |
Returns the dimension of function. | |
const String & | getText () const |
Returns the text of the function string. | |
const FuncExpression * | getFunctionPtr () const |
Returns the function pointer (for debugging). | |
Protected Attributes | |
uInt | ndim_p |
Number of dimensions of underlying function. | |
String | msg_p |
Possible error message. | |
String | text_p |
Input text string. | |
FuncExpression * | functionPtr_p |
Pointer to function. |
Parameters for a compiled string function object.
Internal
Given a string describing an expression (see FuncExpression class for details of the expression), the CompiledFunction
class wraps this expression as a Function (see Function class) which can be used in all places where functions can be used (e.g. see Fitting ).
This class takes care of the CompiledFunction parameter interface (see FunctionParam class for details).
In the following example a Gaussian profile with three parameters (height, center and halfwidth) is specified and its value and derivatives with respect to the parameters are calculated at x=2
.
// the Gaussian CompiledFunction<Double> prof("p0*exp(-((x-p1)/p2)^2)"); prof[0] = 2; // the height prof[1] = 1.5; // the center prof[2] = 1; // the width Vector<Double> x(3); X[0] = 1.9; x[1] = 2.0; x[2] = 2.1; cout << "Gaussian at x=" << x << ": " << prof(x) << endl; // and an automatic derivative one: CompiledFunction<AutoDiff<Double> > profad("p0*exp(-((x-p1)/p2)^2)"); cout << "Gaussian at x=" << x << ": " << profad(x) << endl;
will produce the output:
This class was created to allow specialization of the function evaluation in a simple way.
Definition at line 106 of file CompiledParam.h.
casa::CompiledParam< T >::CompiledParam | ( | ) |
The default constructor -- no functions, no parameters, nothing, the function operator returns a 0.
casa::CompiledParam< T >::CompiledParam | ( | const CompiledParam< T > & | other | ) |
Make this object a (deep) copy of other.
casa::CompiledParam< T >::CompiledParam | ( | const CompiledParam< W > & | other | ) | [inline] |
Definition at line 116 of file CompiledParam.h.
virtual casa::CompiledParam< T >::~CompiledParam | ( | ) | [virtual] |
Destructor.
const String& casa::CompiledParam< T >::errorMessage | ( | ) | const [inline] |
Return the error message of the compilation.
Definition at line 138 of file CompiledParam.h.
References casa::CompiledParam< T >::msg_p.
const FuncExpression& casa::CompiledParam< T >::function | ( | ) | const |
Return the expression.
const FuncExpression* casa::CompiledParam< T >::getFunctionPtr | ( | ) | const [inline] |
Returns the function pointer (for debugging).
Definition at line 150 of file CompiledParam.h.
const String& casa::CompiledParam< T >::getText | ( | ) | const [inline] |
Returns the text of the function string.
Definition at line 147 of file CompiledParam.h.
References casa::CompiledParam< T >::text_p.
virtual const String& casa::CompiledParam< T >::name | ( | ) | const [inline, virtual] |
Give name of function.
Reimplemented from casa::Function< T >.
Definition at line 130 of file CompiledParam.h.
virtual uInt casa::CompiledParam< T >::ndim | ( | ) | const [inline, virtual] |
Returns the dimension of function.
Implements casa::Function< T >.
Definition at line 144 of file CompiledParam.h.
References casa::CompiledParam< T >::ndim_p.
CompiledParam<T>& casa::CompiledParam< T >::operator= | ( | const CompiledParam< T > & | other | ) |
Make this object a (deep) copy of other.
Bool casa::CompiledParam< T >::setFunction | ( | const String & | newFunction | ) |
Set a function.
The return will be False (and an error message will be set) if a compilation error occurs
FuncExpression* casa::CompiledParam< T >::functionPtr_p [protected] |
Pointer to function.
Definition at line 163 of file CompiledParam.h.
String casa::CompiledParam< T >::msg_p [protected] |
Possible error message.
Definition at line 158 of file CompiledParam.h.
Referenced by casa::CompiledParam< T >::errorMessage().
uInt casa::CompiledParam< T >::ndim_p [protected] |
Number of dimensions of underlying function.
Definition at line 151 of file CompiledParam.h.
Referenced by casa::CompiledParam< T >::ndim().
String casa::CompiledParam< T >::text_p [protected] |
Input text string.
Definition at line 160 of file CompiledParam.h.
Referenced by casa::CompiledParam< T >::getText().