Cosine of function.
More...
#include <JMathlib.hh>
|
| | 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.
|
| |
| JCos | getGradient (const double x) const |
| | Get gradient.
|
| |
| double | operator() (const Args &...args) const |
| | Function value.
|
| |
| double | operator[] (const size_t i) const |
| | Get value of parameter at given index.
|
| |
| double & | operator[] (const size_t i) |
| | Get value of parameter at given index.
|
| |
| double | operator() (const Args &...args) const |
| | Function value.
|
| |
| double | operator[] (const size_t i) const |
| | Get value of parameter at given index.
|
| |
| double & | operator[] (const size_t i) |
| | Get value of parameter at given index.
|
| |
| JX & | negate () |
| | Negate function.
|
| |
| JX & | add (const JX &f1) |
| | Add function.
|
| |
| JX & | sub (const JX &f1) |
| | Subtract function.
|
| |
| JX & | mul (const double factor) |
| | Scale function.
|
| |
| JX & | div (const double factor) |
| | Scale function.
|
| |
|
| static size_t | size () |
| | Get size of parameter.
|
| |
| static size_t | size () |
| | Get size of parameter.
|
| |
template<class JF1_t = JX>
struct JMATH::JCos< JF1_t >
Cosine of function.
Definition at line 2501 of file JMathlib.hh.
◆ JCos() [1/2]
template<class JF1_t = JX>
Default constructor.
Definition at line 2512 of file JMathlib.hh.
2512 :
2513 JF1_t()
2514 {}
◆ JCos() [2/2]
template<class JF1_t = JX>
Constructor.
- Parameters
-
Definition at line 2522 of file JMathlib.hh.
2522 :
2523 JF1_t(f1)
2524 {}
◆ getValue()
template<class JF1_t = JX>
| double JMATH::JCos< JF1_t >::getValue |
( |
const double | x | ) |
const |
|
inline |
Function value.
- Parameters
-
- Returns
- function value
Definition at line 2533 of file JMathlib.hh.
2534 {
2535 const double u = static_cast<const JF1_t&>(*this).getValue(x);
2536
2537 return cos(u);
2538 }
◆ getDerivative()
template<class JF1_t = JX>
| double JMATH::JCos< JF1_t >::getDerivative |
( |
const double | x | ) |
const |
|
inline |
Derivative value.
- Parameters
-
- Returns
- derivative value
Definition at line 2547 of file JMathlib.hh.
2548 {
2549 const double u = static_cast<const JF1_t&>(*this).getValue(x);
2550 const double v = static_cast<const JF1_t&>(*this).getDerivative(x);
2551
2552 return v * -sin(u);
2553 }
◆ getGradient()
template<class JF1_t = JX>
Get gradient.
- Parameters
-
- Returns
- gradient
Definition at line 2562 of file JMathlib.hh.
2563 {
2565
2566 const double u = static_cast<const JF1_t&>(*this).getValue(x);
2567
2568 static_cast<JF1_t&>(gradient) = static_cast<const JF1_t&>(*this).getGradient(x);
2569 static_cast<JF1_t&>(gradient) *= -sin(u);
2570
2571 return gradient;
2572 }
JCos()
Default constructor.
◆ operator()() [1/2]
Function value.
- Parameters
-
- Returns
- function value
Definition at line 331 of file JMathlib.hh.
332 {
333 return static_cast<const JF1_t&
>(*this).getValue(
args...);
334 }
◆ size() [1/2]
Get size of parameter.
- Returns
- size
Definition at line 538 of file JMathlib.hh.
539 {
540 return JF1_t::parameters.size();
541 }
◆ operator[]() [1/4]
Get value of parameter at given index.
- Parameters
-
- Returns
- value
Definition at line 550 of file JMathlib.hh.
551 {
552 return static_cast<const JF1_t&>(*this).*JF1_t::parameters[i];
553 }
◆ operator[]() [2/4]
Get value of parameter at given index.
- Parameters
-
- Returns
- value
Definition at line 562 of file JMathlib.hh.
563 {
564 return static_cast<JF1_t&>(*this).*JF1_t::parameters[i];
565 }
◆ operator()() [2/2]
Function value.
- Parameters
-
- Returns
- function value
Definition at line 331 of file JMathlib.hh.
332 {
333 return static_cast<const JF1_t&
>(*this).getValue(
args...);
334 }
◆ size() [2/2]
Get size of parameter.
- Returns
- size
Definition at line 538 of file JMathlib.hh.
539 {
540 return JF1_t::parameters.size();
541 }
◆ operator[]() [3/4]
Get value of parameter at given index.
- Parameters
-
- Returns
- value
Definition at line 550 of file JMathlib.hh.
551 {
552 return static_cast<const JF1_t&>(*this).*JF1_t::parameters[i];
553 }
◆ operator[]() [4/4]
Get value of parameter at given index.
- Parameters
-
- Returns
- value
Definition at line 562 of file JMathlib.hh.
563 {
564 return static_cast<JF1_t&>(*this).*JF1_t::parameters[i];
565 }
◆ negate()
Negate function.
- Returns
- this function
Definition at line 170 of file JMathlib.hh.
171 {
172 for (const auto& i : JF1_t::parameters) {
173 static_cast<JF1_t&>(*this).*i = -(static_cast<JF1_t&>(*this).*i);
174 }
175
176 return static_cast<JF1_t&>(*this);
177 }
◆ add()
Add function.
- Parameters
-
- Returns
- this function
Definition at line 186 of file JMathlib.hh.
187 {
188 for (const auto& i : JF1_t::parameters) {
189 static_cast<JF1_t&>(*this).*i += f1.*i;
190 }
191
192 return static_cast<JF1_t&>(*this);
193 }
◆ sub()
Subtract function.
- Parameters
-
- Returns
- this function
Definition at line 202 of file JMathlib.hh.
203 {
204 for (const auto& i : JF1_t::parameters) {
205 static_cast<JF1_t&>(*this).*i -= f1.*i;
206 }
207
208 return static_cast<JF1_t&>(*this);
209 }
◆ mul()
Scale function.
- Parameters
-
- Returns
- this function
Definition at line 218 of file JMathlib.hh.
219 {
220 for (const auto& i : JF1_t::parameters) {
221 static_cast<JF1_t&>(*this).*i *= factor;
222 }
223
224 return static_cast<JF1_t&>(*this);
225 }
◆ div()
Scale function.
- Parameters
-
- Returns
- this function
Definition at line 234 of file JMathlib.hh.
235 {
236 for (const auto& i : JF1_t::parameters) {
237 static_cast<JF1_t&>(*this).*i /= factor;
238 }
239
240 return static_cast<JF1_t&>(*this);
241 }
◆ parameters
The documentation for this struct was generated from the following file: