GeoModel - GeoModelCore
ACos.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 #include "GeoGenericFunctions/ACos.h"
7 #include "GeoGenericFunctions/Sqrt.h"
8 #include "GeoGenericFunctions/Square.h"
9 #include <cmath>
10 #include <stdexcept>
11 
12 namespace GeoGenfun {
13 FUNCTION_OBJECT_IMP(ACos)
14 
15 ACos::ACos()
16 {}
17 
18 ACos::~ACos() {
19 }
20 
21 ACos::ACos(const ACos & right) : AbsFunction(right)
22 { }
23 
24 
25 double ACos::operator() (double x) const {
26  return acos(x);
27 }
28 
29 
30 Derivative ACos::partial(unsigned int index) const {
31  if (index!=0) throw std::range_error("ACos: partial derivative index out of range");
32 
33  Square square;
34  Sqrt root;
35 
36  const AbsFunction & fPrime = - 1.0/root(1.0-square) ;
37  return Derivative(& fPrime);
38 }
39 
40 } // end namespace GeoGenfun
41 
42 
Definition: Abs.h:15