Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JTOOLS::JResultPolynome< N, JResult_t > Struct Template Reference

Data structure for result including value and N derivatives of function. More...

#include <JResult.hh>

Inheritance diagram for JTOOLS::JResultPolynome< N, JResult_t >:
JMATH::JMath< JFirst_t, JSecond_t >

Public Types

typedef JLANG::JClass< JResult_t >::argument_type argument_type
 

Public Member Functions

 JResultPolynome ()
 Default constructor.
 
 operator JResultDerivative< JResult_t > () const
 Type conversion operator.
 
 operator JResultHesse< JResult_t > () const
 Type conversion operator.
 
JResultPolynomenegate ()
 Prefix unary minus for function value of PDF.
 
JResultPolynomeadd (const JResultPolynome &value)
 Addition operator for function value of PDF.
 
JResultPolynomesub (const JResultPolynome &value)
 Subtraction operator for function value of PDF.
 
JResultPolynomemul (const double value)
 Multiplication operator for function value of PDF.
 
JResultPolynomediv (const double value)
 Division operator for function value of PDF.
 
double getValue (const double x) const
 Function value.
 
double operator() (const double x) const
 Function value.
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object.
 

Public Attributes

JResult_t y [NUMBER_OF_POINTS]
 function and derivative values
 

Static Public Attributes

static const int NUMBER_OF_POINTS = N + 1
 

Detailed Description

template<unsigned int N, class JResult_t>
struct JTOOLS::JResultPolynome< N, JResult_t >

Data structure for result including value and N derivatives of function.

This data structure contains the following data mambers:

   JResultPolynome::y[0] = function value;
   JResultPolynome::y[i] = ith derivative; 
   JResultPolynome::y[N] = Nth derivative; 

This class implements the JMATH::JMath interface.

Definition at line 533 of file JResult.hh.

Member Typedef Documentation

◆ argument_type

template<unsigned int N, class JResult_t >
JLANG::JClass<JResult_t>::argument_type JTOOLS::JResultPolynome< N, JResult_t >::argument_type

Definition at line 537 of file JResult.hh.

Constructor & Destructor Documentation

◆ JResultPolynome()

template<unsigned int N, class JResult_t >
JTOOLS::JResultPolynome< N, JResult_t >::JResultPolynome ( )
inline

Default constructor.

Definition at line 545 of file JResult.hh.

546 {
547 for (int i = 0; i != NUMBER_OF_POINTS; ++i) {
548 y[i] = JMATH::zero;
549 }
550 }
static const JZero zero
Function object to assign zero value.
Definition JZero.hh:105
JResult_t y[NUMBER_OF_POINTS]
function and derivative values
Definition JResult.hh:687
static const int NUMBER_OF_POINTS
Definition JResult.hh:539

Member Function Documentation

◆ operator JResultDerivative< JResult_t >()

template<unsigned int N, class JResult_t >
JTOOLS::JResultPolynome< N, JResult_t >::operator JResultDerivative< JResult_t > ( ) const
inline

Type conversion operator.

Returns
result

Definition at line 558 of file JResult.hh.

559 {
561 return JResultDerivative<JResult_t>(y[0], y[1]);
562 }
#define STATIC_CHECK(expr)
Definition JAssert.hh:31

◆ operator JResultHesse< JResult_t >()

template<unsigned int N, class JResult_t >
JTOOLS::JResultPolynome< N, JResult_t >::operator JResultHesse< JResult_t > ( ) const
inline

Type conversion operator.

Returns
result

Definition at line 570 of file JResult.hh.

571 {
573 return JResultHesse<JResult_t>(y[0], y[1], y[2]);
574 }

◆ negate()

template<unsigned int N, class JResult_t >
JResultPolynome & JTOOLS::JResultPolynome< N, JResult_t >::negate ( )
inline

Prefix unary minus for function value of PDF.

Returns
function value of PDF

Definition at line 582 of file JResult.hh.

583 {
584 for (int i = 0; i != NUMBER_OF_POINTS; ++i) {
585 y[i] = -y[i];
586 }
587
588 return *this;
589 }

◆ add()

template<unsigned int N, class JResult_t >
JResultPolynome & JTOOLS::JResultPolynome< N, JResult_t >::add ( const JResultPolynome< N, JResult_t > & value)
inline

Addition operator for function value of PDF.

Parameters
valuefunction value of PDF
Returns
function value of PDF

Definition at line 598 of file JResult.hh.

599 {
600 for (int i = 0; i != NUMBER_OF_POINTS; ++i) {
601 y[i] += value.y[i];
602 }
603
604 return *this;
605 }

◆ sub()

template<unsigned int N, class JResult_t >
JResultPolynome & JTOOLS::JResultPolynome< N, JResult_t >::sub ( const JResultPolynome< N, JResult_t > & value)
inline

Subtraction operator for function value of PDF.

Parameters
valuefunction value of PDF
Returns
function value of PDF

Definition at line 614 of file JResult.hh.

615 {
616 for (int i = 0; i != NUMBER_OF_POINTS; ++i) {
617 y[i] -= value.y[i];
618 }
619
620 return *this;
621 }

◆ mul() [1/2]

template<unsigned int N, class JResult_t >
JResultPolynome & JTOOLS::JResultPolynome< N, JResult_t >::mul ( const double value)
inline

Multiplication operator for function value of PDF.

Parameters
valuemultiplication factor
Returns
function value of PDF

Definition at line 630 of file JResult.hh.

631 {
632 for (int i = 0; i != NUMBER_OF_POINTS; ++i) {
633 y[i] *= value;
634 }
635
636 return *this;
637 }

◆ div()

template<unsigned int N, class JResult_t >
JResultPolynome & JTOOLS::JResultPolynome< N, JResult_t >::div ( const double value)
inline

Division operator for function value of PDF.

Parameters
valuemultiplication factor
Returns
function value of PDF

Definition at line 646 of file JResult.hh.

647 {
648 for (int i = 0; i != NUMBER_OF_POINTS; ++i) {
649 y[i] /= value;
650 }
651
652 return *this;
653 }

◆ getValue()

template<unsigned int N, class JResult_t >
double JTOOLS::JResultPolynome< N, JResult_t >::getValue ( const double x) const
inline

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 662 of file JResult.hh.

663 {
664 double w = 0.0;
665 double z = 1.0;
666
667 for (int i = 0; i != NUMBER_OF_POINTS; ++i, z *= x / i) {
668 w += y[i] * z;
669 }
670
671 return w;
672 }

◆ operator()()

template<unsigned int N, class JResult_t >
double JTOOLS::JResultPolynome< N, JResult_t >::operator() ( const double x) const
inline

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 681 of file JResult.hh.

682 {
683 return getValue(x);
684 }
double getValue(const double x) const
Function value.
Definition JResult.hh:662

◆ mul() [2/2]

template<class JFirst_t , class JSecond_t >
JFirst_t & JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t & object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }

Member Data Documentation

◆ NUMBER_OF_POINTS

template<unsigned int N, class JResult_t >
const int JTOOLS::JResultPolynome< N, JResult_t >::NUMBER_OF_POINTS = N + 1
static

Definition at line 539 of file JResult.hh.

◆ y

template<unsigned int N, class JResult_t >
JResult_t JTOOLS::JResultPolynome< N, JResult_t >::y[NUMBER_OF_POINTS]

function and derivative values

Definition at line 687 of file JResult.hh.


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