| The Gaudi Framework v28r2p1 (f1a77ff4)

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

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

Public Types | Public Member Functions | Protected Types | Private Member Functions | Private Attributes | List of all members
Genfun::GaudiMathImplementation::SimpleFunction Class Reference

mandatory macro from CLHEP/GenericFunctions More...

`#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. More...
| SimpleFunction (Function2 func, const size_t dim)
| constructor from the simple function with array-like argument More...
| SimpleFunction (Function3 func, const size_t dim)
| constructor from the simple function with vector argument More...
| SimpleFunction (const SimpleFunction &)
| copy constructor More...
| ~SimpleFunction () override=default
unsigned int | dimensionality () const override
| dimensionality of the problem More...
bool | hasAnalyticDerivative () const override
| Does this function have an analytic derivative? More...
double | operator() (double) const override
| Function value. More...
double | operator() (const Argument &) const override
| Function value. More...
Genfun::Derivative | partial (unsigned int i) const override
| Derivatives. More...

## 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
std::unique_ptr< double[]> | m_arg2
Function3 | m_func3
std::vector< double > | m_arg3

## Detailed Description

mandatory macro from CLHEP/GenericFunctions

Author
  Ivan BELYAEV

Date
  2003-08-31

Definition at line 216 of file FunAdapters.h.

## Member Typedef Documentation

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

Definition at line 219 of file FunAdapters.h.

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

Definition at line 220 of file FunAdapters.h.

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

Definition at line 221 of file FunAdapters.h.

## Member Enumeration Documentation

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

Enumerator
TrivialArg |
ArrayArg |
VectorArg |

Definition at line 223 of file FunAdapters.h.

223 { TrivialArg , ArrayArg , VectorArg } ;
Genfun::GaudiMathImplementation::SimpleFunction::TrivialArg
Definition: FunAdapters.h:223
Genfun::GaudiMathImplementation::SimpleFunction::VectorArg
Definition: FunAdapters.h:223
Genfun::GaudiMathImplementation::SimpleFunction::ArrayArg
Definition: FunAdapters.h:223

## Constructor & Destructor Documentation

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

From CLHEP/GenericFunctions.

constructor from the trivial function

constructor from the trivial function

Parameters

  func | pointer to trivial function
  func | pointer to trivial function

Definition at line 145 of file Adapter.cpp.

146 : AbsFunction ()
147 , m_case ( SimpleFunction::TrivialArg )
148 , m_DIM ( 1 )
149 , m_func1 ( func )
150 , m_func2 ( nullptr )
151 , m_func3 ( nullptr )
152 {}
Genfun::GaudiMathImplementation::SimpleFunction::m_func3
Function3 m_func3
Definition: FunAdapters.h:284
Genfun::GaudiMathImplementation::SimpleFunction::m_func2
Function2 m_func2
Definition: FunAdapters.h:281
Genfun::GaudiMathImplementation::SimpleFunction::TrivialArg
Definition: FunAdapters.h:223
GaudiPluginService.cpluginsvc.func
func
Definition: cpluginsvc.py:218
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:277
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:276
Genfun::GaudiMathImplementation::SimpleFunction::m_func1
Function1 m_func1
Definition: FunAdapters.h:279

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 162 of file Adapter.cpp.

164 : AbsFunction ()
165 , m_case ( SimpleFunction::ArrayArg )
166 , m_DIM ( dim )
167 , m_func1 ( nullptr )
168 , m_func2 ( func )
169 , m_arg2 ( new double[dim] )
170 , m_func3 ( nullptr )
171 {
172 }
Genfun::GaudiMathImplementation::SimpleFunction::m_func3
Function3 m_func3
Definition: FunAdapters.h:284
Genfun::GaudiMathImplementation::SimpleFunction::m_arg2
std::unique_ptr< double[]> m_arg2
Definition: FunAdapters.h:282
Genfun::GaudiMathImplementation::SimpleFunction::m_func2
Function2 m_func2
Definition: FunAdapters.h:281
GaudiPluginService.cpluginsvc.func
func
Definition: cpluginsvc.py:218
Genfun::GaudiMathImplementation::SimpleFunction::ArrayArg
Definition: FunAdapters.h:223
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:277
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:276
Genfun::GaudiMathImplementation::SimpleFunction::m_func1
Function1 m_func1
Definition: FunAdapters.h:279

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 182 of file Adapter.cpp.

184 : AbsFunction ()
185 , m_case ( SimpleFunction::VectorArg )
186 , m_DIM ( dim )
187 , m_func1 ( nullptr )
188 , m_func2 ( nullptr )
189 , m_func3 ( func )
190 , m_arg3 ( dim , 0 )
191 {}
Genfun::GaudiMathImplementation::SimpleFunction::m_func3
Function3 m_func3
Definition: FunAdapters.h:284
Genfun::GaudiMathImplementation::SimpleFunction::m_func2
Function2 m_func2
Definition: FunAdapters.h:281
Genfun::GaudiMathImplementation::SimpleFunction::m_arg3
std::vector< double > m_arg3
Definition: FunAdapters.h:285
Genfun::GaudiMathImplementation::SimpleFunction::VectorArg
Definition: FunAdapters.h:223
GaudiPluginService.cpluginsvc.func
func
Definition: cpluginsvc.py:218
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:277
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:276
Genfun::GaudiMathImplementation::SimpleFunction::m_func1
Function1 m_func1
Definition: FunAdapters.h:279

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

copy constructor

Definition at line 198 of file Adapter.cpp.

199 : AbsFunction ()
200 , m_case ( right.m_case )
201 , m_DIM ( right.m_DIM )
202 , m_func1 ( right.m_func1 )
203 , m_func2 ( right.m_func2 )
204 , m_func3 ( right.m_func3 )
205 , m_arg3 ( right.m_arg3 )
206 {
207 if ( right.m_arg2 )
208 {
209 m_arg2.reset( new double[m_DIM] );
210 std::copy_n(right.m_arg2.get(), m_DIM, m_arg2.get());
211 }
212 }
Genfun::GaudiMathImplementation::SimpleFunction::m_func3
Function3 m_func3
Definition: FunAdapters.h:284
std::right
T right(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_arg2
std::unique_ptr< double[]> m_arg2
Definition: FunAdapters.h:282
std::copy_n
T copy_n(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_func2
Function2 m_func2
Definition: FunAdapters.h:281
Genfun::GaudiMathImplementation::SimpleFunction::m_arg3
std::vector< double > m_arg3
Definition: FunAdapters.h:285
std::unique_ptr::reset
T reset(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:277
std::unique_ptr::get
T get(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:276
Genfun::GaudiMathImplementation::SimpleFunction::m_func1
Function1 m_func1
Definition: FunAdapters.h:279

Genfun::GaudiMathImplementation::SimpleFunction::~SimpleFunction | ( |  | ) |
| override default

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

## Member Function Documentation

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

dimensionality of the problem

Definition at line 257 of file FunAdapters.h.

257 { return m_DIM ; }
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:277

bool Genfun::GaudiMathImplementation::SimpleFunction::hasAnalyticDerivative | ( |  | ) | const
| inline override

Does this function have an analytic derivative?

Definition at line 259 of file FunAdapters.h.

259 { return true ; }

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

Function value.

Definition at line 234 of file Adapter.cpp.

235 {
236 double result = 0 ;
237 switch ( m_case )
238 {
239 case TrivialArg :
240 result = (*m_func1) ( value ) ; break ;
241 case ArrayArg :
242 std::fill_n( m_arg2.get() , m_DIM , 0.0 );
243 m_arg2[0] = value ;
244 result = (*m_func2) ( m_arg2.get() ) ; break ;
245 case VectorArg :
246 std::fill ( m_arg3.begin () , m_arg3.end () , 0.0 );
247 m_arg3[0] = value ;
248 result = (*m_func3) ( m_arg3 ) ; break ;
249 default:
250 break ;
251 };
252 return result ;
253 }
Genfun::GaudiMathImplementation::SimpleFunction::m_arg2
std::unique_ptr< double[]> m_arg2
Definition: FunAdapters.h:282
std::vector::end
T end(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::TrivialArg
Definition: FunAdapters.h:223
Genfun::GaudiMathImplementation::SimpleFunction::m_arg3
std::vector< double > m_arg3
Definition: FunAdapters.h:285
Genfun::GaudiMathImplementation::SimpleFunction::VectorArg
Definition: FunAdapters.h:223
Genfun::GaudiMathImplementation::SimpleFunction::ArrayArg
Definition: FunAdapters.h:223
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:277
std::unique_ptr::get
T get(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:276
std::vector::begin
T begin(T...args)
std::fill_n
T fill_n(T...args)
std::fill
T fill(T...args)

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

Function value.

Definition at line 259 of file Adapter.cpp.

260 {
261 double result = 0 ;
262 switch ( m_case )
263 {
264 case TrivialArg :
265 result = (*m_func1) ( argument[0] ) ; break ;
266 case ArrayArg :
267 for( size_t i = 0 ; i < m_DIM ; ++i ) { m_arg2[i] = argument[i] ; }
268 return (*m_func2)( m_arg2.get() ) ; ; break ;
269 case VectorArg :
270 for( size_t i = 0 ; i < m_DIM ; ++i ) { m_arg3[i] = argument[i] ; }
271 result = (*m_func3) ( m_arg3 ) ; break ;
272 default:
273 break ;
274 }
275 return result ;
276 }
Genfun::GaudiMathImplementation::SimpleFunction::m_arg2
std::unique_ptr< double[]> m_arg2
Definition: FunAdapters.h:282
Genfun::GaudiMathImplementation::SimpleFunction::m_func2
Function2 m_func2
Definition: FunAdapters.h:281
Genfun::GaudiMathImplementation::SimpleFunction::TrivialArg
Definition: FunAdapters.h:223
Genfun::GaudiMathImplementation::SimpleFunction::m_arg3
std::vector< double > m_arg3
Definition: FunAdapters.h:285
Genfun::GaudiMathImplementation::SimpleFunction::VectorArg
Definition: FunAdapters.h:223
Genfun::GaudiMathImplementation::SimpleFunction::ArrayArg
Definition: FunAdapters.h:223
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:277
std::unique_ptr::get
T get(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:276

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

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

Derivatives.

Definition at line 220 of file Adapter.cpp.

221 {
222 if ( i >= m_DIM )
223 {
224 const AbsFunction& aux = GaudiMath::Constant( 0 , m_DIM ) ;
225 return Genfun::FunctionNoop( &aux ) ;
226 }
227 const AbsFunction& aux = GaudiMath::Derivative( *this , i ) ;
228 return Genfun::FunctionNoop( &aux );
229 }
GaudiMath::Derivative
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:29
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:277
GaudiMath::Constant
Genfun::GaudiMathImplementation::Constant Constant
Definition: GaudiMath.h:27

## Member Data Documentation

std::unique_ptr<double[]> Genfun::GaudiMathImplementation::SimpleFunction::m_arg2
| private

Definition at line 282 of file FunAdapters.h.

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

Definition at line 285 of file FunAdapters.h.

Case Genfun::GaudiMathImplementation::SimpleFunction::m_case
| private

Definition at line 276 of file FunAdapters.h.

size_t Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
| private

Definition at line 277 of file FunAdapters.h.

Function1 Genfun::GaudiMathImplementation::SimpleFunction::m_func1
| private

Definition at line 279 of file FunAdapters.h.

Function2 Genfun::GaudiMathImplementation::SimpleFunction::m_func2
| private

Definition at line 281 of file FunAdapters.h.

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

Definition at line 284 of file FunAdapters.h.

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

- GaudiGSL/GaudiMath/FunAdapters.h
- GaudiGSL/src/Lib/Adapter.cpp