CLHEP VERSION 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 AbsFunction(right), 00015 _arg1(right._arg1->clone()) 00016 { 00017 } 00018 00019 00020 FunctionNegation::~FunctionNegation() 00021 { 00022 delete _arg1; 00023 } 00024 00025 unsigned int FunctionNegation::dimensionality() const { 00026 return _arg1->dimensionality(); 00027 } 00028 00029 00030 double FunctionNegation::operator ()(double x) const 00031 { 00032 return -((*_arg1)(x)); 00033 } 00034 00035 double FunctionNegation::operator ()(const Argument & x) const 00036 { 00037 return -((*_arg1)(x)); 00038 } 00039 00040 00041 Derivative FunctionNegation::partial(unsigned int index) const { 00042 const AbsFunction & fPrime = -(_arg1->partial(index)); 00043 return Derivative(&fPrime); 00044 } 00045 00046 00047 } // namespace Genfun