| The Gaudi Framework v27r1

- 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

`#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...
virtual | ~SimpleFunction ()=default
virtual unsigned int | dimensionality () const
| dimensionality of the problem More...
virtual bool | hasAnalyticDerivative () const
| Does this function have an analytic derivative? More...
virtual double | operator() (double) const
| Function value. More...
virtual double | operator() (const Argument &) const
| Function value. More...
virtual Genfun::Derivative | partial (unsigned int i) const
| 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

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.

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

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

156 : AbsFunction ()
157 , m_case ( SimpleFunction::TrivialArg )
158 , m_DIM ( 1 )
159 , m_func1 ( func )
160 , m_func2 ( nullptr )
161 , m_func3 ( nullptr )
162 {}
Genfun::GaudiMathImplementation::SimpleFunction::m_func3
Function3 m_func3
Definition: FunAdapters.h:270
Genfun::GaudiMathImplementation::SimpleFunction::m_func2
Function2 m_func2
Definition: FunAdapters.h:267
Genfun::GaudiMathImplementation::SimpleFunction::TrivialArg
Definition: FunAdapters.h:209
GaudiPluginService.cpluginsvc.func
tuple func
Definition: cpluginsvc.py:218
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:263
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:262
Genfun::GaudiMathImplementation::SimpleFunction::m_func1
Function1 m_func1
Definition: FunAdapters.h:265

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

174 : AbsFunction ()
175 , m_case ( SimpleFunction::ArrayArg )
176 , m_DIM ( dim )
177 , m_func1 ( nullptr )
178 , m_func2 ( func )
179 , m_arg2 ( new double[dim] )
180 , m_func3 ( nullptr )
181 {
182 }
Genfun::GaudiMathImplementation::SimpleFunction::m_func3
Function3 m_func3
Definition: FunAdapters.h:270
Genfun::GaudiMathImplementation::SimpleFunction::m_arg2
std::unique_ptr< double[]> m_arg2
Definition: FunAdapters.h:268
Genfun::GaudiMathImplementation::SimpleFunction::m_func2
Function2 m_func2
Definition: FunAdapters.h:267
GaudiPluginService.cpluginsvc.func
tuple func
Definition: cpluginsvc.py:218
Genfun::GaudiMathImplementation::SimpleFunction::ArrayArg
Definition: FunAdapters.h:209
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:263
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:262
Genfun::GaudiMathImplementation::SimpleFunction::m_func1
Function1 m_func1
Definition: FunAdapters.h:265

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

194 : AbsFunction ()
195 , m_case ( SimpleFunction::VectorArg )
196 , m_DIM ( dim )
197 , m_func1 ( nullptr )
198 , m_func2 ( nullptr )
199 , m_func3 ( func )
200 , m_arg3 ( dim , 0 )
201 {}
Genfun::GaudiMathImplementation::SimpleFunction::m_func3
Function3 m_func3
Definition: FunAdapters.h:270
Genfun::GaudiMathImplementation::SimpleFunction::m_func2
Function2 m_func2
Definition: FunAdapters.h:267
Genfun::GaudiMathImplementation::SimpleFunction::m_arg3
std::vector< double > m_arg3
Definition: FunAdapters.h:271
Genfun::GaudiMathImplementation::SimpleFunction::VectorArg
Definition: FunAdapters.h:209
GaudiPluginService.cpluginsvc.func
tuple func
Definition: cpluginsvc.py:218
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:263
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:262
Genfun::GaudiMathImplementation::SimpleFunction::m_func1
Function1 m_func1
Definition: FunAdapters.h:265

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

copy constructor

Definition at line 208 of file Adapter.cpp.

209 : AbsFunction ()
210 , m_case ( right.m_case )
211 , m_DIM ( right.m_DIM )
212 , m_func1 ( right.m_func1 )
213 , m_func2 ( right.m_func2 )
214 , m_func3 ( right.m_func3 )
215 , m_arg3 ( right.m_arg3 )
216 {
217 if ( right.m_arg2 )
218 {
219 m_arg2.reset( new double[m_DIM] );
220 std::copy_n(right.m_arg2.get(), m_DIM, m_arg2.get());
221 }
222 }
Genfun::GaudiMathImplementation::SimpleFunction::m_func3
Function3 m_func3
Definition: FunAdapters.h:270
std::right
T right(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_arg2
std::unique_ptr< double[]> m_arg2
Definition: FunAdapters.h:268
std::copy_n
T copy_n(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_func2
Function2 m_func2
Definition: FunAdapters.h:267
Genfun::GaudiMathImplementation::SimpleFunction::m_arg3
std::vector< double > m_arg3
Definition: FunAdapters.h:271
std::unique_ptr::reset
T reset(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:263
std::unique_ptr::get
T get(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:262
Genfun::GaudiMathImplementation::SimpleFunction::m_func1
Function1 m_func1
Definition: FunAdapters.h:265

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

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.

243 { return m_DIM ; }
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:263

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

Does this function have an analytic derivative?

Definition at line 245 of file FunAdapters.h.

245 { return true ; }

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

Function value.

Definition at line 244 of file Adapter.cpp.

245 {
246 double result = 0 ;
247 switch ( m_case )
248 {
249 case TrivialArg :
250 result = (*m_func1) ( value ) ; break ;
251 case ArrayArg :
252 std::fill_n( m_arg2.get() , m_DIM , 0.0 );
253 m_arg2[0] = value ;
254 result = (*m_func2) ( m_arg2.get() ) ; break ;
255 case VectorArg :
256 std::fill ( m_arg3.begin () , m_arg3.end () , 0.0 );
257 m_arg3[0] = value ;
258 result = (*m_func3) ( m_arg3 ) ; break ;
259 default:
260 break ;
261 };
262 return result ;
263 }
Genfun::GaudiMathImplementation::SimpleFunction::m_arg2
std::unique_ptr< double[]> m_arg2
Definition: FunAdapters.h:268
std::vector::end
T end(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::TrivialArg
Definition: FunAdapters.h:209
Genfun::GaudiMathImplementation::SimpleFunction::m_arg3
std::vector< double > m_arg3
Definition: FunAdapters.h:271
Genfun::GaudiMathImplementation::SimpleFunction::VectorArg
Definition: FunAdapters.h:209
dump_component_properties.value
list value
Definition: dump_component_properties.py:12
Genfun::GaudiMathImplementation::SimpleFunction::ArrayArg
Definition: FunAdapters.h:209
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:263
std::unique_ptr::get
T get(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:262
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
| virtual

Function value.

Definition at line 269 of file Adapter.cpp.

270 {
271 double result = 0 ;
272 switch ( m_case )
273 {
274 case TrivialArg :
275 result = (*m_func1) ( argument[0] ) ; break ;
276 case ArrayArg :
277 for( size_t i = 0 ; i < m_DIM ; ++i ) { m_arg2[i] = argument[i] ; }
278 return (*m_func2)( m_arg2.get() ) ; ; break ;
279 case VectorArg :
280 for( size_t i = 0 ; i < m_DIM ; ++i ) { m_arg3[i] = argument[i] ; }
281 result = (*m_func3) ( m_arg3 ) ; break ;
282 default:
283 break ;
284 }
285 return result ;
286 }
Genfun::GaudiMathImplementation::SimpleFunction::m_arg2
std::unique_ptr< double[]> m_arg2
Definition: FunAdapters.h:268
Genfun::GaudiMathImplementation::SimpleFunction::m_func2
Function2 m_func2
Definition: FunAdapters.h:267
Genfun::GaudiMathImplementation::SimpleFunction::TrivialArg
Definition: FunAdapters.h:209
Genfun::GaudiMathImplementation::SimpleFunction::m_arg3
std::vector< double > m_arg3
Definition: FunAdapters.h:271
Genfun::GaudiMathImplementation::SimpleFunction::VectorArg
Definition: FunAdapters.h:209
Genfun::GaudiMathImplementation::SimpleFunction::ArrayArg
Definition: FunAdapters.h:209
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:263
std::unique_ptr::get
T get(T...args)
Genfun::GaudiMathImplementation::SimpleFunction::m_case
Case m_case
Definition: FunAdapters.h:262
ana.i
list i
Definition: ana.py:128

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

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

Derivatives.

Definition at line 230 of file Adapter.cpp.

231 {
232 if ( i >= m_DIM )
233 {
234 const AbsFunction& aux = GaudiMath::Constant( 0 , m_DIM ) ;
235 return Genfun::FunctionNoop( &aux ) ;
236 }
237 const AbsFunction& aux = GaudiMath::Derivative( *this , i ) ;
238 return Genfun::FunctionNoop( &aux );
239 }
GaudiMath::Derivative
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:29
Genfun::GaudiMathImplementation::SimpleFunction::m_DIM
size_t m_DIM
Definition: FunAdapters.h:263
ana.i
list i
Definition: ana.py:128
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 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:

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