| 6 |
|
* to calculate the gradient |
| 7 |
|
*/ |
| 8 |
|
|
| 9 |
< |
class ObjFunctor{ |
| 9 |
> |
class ObjFunctor1{ |
| 10 |
|
|
| 11 |
|
public: |
| 12 |
|
virtual double operator()(vector<double>&, vector<double>&)=0; |
| 18 |
|
//PtrFunctor class wraps a pointer which points to an objct function. |
| 19 |
|
// PtrFunctor can be invoked by |
| 20 |
|
// functor(vector<double>&, vector<double>&) |
| 21 |
< |
class PtrFunctor : ObjFunctor{ |
| 21 |
> |
class PtrFunctor1 : ObjFunctor1{ |
| 22 |
|
|
| 23 |
|
public: |
| 24 |
|
|
| 25 |
< |
PtrFunctor(double (*thePtrFunc)(vector<double>&, vector<double>&)){ |
| 25 |
> |
PtrFunctor1(double (*thePtrFunc)(vector<double>&, vector<double>&)){ |
| 26 |
|
ptrFunc = thePtrFunc; |
| 27 |
|
} |
| 28 |
|
|
| 37 |
|
//ClassMemObjFunctor class wraps a pointer pointing to a member function of a class |
| 38 |
|
// |
| 39 |
|
template<typename TClass> |
| 40 |
< |
class ClassMemObjFunctor : public ObjFunctor{ |
| 40 |
> |
class ClassMemObjFunctor1 : public ObjFunctor1{ |
| 41 |
|
public: |
| 42 |
< |
ClassMemObjFunctor(TClass* thePtrClass, double (TClass::*thePtrFunc)(vector<double>&, vector<double>&)){ |
| 42 |
> |
ClassMemObjFunctor1(TClass* thePtrClass, double (TClass::*thePtrFunc)(vector<double>&, vector<double>&)){ |
| 43 |
|
ptrClass = thePtrClass; |
| 44 |
|
ptrFunc = thePtrFunc; |
| 45 |
|
} |