![]() |
|
|
Generated: 18 Jul 2008 |
#include <GaudiMath/Adapters.h>
Collaboration diagram for Genfun::GaudiMathImplementation::SimpleFunction:

Definition at line 202 of file FunAdapters.h.
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 |
| 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.
enum Genfun::GaudiMathImplementation::SimpleFunction::Case [protected] |
| Genfun::GaudiMathImplementation::SimpleFunction::SimpleFunction | ( | Function1 | func | ) |
constructor from the trivial function
| func | pointer to trivial function |
| Genfun::GaudiMathImplementation::SimpleFunction::SimpleFunction | ( | Function2 | func, | |
| const size_t | dim | |||
| ) |
constructor from the simple function with array-like argument
| 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
| func | pointer to trivial function | |
| dim | dimension of the argument |
| Genfun::GaudiMathImplementation::SimpleFunction::SimpleFunction | ( | const SimpleFunction & | ) |
copy constructor
Definition at line 213 of file Adapter.cpp.
References std::copy(), and m_arg2.
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] |
| Genfun::GaudiMathImplementation::SimpleFunction::SimpleFunction | ( | ) | [private] |
| 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.
References m_DIM.
00243 { return m_DIM ; }
| virtual bool Genfun::GaudiMathImplementation::SimpleFunction::hasAnalyticDerivative | ( | ) | const [inline, virtual] |
| double Genfun::GaudiMathImplementation::SimpleFunction::operator() | ( | double | ) | const [virtual] |
Function value.
Definition at line 255 of file Adapter.cpp.
References ArrayArg, std::vector< _Tp, _Alloc >::begin(), std::vector< _Tp, _Alloc >::end(), std::fill(), m_arg2, m_arg3, m_case, m_DIM, TrivialArg, and VectorArg.
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 & | ) | const [virtual] |
Function value.
Definition at line 280 of file Adapter.cpp.
References ArrayArg, m_arg2, m_arg3, m_case, m_DIM, m_func2, TrivialArg, and VectorArg.
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.
References m_DIM.
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] |
size_t Genfun::GaudiMathImplementation::SimpleFunction::m_DIM [private] |
Definition at line 263 of file FunAdapters.h.
Referenced by dimensionality(), operator()(), and partial().
Definition at line 265 of file FunAdapters.h.
double* Genfun::GaudiMathImplementation::SimpleFunction::m_arg2 [private] |
Definition at line 268 of file FunAdapters.h.
Referenced by operator()(), SimpleFunction(), and ~SimpleFunction().
Definition at line 270 of file FunAdapters.h.
std::vector<double> Genfun::GaudiMathImplementation::SimpleFunction::m_arg3 [mutable, private] |