GeoModel - GeoModelCore
FunctionNegation.cpp
1 //==========================================================================//
2 // Imported from the QAT library (qat.pitt.edu) by the copyright holder //
3 // Joe Boudreau. Software licensed under the terms and conditions of the //
4 // GNU Lesser Public License v3. //
5 //==========================================================================//
6 
7 #include "GeoGenericFunctions/FunctionNegation.h"
8 
9 namespace GeoGenfun {
10 FUNCTION_OBJECT_IMP(FunctionNegation)
11 
12 FunctionNegation::FunctionNegation(const AbsFunction *arg1):
13  _arg1(arg1->clone())
14 {
15 }
16 
17 FunctionNegation::FunctionNegation(const FunctionNegation & right):
18  AbsFunction(right),
19  _arg1(right._arg1->clone())
20 {
21 }
22 
23 
24 FunctionNegation::~FunctionNegation()
25 {
26  delete _arg1;
27 }
28 
29 unsigned int FunctionNegation::dimensionality() const {
30  return _arg1->dimensionality();
31 }
32 
33 
34 double FunctionNegation::operator ()(double x) const
35 {
36  return -((*_arg1)(x));
37 }
38 
39 double FunctionNegation::operator ()(const Argument & x) const
40 {
41  return -((*_arg1)(x));
42 }
43 
44 
45 Derivative FunctionNegation::partial(unsigned int index) const {
46  const Derivative & d = _arg1->partial(index);
47  const AbsFunction & fPrime = -d;
48  return Derivative(&fPrime);
49 }
50 
51 
52 } // namespace GeoGenfun
Definition: Abs.h:15