CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
Square.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id: Square.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
3
#include "
CLHEP/GenericFunctions/Square.hh
"
4
#include "
CLHEP/GenericFunctions/Variable.hh
"
5
#include <assert.h>
6
7
namespace
Genfun {
8
FUNCTION_OBJECT_IMP
(Square)
9
10
Square
::
Square
()
11
{}
12
13
Square::Square
(
const
Square
& right) :
AbsFunction
(right)
14
{
15
}
16
17
Square::~Square
() {
18
}
19
20
double
Square::operator()
(
double
x)
const
{
21
return
x*x;
22
}
23
24
25
26
Derivative
Square::partial
(
unsigned
int
index)
const
{
27
assert(index==0);
28
Variable
x;
29
const
AbsFunction
& fPrime = 2*x;
30
return
Derivative
(&fPrime);
31
}
32
33
34
}
// namespace Genfun
Generated on Mon May 6 2013 04:04:11 for CLHEP by
1.8.1.2