CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // -*- C++ -*- 00002 // $Id: Square.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ 00003 #include "CLHEP/GenericFunctions/Square.hh" 00004 #include "CLHEP/GenericFunctions/Variable.hh" 00005 #include <assert.h> 00006 00007 namespace Genfun { 00008 FUNCTION_OBJECT_IMP(Square) 00009 00010 Square::Square() 00011 {} 00012 00013 Square::Square(const Square & right) 00014 { 00015 } 00016 00017 Square::~Square() { 00018 } 00019 00020 double Square::operator() (double x) const { 00021 return x*x; 00022 } 00023 00024 00025 00026 Derivative Square::partial(unsigned int index) const { 00027 assert(index==0); 00028 Variable x; 00029 const AbsFunction & fPrime = 2*x; 00030 return Derivative(&fPrime); 00031 } 00032 00033 00034 } // namespace Genfun