File indexing completed on 2026-06-02 08:48:21
0001 #ifndef FUNCTOR_MD
0002 #define FUNCTOR_MD
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <vector>
0012
0013 #include "../../linear_algebra/vector/VectorD.h"
0014 #include "FunctionTypeMD.h"
0015
0016 namespace NumA {
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 template<typename PointerToObj, typename PointerToFunc>
0028 class FunctorMD: public FunctionTypeMD {
0029 public:
0030
0031
0032
0033
0034
0035 FunctorMD(PointerToObj* object, PointerToFunc function) :
0036 m_pObject(object), m_pFunction(function) {
0037 }
0038
0039
0040
0041
0042 virtual ~FunctorMD() {
0043 }
0044
0045 inline double operator()(VectorD &variables,
0046 std::vector<double> ¶meters) {
0047 return ((*m_pObject).*m_pFunction)(variables, parameters);
0048 }
0049 inline double operator()(VectorD &variables) {
0050 std::vector<double> parameters;
0051 return ((*m_pObject).*m_pFunction)(variables, parameters);
0052 }
0053
0054 private:
0055 PointerToObj* m_pObject;
0056 PointerToFunc m_pFunction;
0057
0058 FunctorMD(const FunctorMD&);
0059 FunctorMD& operator=(const FunctorMD&);
0060 };
0061
0062 }
0063
0064 #endif