Jpp
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
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< JResultPolynome< N, JResult_t > >

Public Types

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

Public Member Functions

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

Public Attributes

JResult_t y [NUMBER_OF_POINTS]
 function and derivative values More...
 

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 531 of file JResult.hh.

Member Typedef Documentation

◆ argument_type

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

Definition at line 535 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 543 of file JResult.hh.

544  {
545  for (int i = 0; i != NUMBER_OF_POINTS; ++i) {
546  y[i] = JMATH::zero;
547  }
548  }

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 556 of file JResult.hh.

557  {
559  return JResultDerivative<JResult_t>(y[0], y[1]);
560  }

◆ 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 568 of file JResult.hh.

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

◆ 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 580 of file JResult.hh.

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

◆ 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 596 of file JResult.hh.

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

◆ 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 612 of file JResult.hh.

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

◆ 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 628 of file JResult.hh.

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

◆ 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 644 of file JResult.hh.

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

◆ 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 660 of file JResult.hh.

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

◆ 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 679 of file JResult.hh.

680  {
681  return getValue(x);
682  }

◆ mul() [2/2]

JResultPolynome< N, JResult_t > & JMATH::JMath< JResultPolynome< N, JResult_t > , JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }

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 537 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 685 of file JResult.hh.


The documentation for this struct was generated from the following file:
JTOOLS::w
data_type w[N+1][M+1]
Definition: JPolint.hh:708
JTOOLS::JResultPolynome::NUMBER_OF_POINTS
static const int NUMBER_OF_POINTS
Definition: JResult.hh:537
STATIC_CHECK
#define STATIC_CHECK(expr)
Definition: JAssert.hh:29
JTOOLS::JResultDerivative
Data structure for result including value and first derivative of function.
Definition: JResult.hh:41
JTOOLS::JResultPolynome::getValue
double getValue(const double x) const
Function value.
Definition: JResult.hh:660
JTOOLS::JResultHesse
Data structure for result including value and first derivative of function.
Definition: JResult.hh:210
JMATH::JCalculator
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
JMATH::zero
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:94
JTOOLS::JResultPolynome::y
JResult_t y[NUMBER_OF_POINTS]
function and derivative values
Definition: JResult.hh:685