OpenNN  2.2
Open Neural Networks Library
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
OpenNN::NumericalIntegration Class Reference

#include <numerical_integration.h>

Public Types

enum  NumericalIntegrationMethod { TrapezoidMethod, SimpsonMethod }
 

Public Member Functions

 NumericalIntegration (void)
 
virtual ~NumericalIntegration (void)
 
const NumericalIntegrationMethodget_numerical_integration_method (void) const
 
std::string write_numerical_integration_method (void) const
 
const bool & get_display (void) const
 
void set (const NumericalIntegration &)
 
void set_numerical_integration_method (const NumericalIntegrationMethod &)
 
void set_numerical_integration_method (const std::string &)
 
void set_display (const bool &)
 
void set_default (void)
 
double calculate_trapezoid_integral (const Vector< double > &, const Vector< double > &) const
 
double calculate_Simpson_integral (const Vector< double > &, const Vector< double > &) const
 
double calculate_integral (const Vector< double > &, const Vector< double > &) const
 
tinyxml2::XMLDocument * to_XML (void) const
 
void from_XML (const tinyxml2::XMLDocument &)
 
template<class T >
double calculate_integral (const T &t, double(T::*)(const double &) const , const double &a, const double &b, const size_t &n) const
 
template<class T >
Vector< double > calculate_integral (const T &t, Vector< double >(T::*)(const double &) const , const double &a, const double &b, const size_t &n) const
 

Static Public Member Functions

template<class T >
static double calculate_trapezoid_integral (const T &t, double(T::*f)(const double &) const , const double &a, const double &b, const size_t &n)
 
template<class T >
static Vector< double > calculate_trapezoid_integral (const T &t, Vector< double >(T::*f)(const double &) const , const double &a, const double &b, const size_t &n)
 
template<class T >
static double calculate_Simpson_integral (const T &t, double(T::*f)(const double &) const , const double &a, const double &b, const size_t &n)
 
template<class T >
static Vector< double > calculate_Simpson_integral (const T &t, Vector< double >(T::*f)(const double &) const , const double &a, const double &b, const size_t &n)
 

Private Attributes

NumericalIntegrationMethod numerical_integration_method
 
bool display
 

Detailed Description

This class contains methods for numerical integration of functions. In particular it implements the trapezoid method and the Simpson's method.

Definition at line 36 of file numerical_integration.h.

Member Function Documentation

double OpenNN::NumericalIntegration::calculate_integral ( const Vector< double > &  x,
const Vector< double > &  y 
) const

This method evaluates the integral of a function given as a set of n pairs of data (x,y).

Parameters
xVector of x data.
yVector of y data.

Definition at line 298 of file numerical_integration.cpp.

template<class T >
double OpenNN::NumericalIntegration::calculate_integral ( const T &  t,
double(T::*)(const double &)  const,
const double &  a,
const double &  b,
const size_t &  n 
) const
inline

This method evaluates the integral of a function given as a class member method.

Parameters
t: Object constructor containing the member method to integrate.
fPointer to the member method.
aLower integration limit.
bUpper integration limit.
nNumber of intervals.

Definition at line 239 of file numerical_integration.h.

template<class T >
Vector<double> OpenNN::NumericalIntegration::calculate_integral ( const T &  t,
Vector< double >(T::*)(const double &)  const,
const double &  a,
const double &  b,
const size_t &  n 
) const
inline

This method evaluates the integral of a vector function given as a class member method with n intervals.

Parameters
t: Object constructor containing the member method to integrate.
fPointer to the member method.
aLower integration limit.
bUpper integration limit.
nNumber of intervals.

Definition at line 281 of file numerical_integration.h.

double OpenNN::NumericalIntegration::calculate_Simpson_integral ( const Vector< double > &  x,
const Vector< double > &  y 
) const

This method evaluates the integral of a function given as a set of n pairs of data (x,y) using the composite Simpson's rule.

Parameters
xVector of x data.
yVector of y data.

Definition at line 214 of file numerical_integration.cpp.

template<class T >
static double OpenNN::NumericalIntegration::calculate_Simpson_integral ( const T &  t,
double(T::*)(const double &) const  f,
const double &  a,
const double &  b,
const size_t &  n 
)
inlinestatic

This method evaluates the integral of a function given as a class member method using the composite Simpsons rule with n intervals.

Parameters
t: Object constructor containing the member method to integrate.
fPointer to the member method.
aLower integration limit.
bUpper integration limit.
nNumber of intervals.

Definition at line 166 of file numerical_integration.h.

template<class T >
static Vector<double> OpenNN::NumericalIntegration::calculate_Simpson_integral ( const T &  t,
Vector< double >(T::*)(const double &) const  f,
const double &  a,
const double &  b,
const size_t &  n 
)
inlinestatic

This method evaluates the integral of a vector function given as a class member method using the composite Simpsons rule with n intervals.

Parameters
t: Object constructor containing the member method to integrate.
fPointer to the member method.
aLower integration limit.
bUpper integration limit.
nNumber of intervals.

Definition at line 202 of file numerical_integration.h.

double OpenNN::NumericalIntegration::calculate_trapezoid_integral ( const Vector< double > &  x,
const Vector< double > &  y 
) const

This method evaluates the integral of a function given as a set of n pairs of data (x,y) using the composite trapezoid rule.

Parameters
xVector of x data.
yVector of y data.

Definition at line 186 of file numerical_integration.cpp.

template<class T >
static double OpenNN::NumericalIntegration::calculate_trapezoid_integral ( const T &  t,
double(T::*)(const double &) const  f,
const double &  a,
const double &  b,
const size_t &  n 
)
inlinestatic

This method evaluates the integral of a function given as a class member method using the composite trapezoid rule with n intervals.

Parameters
t: Object constructor containing the member method to integrate.
fPointer to the member method.
aLower integration limit.
bUpper integration limit.
nNumber of intervals.

Definition at line 95 of file numerical_integration.h.

template<class T >
static Vector<double> OpenNN::NumericalIntegration::calculate_trapezoid_integral ( const T &  t,
Vector< double >(T::*)(const double &) const  f,
const double &  a,
const double &  b,
const size_t &  n 
)
inlinestatic

This method evaluates the integral of a vector function given as a class member method using the composite trapezoid rule with n intervals.

Parameters
t: Object constructor containing the member method to integrate.
fPointer to the member method.
aLower integration limit.
bUpper integration limit.
nNumber of intervals.

Definition at line 131 of file numerical_integration.h.

void OpenNN::NumericalIntegration::from_XML ( const tinyxml2::XMLDocument &  document)

Deserializes the object from a XML document.

Parameters
documentTinyXML document with the member data.

Definition at line 376 of file numerical_integration.cpp.

void OpenNN::NumericalIntegration::set ( const NumericalIntegration other_numerical_integration)

Sets the members of this object to be equal to those of another object.

Parameters
other_numerical_integrationNumerical integration object to be copied.

Definition at line 103 of file numerical_integration.cpp.

void OpenNN::NumericalIntegration::set_default ( void  )

Sets the default values to the numerical integration object:

  • Numerical integration method: Simpson method.
  • Display: true

Definition at line 171 of file numerical_integration.cpp.

void OpenNN::NumericalIntegration::set_display ( const bool &  new_display)

Sets a new flag for displaying warnings from this class or not.

Parameters
new_displayDisplay flag.

Definition at line 157 of file numerical_integration.cpp.

void OpenNN::NumericalIntegration::set_numerical_integration_method ( const NumericalIntegrationMethod new_numerical_integration_method)

Sets the method to be used for numerical integration (trapezoid method or Simpson's method).

Parameters
new_numerical_integration_methodNew numerical integration method.

Definition at line 117 of file numerical_integration.cpp.

void OpenNN::NumericalIntegration::set_numerical_integration_method ( const std::string &  new_numerical_integration_method)

Sets the method to be used for the numerical integration. The argument is a string with the name of the numerical integration method.

Parameters
new_numerical_integration_methodNumerical integration method name string.

Definition at line 129 of file numerical_integration.cpp.


The documentation for this class was generated from the following files: