Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JMATH::JCos< JF1_t > Struct Template Reference

Cosine of function. More...

#include <JMathlib.hh>

Inheritance diagram for JMATH::JCos< JF1_t >:
JMATH::JMathlib< JCos< JF1_t > >

Public Member Functions

 JCos ()
 Default constructor.
 
 JCos (const JF1_t &f1)
 Constructor.
 
double getValue (const double x) const
 Function value.
 
double getDerivative (const double x) const
 Derivative value.
 
const JCosgetGradient (const double x) const
 Get gradient.
 
double operator() (const Args &...args) const
 Function value.
 

Detailed Description

template<class JF1_t>
struct JMATH::JCos< JF1_t >

Cosine of function.

Definition at line 2312 of file JMathlib.hh.

Constructor & Destructor Documentation

◆ JCos() [1/2]

template<class JF1_t >
JMATH::JCos< JF1_t >::JCos ( )
inline

Default constructor.

Definition at line 2322 of file JMathlib.hh.

2322 :
2323 JF1_t()
2324 {}

◆ JCos() [2/2]

template<class JF1_t >
JMATH::JCos< JF1_t >::JCos ( const JF1_t & f1)
inline

Constructor.

Parameters
f1function

Definition at line 2332 of file JMathlib.hh.

2332 :
2333 JF1_t(f1)
2334 {}

Member Function Documentation

◆ getValue()

template<class JF1_t >
double JMATH::JCos< JF1_t >::getValue ( const double x) const
inline

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 2343 of file JMathlib.hh.

2344 {
2345 const double u = static_cast<const JF1_t&>(*this).getValue(x);
2346
2347 return cos(u);
2348 }

◆ getDerivative()

template<class JF1_t >
double JMATH::JCos< JF1_t >::getDerivative ( const double x) const
inline

Derivative value.

Parameters
xabscissa value
Returns
derivative value

Definition at line 2357 of file JMathlib.hh.

2358 {
2359 const double u = static_cast<const JF1_t&>(*this).getValue(x);
2360 const double v = static_cast<const JF1_t&>(*this).getDerivative(x);
2361
2362 return v * -sin(u);
2363 }

◆ getGradient()

template<class JF1_t >
const JCos & JMATH::JCos< JF1_t >::getGradient ( const double x) const
inline

Get gradient.

Parameters
xabscissa value
Returns
gradient

Definition at line 2372 of file JMathlib.hh.

2373 {
2374 static JCos gradient; // d(f)/d(a)
2375
2376 const double u = static_cast<const JF1_t&>(*this).getValue(x);
2377
2378 static_cast<JF1_t&>(gradient) = static_cast<const JF1_t&>(*this).getGradient(x);
2379 static_cast<JF1_t&>(gradient) *= -sin(u);
2380
2381 return gradient;
2382 }
JCos()
Default constructor.
Definition JMathlib.hh:2322

◆ operator()()

double JMATH::JMathlib< JF1_t >::operator() ( const Args &... args) const
inlineinherited

Function value.

Parameters
argsabscissa value(s)
Returns
function value

Definition at line 362 of file JMathlib.hh.

363 {
364 return static_cast<const JF1_t&>(*this).getValue(args...);
365 }

The documentation for this struct was generated from the following file: