| # Gaudi Framework, version v21r7p1 |

Home |  | Generated: 15 Feb 2010

# Genfun::GaudiMathImplementation::SimpleFunction Class Reference

`#include <GaudiMath/Adapters.h>`

Collaboration diagram for Genfun::GaudiMathImplementation::SimpleFunction:

[legend]

List of all members.

## Public Types
typedef double(* | Function1 )(const double)
typedef double(* | Function2 )(const double *)
typedef double(* | Function3 )(const std::vector< double > &)
## Public Member Functions
| FUNCTION_OBJECT_DEF (SimpleFunction)
| From CLHEP/GenericFunctions.
| SimpleFunction (Function1 func)
| constructor from the trivial function
| SimpleFunction (Function2 func, const size_t dim)
| constructor from the simple function with array-like argument
| SimpleFunction (Function3 func, const size_t dim)
| constructor from the simple function with vector argument
| SimpleFunction (const SimpleFunction &)
| copy constructor
virtual | ~SimpleFunction ()
| destructor
virtual unsigned int | dimensionality () const
| dimensionality of the problem
virtual bool | hasAnalyticDerivative () const
| Does this function have an analytic derivative?
virtual double | operator() (double) const
| Function value.
virtual double | operator() (const Argument &) const
| Function value.
virtual Genfun::Derivative | partial (unsigned int i) const
| Derivatives.
## Protected Types
enum | Case { TrivialArg, ArrayArg, VectorArg }
## Private Member Functions
| SimpleFunction ()
SimpleFunction & | operator= (const SimpleFunction &)
## Private Attributes
Case | m_case
size_t | m_DIM
Function1 | m_func1
Function2 | m_func2
double * | m_arg2
Function3 | m_func3
std::vector< double > | m_arg3

## Detailed Description

Author:
  Ivan BELYAEV

Date:
  2003-08-31

Definition at line 202 of file FunAdapters.h.

## Member Typedef Documentation

typedef double(* Genfun::GaudiMathImplementation::SimpleFunction::Function1)(const double)

typedef double(* Genfun::GaudiMathImplementation::SimpleFunction::Function2)(const double *)

typedef double(* Genfun::GaudiMathImplementation::SimpleFunction::Function3)(const std::vector< double > &)

## Member Enumeration Documentation

enum Genfun::GaudiMathImplementation::SimpleFunction::Case`[protected]`

Enumerator:

  TrivialArg |
  ArrayArg |
  VectorArg |

Definition at line 209 of file FunAdapters.h.

    00209 { TrivialArg , ArrayArg , VectorArg } ;

## Constructor & Destructor Documentation

Genfun::GaudiMathImplementation::SimpleFunction::SimpleFunction | ( | Function1 | func | ) |

constructor from the trivial function

Parameters:

  | func | pointer to trivial function

Genfun::GaudiMathImplementation::SimpleFunction::SimpleFunction | ( | Function2 | func,
|  | const size_t | dim |
| ) |  |  |

constructor from the simple function with array-like argument

Parameters:

  | func | pointer to trivial function
  | dim | dimension of the argument

Genfun::GaudiMathImplementation::SimpleFunction::SimpleFunction | ( | Function3 | func,
|  | const size_t | dim |
| ) |  |  |

constructor from the simple function with vector argument

Parameters:

  | func | pointer to trivial function
  | dim | dimension of the argument

Genfun::GaudiMathImplementation::SimpleFunction::SimpleFunction | ( | const SimpleFunction & | right | ) |

copy constructor

Definition at line 213 of file Adapter.cpp.

    00214       : AbsFunction ()
    00215       , m_case      ( right.m_case  )
    00216       , m_DIM       ( right.m_DIM   )
    00217       , m_func1     ( right.m_func1 )
    00218       , m_func2     ( right.m_func2 )
    00219       , m_arg2      ( 0             )
    00220       , m_func3     ( right.m_func3 )
    00221       , m_arg3      ( right.m_arg3  )
    00222     {
    00223       if (  0 != right.m_arg2 )
    00224       {
    00225         m_arg2 = new double[m_DIM] ;
    00226         std::copy( right.m_arg2 , right.m_arg2 + m_DIM , m_arg2 );
    00227       }
    00228     };

Genfun::GaudiMathImplementation::SimpleFunction::~SimpleFunction | ( |  | ) | `[virtual]`

destructor

Definition at line 234 of file Adapter.cpp.

    00235     { if( 0 != m_arg2 ) { delete m_arg2 ; m_arg2 = 0 ;} }

Genfun::GaudiMathImplementation::SimpleFunction::SimpleFunction | ( |  | ) | `[private]`

## Member Function Documentation

Genfun::GaudiMathImplementation::SimpleFunction::FUNCTION_OBJECT_DEF | ( | SimpleFunction |  | ) |

From CLHEP/GenericFunctions.

virtual unsigned int Genfun::GaudiMathImplementation::SimpleFunction::dimensionality | ( |  | ) | const`[inline, virtual]`

dimensionality of the problem

Definition at line 243 of file FunAdapters.h.

    00243 { return m_DIM   ; }

virtual bool Genfun::GaudiMathImplementation::SimpleFunction::hasAnalyticDerivative | ( |  | ) | const`[inline, virtual]`

Does this function have an analytic derivative?

Definition at line 245 of file FunAdapters.h.

    00245 { return true    ; }

double Genfun::GaudiMathImplementation::SimpleFunction::operator() | ( | double | value | ) | const`[virtual]`

Function value.

Definition at line 255 of file Adapter.cpp.

    00256     {
    00257       double result = 0 ;
    00258       switch ( m_case )
    00259       {
    00260       case TrivialArg  :
    00261         result = (*m_func1) ( value  ) ; break ;
    00262       case ArrayArg    :
    00263         std::fill ( m_arg2 , m_arg2 + m_DIM , 0.0 );
    00264         m_arg2[0] = value  ;
    00265         result = (*m_func2) ( m_arg2 ) ; break ;
    00266       case VectorArg   :
    00267         std::fill ( m_arg3.begin () , m_arg3.end () , 0.0 );
    00268         m_arg3[0] = value  ;
    00269         result = (*m_func3) ( m_arg3 ) ; break ;
    00270       default:
    00271         break ;
    00272       };
    00273       return result ;
    00274     };

double Genfun::GaudiMathImplementation::SimpleFunction::operator() | ( | const Argument & | argument | ) | const`[virtual]`

Function value.

Definition at line 280 of file Adapter.cpp.

    00281     {
    00282       double result = 0 ;
    00283       switch ( m_case )
    00284       {
    00285       case TrivialArg  :
    00286         result = (*m_func1) ( argument[0]  ) ; break ;
    00287       case ArrayArg    :
    00288         for( size_t i = 0 ; i < m_DIM ; ++i ) { m_arg2[i] = argument[i] ; }
    00289         return (*m_func2)( m_arg2 ) ;        ; break ;
    00290       case VectorArg   :
    00291         for( size_t i = 0 ; i < m_DIM ; ++i ) { m_arg3[i] = argument[i] ; }
    00292         result = (*m_func3) ( m_arg3 ) ; break ;
    00293       default:
    00294         break ;
    00295       }
    00296       return result ;
    00297     };

Genfun::Derivative Genfun::GaudiMathImplementation::SimpleFunction::partial | ( | unsigned int | i | ) | const`[virtual]`

Derivatives.

Definition at line 241 of file Adapter.cpp.

    00242     {
    00243       if ( i >= m_DIM )
    00244       {
    00245         const AbsFunction& aux = GaudiMath::Constant( 0 , m_DIM ) ;
    00246         return Genfun::FunctionNoop( &aux ) ;
    00247       }
    00248       const  AbsFunction& aux = GaudiMath::Derivative( *this , i ) ;
    00249       return Genfun::FunctionNoop( &aux );
    00250     };

SimpleFunction& Genfun::GaudiMathImplementation::SimpleFunction::operator= | ( | const SimpleFunction & |  | ) | `[private]`

## Member Data Documentation

Case Genfun::GaudiMathImplementation::SimpleFunction::m_case`[private]`

Definition at line 262 of file FunAdapters.h.

size_t Genfun::GaudiMathImplementation::SimpleFunction::m_DIM`[private]`

Definition at line 263 of file FunAdapters.h.

Function1 Genfun::GaudiMathImplementation::SimpleFunction::m_func1`[private]`

Definition at line 265 of file FunAdapters.h.

Function2 Genfun::GaudiMathImplementation::SimpleFunction::m_func2`[private]`

Definition at line 267 of file FunAdapters.h.

double* Genfun::GaudiMathImplementation::SimpleFunction::m_arg2`[private]`

Definition at line 268 of file FunAdapters.h.

Function3 Genfun::GaudiMathImplementation::SimpleFunction::m_func3`[private]`

Definition at line 270 of file FunAdapters.h.

std::vector<double> Genfun::GaudiMathImplementation::SimpleFunction::m_arg3`[mutable, private]`

Definition at line 271 of file FunAdapters.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7p1/GaudiGSL/GaudiMath/FunAdapters.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7p1/GaudiGSL/src/Lib/Adapter.cpp