Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/classcasa_1_1FunctionTraits.html
Дата изменения: Unknown
Дата индексирования: Mon Feb 14 22:28:29 2011
Кодировка:

Поисковые слова: star
casacore: casa::FunctionTraits< T > Class Template Reference
Public Types | Static Public Member Functions

casa::FunctionTraits< T > Class Template Reference
[Functionals_module]

Function data types for parameters and arguments. More...

#include <FunctionTraits.h>

List of all members.

Public Types

typedef T Type
 Actual template type.
typedef T BaseType
 Template base type.
typedef T NumericType
 Numeric type of template.
typedef T ParamType
 Type for parameters.
typedef T ArgType
 Type for arguments.
typedef AutoDiff< T > DiffType
 Default type for differentiation.

Static Public Member Functions

static const T & getValue (const T &in)
 Get the value.
static void setValue (T &out, const T &val, const uInt, const uInt)
 Set a value (and possible derivative).

Detailed Description

template<class T>
class casa::FunctionTraits< T >

Function data types for parameters and arguments.

Intended use:

Internal

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Test programs:
t

Prerequisite

Etymology

A trait is a characteristic feature. FunctionTraits defines relationships between the data types of result, parameters and arguments of function objects.

Synopsis

This templated class contains a number of typedefs that describe the relationship between different numeric data types used for the calculation of Function and the function parameter and arguments.

Its main use is to optimize the speed of the calculation of function values and derivatives in the case of AutoDiff use and manual calculation of derivatives, by allowing the data type of the the arguments and/or parameters to be plain numeric in cases where the derivatives wrt these are not needed. To enable this, the following definitions are used for the use of the Function template. Bear in mind that the Function operator is defined as result = f<T>(x; parameters).

  1. Simple numeric type (Double, Complex, etc): result, parameters and arguments: all the one defined templated type.
  2. AutoDiff<T> indicates the calculation (either automatic or with specialized implementations) of the result with a T function value for T arg, and AutoDiff<T> parameters.
  3. AutoDiffA calculate form AutoDiff<T> arguments and parameters (note that either could be simple values with zero derivatives)
  4. AutoDiffX<T> : calculate only with respect to the arguments the derivatives, by using T parameters

The following types are defined:

Type
The template argument
BaseType
One down in the template hierarchy if possible (e.g. Double for AutoDiff<Double>)
NumericType
Ultimate numeric type (e.g. Double for AutoDiff<AutoDiff<Double> >
ParamType
Type used for parameters
ArgType
Type used for arguments
DiffType
The default differentiation type (e.g. AutoDiff<Double> for AutoDiff<Double>)
getValue()
get the value of a simple numeric or of an AutoDiff
setValue()
set the value of a simple numeric or of an AutoDiff

The specializations are done in such a way that higher order derivatives (e.g. AutoDiff<AutoDiff<Double> >) are catered for.

Note that the class names in the following definitions are extended with some individual id (like _PA): do not use them in programming, they are only necessary for the cxx2html interpreter)

This class is implemented as a number of specializations for the following data types.

Example

See the Function class code.

Motivation

To keep the Function class single templated

To Do

Definition at line 139 of file FunctionTraits.h.


Member Typedef Documentation

template<class T>
typedef T casa::FunctionTraits< T >::ArgType

Type for arguments.

Definition at line 150 of file FunctionTraits.h.

template<class T>
typedef T casa::FunctionTraits< T >::BaseType

Template base type.

Definition at line 144 of file FunctionTraits.h.

template<class T>
typedef AutoDiff<T> casa::FunctionTraits< T >::DiffType

Default type for differentiation.

Definition at line 152 of file FunctionTraits.h.

template<class T>
typedef T casa::FunctionTraits< T >::NumericType

Numeric type of template.

Definition at line 146 of file FunctionTraits.h.

template<class T>
typedef T casa::FunctionTraits< T >::ParamType

Type for parameters.

Definition at line 148 of file FunctionTraits.h.

template<class T>
typedef T casa::FunctionTraits< T >::Type

Actual template type.

Definition at line 142 of file FunctionTraits.h.


Member Function Documentation

template<class T>
static const T& casa::FunctionTraits< T >::getValue ( const T &  in  )  [inline, static]

Get the value.

Definition at line 154 of file FunctionTraits.h.

template<class T>
static void casa::FunctionTraits< T >::setValue ( T &  out,
const T &  val,
const   uInt,
const   uInt 
) [inline, static]

Set a value (and possible derivative).

Definition at line 156 of file FunctionTraits.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines