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