casacore
|
A module that represents various function-like classes. More...
Modules | |
Functionals_module_internal_classes | |
Internal Functionals_module classes and functions. | |
Classes | |
class | casacore::FunctionFactory< T > |
a class for creating Function objects from Records More... | |
class | casacore::ArraySampledFunctional< T > |
Index into an array using the longest axis. More... | |
class | casacore::Chebyshev< T > |
A function class that defines a Chebyshev polynomial. More... | |
class | casacore::ChebyshevEnums |
Define enums for Chebyshev classes. More... | |
class | casacore::ChebyshevParamModeImpl< T > |
A ChebyshevParam with the get/setMode implementation. More... | |
class | casacore::ChebyshevParamModeImpl_PS< AutoDiff< T > > |
Partial specialization of ChebyshevParamModeImpl for AutoDiff More... | |
class | casacore::ChebyshevParamModeImpl_PSA< AutoDiffA< T > > |
Partial specialization of ChebyshevParamModeImpl for AutoDiff More... | |
class | casacore::CombiFunction< T > |
Form a linear combination of function objects. More... | |
class | casacore::CompiledFunction< T > |
Form a linear combination of function objects. More... | |
class | casacore::CompoundFunction< T > |
Sum of a collection of Functions which behaves as one Function object. More... | |
class | casacore::ConstantND< T > |
A constant function. More... | |
class | casacore::DiracDFunction< T > |
A one dimensional Dirac delta function. More... | |
class | casacore::EclecticFunctionFactory< T > |
class | casacore::EvenPolynomial< T > |
A one dimensional odd polynomial class. More... | |
class | casacore::EvenPolynomialParam< T > |
Parameter handling for even polynomials. More... | |
struct | casacore::FuncExprData_global_functions_output |
Output function. More... | |
class | casacore::FuncExpression |
An expression executable as function. More... | |
struct | casacore::FuncExpression_global_functions_output |
Output function. More... | |
struct | casacore::FuncExpression_global_functions_execute |
Execute function. More... | |
class | casacore::Function< T, U > |
Numerical functional interface class. More... | |
struct | casacore::Function_global_functions_Output |
Global functions. More... | |
class | casacore::Function1D< T, U > |
Numerical functional interface class for 1 dimension. More... | |
class | casacore::FunctionHolder< T > |
A holder for Functions to enable record conversions. More... | |
class | casacore::FunctionMarshallable |
a class for serializing/reconstituting Function objects to/from Records More... | |
class | casacore::FunctionOrder< T > |
Container of function description details. More... | |
struct | casacore::FunctionOrder_global_functions_Output |
Global functions. More... | |
class | casacore::FunctionParam< T > |
Container of function parameters with masking flags. More... | |
struct | casacore::FunctionParam_global_functions_Output |
Global functions. More... | |
class | casacore::FunctionTraits< T > |
Function data types for parameters and arguments. More... | |
class | casacore::FunctionTraits_P< AutoDiff< T > > |
FunctionTraits specialization for AutoDiff. More... | |
class | casacore::FunctionTraits_PA< AutoDiffA< T > > |
FunctionTraits specialization for AutoDiffA. More... | |
class | casacore::FunctionTraits_PX< AutoDiffX< T > > |
FunctionTraits specialization for AutoDiffX. More... | |
class | casacore::FunctionWrapper< T > |
Construct nD function objects from C++ functions. More... | |
class | casacore::Gaussian1D< T > |
A one dimensional Gaussian class. More... | |
class | casacore::Gaussian2D< T > |
A two dimensional Gaussian class. More... | |
class | casacore::Gaussian3D< T > |
A three dimensional Gaussian class. More... | |
class | casacore::GaussianND< T > |
A Multi-dimensional Gaussian functional. More... | |
class | casacore::GNoiseFunction< T > |
A one dimensional normal distribution. More... | |
class | casacore::HyperPlane< T > |
A hyper plane function. More... | |
class | casacore::Interpolate1D< Domain, Range > |
Interpolate in one dimension. More... | |
class | casacore::KaiserBFunction< T > |
A one dimensional Kaiser-Bessel function. More... | |
class | casacore::Lorentzian1D< T > |
A one dimensional Lorentzian class. More... | |
class | casacore::MarshallableChebyshev< T > |
A Chebyshev function class that supports serialization. More... | |
class | casacore::MarshButterworthBandpass< T > |
A Butterworth function class that supports serialization. More... | |
class | casacore::OddPolynomial< T > |
A one dimensional odd polynomial class. More... | |
class | casacore::OddPolynomialParam< T > |
Parameter handling for odd polynomials. More... | |
class | casacore::PoissonFunction< T > |
A one dimensional Poisson function. More... | |
class | casacore::Polynomial< T > |
A one dimensional polynomial class. More... | |
class | casacore::PolynomialParam< T > |
Parameter handling for one-dimensional polynomials. More... | |
class | casacore::PowerLogarithmicPolynomial< T > |
A one dimensional power logarithmic polynomial class of form y = c_0 * x**(c_1 + c_2*ln(x) + c_3*ln(x)**2 +... c_n*ln(x)**(n-1)) More... | |
class | casacore::PowerLogarithmicPolynomialParam< T > |
Parameter handling for one-dimensional power logarithmic polynomials. More... | |
class | casacore::SampledFunctional< Range > |
A base class for indexing into arbitrary data types. More... | |
class | casacore::ScalarSampledFunctional< T > |
A unified interface for indexing into Vectors or Blocks. More... | |
class | casacore::SerialHelper |
class | casacore::SimButterworthBandpass< T > |
a class for evaluating a Butterworth filter transfer function. More... | |
class | casacore::SincFunction< T > |
A one dimensional sin(x)/x. More... | |
class | casacore::Sinusoid1D< T > |
A one dimensional Sinusoid class. More... | |
class | casacore::SpecificFunctionFactory< T, F > |
class | casacore::SPolynomial< T > |
A one dimensional scaled polynomial class. More... | |
class | casacore::SPolynomialParam< T > |
Parameter handling for scaled 1-D polynomials. More... | |
class | casacore::UnaryFunction< T > |
A one dimensional unary function. More... | |
class | casacore::WrapperData_TT< T, T, T, True, True > |
Specialization for calls with argument and parameter. More... | |
class | casacore::WrapperData_VT< T, Vector< T >, T, True, True > |
Specialization for calls with argument and parameter. More... | |
class | casacore::WrapperData_TV< T, T, Vector< T >, True, True > |
Specialization for calls with argument and parameters. More... | |
class | casacore::WrapperData_VV< T, Vector< T >, Vector< T >, True, True > |
Specialization for calls with argument and parameters. More... | |
class | casacore::WrapperData_FT< T, T, T, False, True > |
Specialization for calls with no arguments and parameter. More... | |
class | casacore::WrapperData_FV< T, T, Vector< T >, False, True > |
Specialization for calls with no arguments and parameters. More... | |
class | casacore::WrapperData_TF< T, T, T, True, False > |
Specialization for calls with argument and no parameters. More... | |
class | casacore::WrapperData_VF< T, Vector< T >, T, True, False > |
Specialization for calls with argument and no parameters. More... | |
class | casacore::WrapperData_FF< T, T, T, False, False > |
Specialization for calls with no arguments and no parameters. More... | |
A module that represents various function-like classes.
See below for an overview of the classes in this module.
The term Functional
was chosen to roughly follow the usage in Barton and Nackman's Scientific and Engineering C++. Functional classes map a Domain object into a Range object, rather like a mathematical function
. They use operator()
, so they look much like single argument C++ functions
.
Functionals
and their derived classes map an input Domain
object into an output Range
object using the operator()
. Often the input and output types are numeric, but it can be of any type.
would be a legal Functional.
The Functions
and their derived classes map, again using the operator()
, numeric value(s) into a numeric value. Since they are numeric, the Domain
and Range
base type can be of type AutoDiff<T>
(where T
is numeric base type) or one of its derivations, in which case the value and its derivatives will be calculated.
Warning: In the current version the Domain
and Range
are the same for Functions
The basic classes are:
Functional<Domain, Range>
A base class that maps a Domain
object into a Range
object using the Range operator(const Domain &)
. All information necessary to convert the Domain
into a Range
will be available in the class or in the input information. No variable class state (parameters) are available.
FunctionParam<T>
A helper base class that acts as a container for parameters (state) used in Function
classes. The class contains a list of parameters, and a list of flags associated with the parameters. Methods to set and obtain the parameters (using operator[]
) and their flags (using methods mask()
) are available. The flags can e.g. be used to indicate to Fitting
routines if a certain parameter has to be updated ('fitted') or not.
Tip: The FunctionParam class does not assume anything about the uses of the class, but leaves that to the final users; This means that a lot of copying between intermediate and final users is not necessary (like between a Gaussian fitter with fixed parameters and the Fitting routines: the Gaussian fitter just sets a flag to False, and let the Fitting worry about what to do internally);
Function<T>
Base class for function objects with zero or more parameters (i.e. Functionals with state). All parameters should be of the same type T as the Function<T>
. Function
objects are specifically geared towards use in the Fitting classes, but can be used anywhere where the value (and/or derivatives) of functions are needed.
The Function<T>
class is derived from Functional
and contains a FunctionParam<T>
object. The parameters act as state for the function (e.g. a width for a Gaussian). A function object is called using the T operator(const T&)
(ndim=1), or the T operator(const Vector<T>&)
(all values of ndim), or T operator(const T&, const T&)
(for ndim=2 only). If the template argument is AutoDiff<T>
, the parameters and the returned value will be AutoDiff<T>
; the arguments of the operator()
will be of type T
. The returned value of the function will be the function value at x (and the derivatives w.r.t. the non-masked parameters) Using AutoDiffA<T>
the derivatives can be calculated w.r.t. parameters and/or arguments, see AutoDiff and FunctionTraits for details.
Tip: A Function1D
is provided for 1-dimensional function objects
Actual functional classes:
Gaussian1D<T>
An actual function object will be derived from Function<T>
. The minimum functionality of a Function object will be support for the operator()
methods (through a single, hidden, eval()
method); for the manipulation of the associated parameters (using operator[index]
and mask(index)
) and some administrative aids (ndim()
, nparameters()
and the like.
In most cases it is advantageous to have a special parameter handling class (e.g. Gaussian1DParam
), to separate the (template independent) parameter handling from the possible specialization of the eval()
method, and to more easily incorporate special parameter handling (e.g. using flux rather than amplitude of a Gaussian). All of this is transparent to the end-user.
Combinatory Function objects are provided to easily combine and create function objects:
param0*gauss(x) + param1*poly(x)
will take a global function (or by the use of the STL function adapters mem_fun*
also member functions) of any dimension, and with any number of parameters. The function is assumed to be called as f(x, p)
, and is wrapped like FunctionWrapper(&func, param&, ndim)
(see example).
A function to find a bracketed root by bisection could be written as follows:
Since Function1D is derived from Functional, the above function will also work with classes derived from Function1D. To behave sensibly, the Domain and Range types should be real, i.e., Float or Double.
To calculate the value of a polynomial
at x=5.1
:
Create a simple function (1-dimensional) with 2 parameters (A and B):
make it into a function object for initial parameters 2 and pi:
Make the first parameter 3:
(for the global function you have to change p[0]
). Calculate the value of the function:
A function object could be created as:
Which can be called as:
The immediate motivations for this module were: