Square root of function.
More...
#include <JMathlib.hh>
|
| | JSqrt () |
| | Default constructor.
|
| |
| | JSqrt (const JF1_t &f1) |
| | Constructor.
|
| |
| double | getValue (const double x) const |
| | Function value.
|
| |
| double | getDerivative (const double x) const |
| | Derivative value.
|
| |
| JSqrt | 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.
|
| |
template<class JF1_t = JX>
struct JMATH::JSqrt< JF1_t >
Square root of function.
Definition at line 2258 of file JMathlib.hh.
◆ JSqrt() [1/2]
template<class JF1_t = JX>
Default constructor.
Definition at line 2269 of file JMathlib.hh.
2269 :
2270 JF1_t()
2271 {}
◆ JSqrt() [2/2]
template<class JF1_t = JX>
Constructor.
- Parameters
-
Definition at line 2279 of file JMathlib.hh.
2279 :
2280 JF1_t(f1)
2281 {}
◆ getValue()
template<class JF1_t = JX>
| double JMATH::JSqrt< JF1_t >::getValue |
( |
const double | x | ) |
const |
|
inline |
Function value.
- Parameters
-
- Returns
- function value
Definition at line 2290 of file JMathlib.hh.
2291 {
2292 const double u = static_cast<const JF1_t&>(*this).getValue(x);
2293
2294 return sqrt(u);
2295 }
◆ getDerivative()
template<class JF1_t = JX>
| double JMATH::JSqrt< JF1_t >::getDerivative |
( |
const double | x | ) |
const |
|
inline |
Derivative value.
- Parameters
-
- Returns
- derivative value
Definition at line 2304 of file JMathlib.hh.
2305 {
2306 const double u = static_cast<const JF1_t&>(*this).getValue(x);
2307 const double v = static_cast<const JF1_t&>(*this).getDerivative(x);
2308
2309 return 0.5 * v / sqrt(u);
2310 }
◆ getGradient()
template<class JF1_t = JX>
Get gradient.
- Parameters
-
- Returns
- gradient
Definition at line 2319 of file JMathlib.hh.
2320 {
2322
2323 const double u = static_cast<const JF1_t&>(*this).getValue(x);
2324
2325 static_cast<JF1_t&>(gradient) = static_cast<const JF1_t&>(*this).getGradient(x);
2326 static_cast<JF1_t&>(gradient) *= 0.5 / sqrt(u);
2327
2328 return gradient;
2329 }
JSqrt()
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 }
◆ operator[]() [1/4]
Get value of parameter at given index.
- Parameters
-
- Returns
- value
Definition at line 539 of file JMathlib.hh.
540 {
541 return static_cast<const JF1_t&>(*this).*JF1_t::parameters[i];
542 }
◆ operator[]() [2/4]
Get value of parameter at given index.
- Parameters
-
- Returns
- value
Definition at line 551 of file JMathlib.hh.
552 {
553 return static_cast<JF1_t&>(*this).*JF1_t::parameters[i];
554 }
◆ 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 }
◆ operator[]() [3/4]
Get value of parameter at given index.
- Parameters
-
- Returns
- value
Definition at line 539 of file JMathlib.hh.
540 {
541 return static_cast<const JF1_t&>(*this).*JF1_t::parameters[i];
542 }
◆ operator[]() [4/4]
Get value of parameter at given index.
- Parameters
-
- Returns
- value
Definition at line 551 of file JMathlib.hh.
552 {
553 return static_cast<JF1_t&>(*this).*JF1_t::parameters[i];
554 }
◆ negate()
Negate function.
- Returns
- this function
Definition at line 169 of file JMathlib.hh.
170 {
171 for (const auto& i : JF1_t::parameters) {
172 static_cast<JF1_t&>(*this).*i = -(static_cast<JF1_t&>(*this).*i);
173 }
174
175 return static_cast<JF1_t&>(*this);
176 }
◆ add()
Add function.
- Parameters
-
- Returns
- this function
Definition at line 185 of file JMathlib.hh.
186 {
187 for (const auto& i : JF1_t::parameters) {
188 static_cast<JF1_t&>(*this).*i += f1.*i;
189 }
190
191 return static_cast<JF1_t&>(*this);
192 }
◆ sub()
Subtract function.
- Parameters
-
- Returns
- this function
Definition at line 201 of file JMathlib.hh.
202 {
203 for (const auto& i : JF1_t::parameters) {
204 static_cast<JF1_t&>(*this).*i -= f1.*i;
205 }
206
207 return static_cast<JF1_t&>(*this);
208 }
◆ mul()
Scale function.
- Parameters
-
- Returns
- this function
Definition at line 217 of file JMathlib.hh.
218 {
219 for (const auto& i : JF1_t::parameters) {
220 static_cast<JF1_t&>(*this).*i *= factor;
221 }
222
223 return static_cast<JF1_t&>(*this);
224 }
◆ div()
Scale function.
- Parameters
-
- Returns
- this function
Definition at line 233 of file JMathlib.hh.
234 {
235 for (const auto& i : JF1_t::parameters) {
236 static_cast<JF1_t&>(*this).*i /= factor;
237 }
238
239 return static_cast<JF1_t&>(*this);
240 }
◆ parameters
The documentation for this struct was generated from the following file: