CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: FunctionNegation.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ 00003 #include "CLHEP/GenericFunctions/FunctionNegation.hh" 00004 00005 namespace Genfun { 00006 FUNCTION_OBJECT_IMP(FunctionNegation) 00007 00008 FunctionNegation::FunctionNegation(const AbsFunction *arg1): 00009 _arg1(arg1->clone()) 00010 { 00011 } 00012 00013 FunctionNegation::FunctionNegation(const FunctionNegation & right): 00014 _arg1(right._arg1->clone()) 00015 { 00016 } 00017 00018 00019 FunctionNegation::~FunctionNegation() 00020 { 00021 delete _arg1; 00022 } 00023 00024 unsigned int FunctionNegation::dimensionality() const { 00025 return _arg1->dimensionality(); 00026 } 00027 00028 00029 double FunctionNegation::operator ()(double x) const 00030 { 00031 return -((*_arg1)(x)); 00032 } 00033 00034 double FunctionNegation::operator ()(const Argument & x) const 00035 { 00036 return -((*_arg1)(x)); 00037 } 00038 00039 00040 Derivative FunctionNegation::partial(unsigned int index) const { 00041 const AbsFunction & fPrime = -(_arg1->partial(index)); 00042 return Derivative(&fPrime); 00043 } 00044 00045 00046 } // namespace Genfun