Commit 51960a581dc1ba7463cc77ecb301dd30049de02a
1 parent
39dadac1
initial version
Showing
1 changed file
with
64 additions
and
0 deletions
include/GDerivative.hpp
0 → 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GDerivative.hpp - Derivative class * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright (C) 2011 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + ***************************************************************************/ | |
| 13 | +/** | |
| 14 | + * @file GDerivative.hpp | |
| 15 | + * @brief GDerivative class interface definition. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#ifndef GDERIVATIVE_HPP | |
| 20 | +#define GDERIVATIVE_HPP | |
| 21 | + | |
| 22 | +/* __ Includes ___________________________________________________________ */ | |
| 23 | +#include "GFunction.hpp" | |
| 24 | + | |
| 25 | + | |
| 26 | +/***********************************************************************//** | |
| 27 | + * @class GDerivative | |
| 28 | + * | |
| 29 | + * @brief Numerical derivatives class interface defintion | |
| 30 | + * | |
| 31 | + * This class allows to compute numerical derivatives using various methods. | |
| 32 | + * The function to be derived is implemented by the abstract GFunction | |
| 33 | + * class. | |
| 34 | + ***************************************************************************/ | |
| 35 | +class GDerivative { | |
| 36 | + | |
| 37 | +public: | |
| 38 | + | |
| 39 | + // Constructors and destructors | |
| 40 | + GDerivative(void); | |
| 41 | + explicit GDerivative(GFunction* func); | |
| 42 | + GDerivative(const GDerivative& dx); | |
| 43 | + virtual ~GDerivative(void); | |
| 44 | + | |
| 45 | + // Operators | |
| 46 | + GDerivative& operator= (const GDerivative& dx); | |
| 47 | + | |
| 48 | + // Methods | |
| 49 | + void function(GFunction* func) { m_func = func; } | |
| 50 | + const GFunction* function(void) const { return m_func; } | |
| 51 | + double value(const double& x); | |
| 52 | + double ridder(const double& x, const double& h, double& err); | |
| 53 | + | |
| 54 | +protected: | |
| 55 | + // Protected methods | |
| 56 | + void init_members(void); | |
| 57 | + void copy_members(const GDerivative& dx); | |
| 58 | + void free_members(void); | |
| 59 | + | |
| 60 | + // Protected data area | |
| 61 | + GFunction* m_func; //!< Pointer to function | |
| 62 | +}; | |
| 63 | + | |
| 64 | +#endif /* GDERIVATIVE_HPP */ | ... | ... |