Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JMATH::JCalculus< JF1_t > Struct Template Reference

Auxiliary base class for mathematical operations on parameters of function. More...

#include <JMathlib.hh>

Public Member Functions

JF1_t & negate ()
 Negate function.
 
JF1_t & add (const JF1_t &f1)
 Add function.
 
JF1_t & sub (const JF1_t &f1)
 Subtract function.
 
JF1_t & mul (const double factor)
 Scale function.
 
JF1_t & div (const double factor)
 Scale function.
 

Friends

JF1_t & operator+= (JF1_t &function, const JF1_t &value)
 Add function.
 
JF1_t & operator-= (JF1_t &function, const JF1_t &value)
 Subtract function.
 
JF1_t & operator*= (JF1_t &function, const double factor)
 Scale function.
 
JF1_t & operator/= (JF1_t &function, const double factor)
 Scale function.
 

Detailed Description

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

Auxiliary base class for mathematical operations on parameters of function.

Definition at line 163 of file JMathlib.hh.

Member Function Documentation

◆ negate()

template<class JF1_t >
JF1_t & JMATH::JCalculus< JF1_t >::negate ( )
inline

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()

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

Add function.

Parameters
f1function
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()

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

Subtract function.

Parameters
f1function
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()

template<class JF1_t >
JF1_t & JMATH::JCalculus< JF1_t >::mul ( const double factor)
inline

Scale function.

Parameters
factorfactor
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()

template<class JF1_t >
JF1_t & JMATH::JCalculus< JF1_t >::div ( const double factor)
inline

Scale function.

Parameters
factorfactor
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 }

Friends And Related Symbol Documentation

◆ operator+=

template<class JF1_t >
JF1_t & operator+= ( JF1_t & function,
const JF1_t & value )
friend

Add function.

Parameters
functionthis function
valuevalue
Returns
this function

Definition at line 251 of file JMathlib.hh.

252 {
253 return function.add(value);
254 }

◆ operator-=

template<class JF1_t >
JF1_t & operator-= ( JF1_t & function,
const JF1_t & value )
friend

Subtract function.

Parameters
functionthis function
valuevalue
Returns
this function

Definition at line 264 of file JMathlib.hh.

265 {
266 return function.sub(value);
267 }

◆ operator*=

template<class JF1_t >
JF1_t & operator*= ( JF1_t & function,
const double factor )
friend

Scale function.

Parameters
functionthis function
factorfactor
Returns
this function

Definition at line 277 of file JMathlib.hh.

278 {
279 return function.mul(factor);
280 }

◆ operator/=

template<class JF1_t >
JF1_t & operator/= ( JF1_t & function,
const double factor )
friend

Scale function.

Parameters
functionthis function
factorfactor
Returns
this function

Definition at line 290 of file JMathlib.hh.

291 {
292 return function.div(factor);
293 }

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