| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Types | Private Member Functions | Private Attributes | List of all members
Genfun::GaudiMathImplementation::SimpleFunction Class Reference

`#include <GaudiMath/Adapters.h>`

Inheritance diagram for Genfun::GaudiMathImplementation::SimpleFunction:
[legend]
Collaboration diagram for Genfun::GaudiMathImplementation::SimpleFunction:
[legend]

## Public Types
typedef double(* | Function1 )(const double)
typedef double(* | Function2 )(const double *)
typedef double(* | Function3 )(const std::vector< double > &)

## Public Member Functions
| SimpleFunction (Function1 func)
| From CLHEP/GenericFunctions.
| 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)

Definition at line 205 of file FunAdapters.h.

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

Definition at line 206 of file FunAdapters.h.

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

Definition at line 207 of file FunAdapters.h.

## Member Enumeration Documentation

enum Genfun::GaudiMathImplementation::SimpleFunction::Case
| protected

Enumerator:

  TrivialArg |
  ArrayArg |
  VectorArg |

Definition at line 209 of file FunAdapters.h.

{ TrivialArg , ArrayArg , VectorArg } ;

## Constructor & Destructor Documentation

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

From CLHEP/GenericFunctions.

from CLHGEP/GenericFunctions

constructor from the trivial function

Parameters

  func | pointer to trivial function

Definition at line 156 of file Adapter.cpp.

: AbsFunction ()
, m_case ( SimpleFunction::TrivialArg )
, m_DIM ( 1 )
, m_func1 ( func )
, m_func2 ( 0 )
, m_arg2 ( 0 )
, m_func3 ( 0 )
, m_arg3 ( )
{}

Genfun::GaudiMathImplementation::SimpleFunction::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

Definition at line 175 of file Adapter.cpp.

: AbsFunction ()
, m_case ( SimpleFunction::ArrayArg )
, m_DIM ( dim )
, m_func1 ( 0 )
, m_func2 ( func )
, m_arg2 ( 0 )
, m_func3 ( 0 )
, m_arg3 ( )
{
m_arg2 = new double[dim];
}

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

constructor from the simple function with vector argument

constructor from the simple function with array-like argument

Parameters

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

Definition at line 197 of file Adapter.cpp.

: AbsFunction ()
, m_case ( SimpleFunction::VectorArg )
, m_DIM ( dim )
, m_func1 ( 0 )
, m_func2 ( 0 )
, m_arg2 ( 0 )
, m_func3 ( func )
, m_arg3 ( dim , 0 )
{}

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

copy constructor

Definition at line 214 of file Adapter.cpp.

: AbsFunction ()
, m_case ( right.m_case )
, m_DIM ( right.m_DIM )
, m_func1 ( right.m_func1 )
, m_func2 ( right.m_func2 )
, m_arg2 ( 0 )
, m_func3 ( right.m_func3 )
, m_arg3 ( right.m_arg3 )
{
if ( 0 != right.m_arg2 )
{
std::memcpy(m_arg2, right.m_arg2, m_DIM);
}
}

Genfun::GaudiMathImplementation::SimpleFunction::~SimpleFunction | ( |  | ) |
| virtual

destructor

Definition at line 234 of file Adapter.cpp.

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

Genfun::GaudiMathImplementation::SimpleFunction::SimpleFunction | ( |  | ) |
| private

## Member Function Documentation

virtual unsigned int Genfun::GaudiMathImplementation::SimpleFunction::dimensionality | ( |  | ) | const
| inline virtual

dimensionality of the problem

Definition at line 243 of file FunAdapters.h.

{ 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.

{ return true ; }

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

Function value.

Definition at line 255 of file Adapter.cpp.

{
double result = 0 ;
switch ( m_case )
{
case TrivialArg :
result = (*m_func1) ( value ) ; break ;
case ArrayArg :
std::fill ( m_arg2 , m_arg2 + m_DIM , 0.0 );
m_arg2[0] = value ;
result = (*m_func2) ( m_arg2 ) ; break ;
case VectorArg :
std::fill ( m_arg3.begin () , m_arg3.end () , 0.0 );
m_arg3[0] = value ;
result = (*m_func3) ( m_arg3 ) ; break ;
default:
break ;
};
return result ;
}

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

Function value.

Definition at line 280 of file Adapter.cpp.

{
double result = 0 ;
switch ( m_case )
{
case TrivialArg :
result = (*m_func1) ( argument[0] ) ; break ;
case ArrayArg :
for( size_t i = 0 ; i < m_DIM ; ++i ) { m_arg2[i] = argument[i] ; }
return (*m_func2)( m_arg2 ) ; ; break ;
case VectorArg :
for( size_t i = 0 ; i < m_DIM ; ++i ) { m_arg3[i] = argument[i] ; }
result = (*m_func3) ( m_arg3 ) ; break ;
default:
break ;
}
return result ;
}

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

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

Derivatives.

Definition at line 241 of file Adapter.cpp.

{
if ( i >= m_DIM )
{
const AbsFunction& aux = GaudiMath::Constant( 0 , m_DIM ) ;
return Genfun::FunctionNoop( &aux ) ;
}
const AbsFunction& aux = GaudiMath::Derivative( *this , i ) ;
return Genfun::FunctionNoop( &aux );
}

## Member Data Documentation

double* Genfun::GaudiMathImplementation::SimpleFunction::m_arg2
| private

Definition at line 268 of file FunAdapters.h.

std::vector<double> Genfun::GaudiMathImplementation::SimpleFunction::m_arg3
| mutable private

Definition at line 271 of file FunAdapters.h.

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.

Function3 Genfun::GaudiMathImplementation::SimpleFunction::m_func3
| private

Definition at line 270 of file FunAdapters.h.

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

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