#include <numerical_integration.h>
Public Types | |
enum | NumericalIntegrationMethod { TrapezoidMethod, SimpsonMethod } |
Public Member Functions | |
NumericalIntegration (void) | |
virtual | ~NumericalIntegration (void) |
const NumericalIntegrationMethod & | get_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 |
TiXmlElement * | to_XML (void) const |
void | from_XML (TiXmlElement *) |
template<class T > | |
double | calculate_trapezoid_integral (const T &t, double(T::*f)(const double &) const , const double &a, const double &b, const unsigned int &n) const |
template<class T > | |
Vector< double > | calculate_trapezoid_integral (const T &t, Vector< double >(T::*f)(const double &) const , const double &a, const double &b, const unsigned int &n) const |
template<class T > | |
double | calculate_Simpson_integral (const T &t, double(T::*f)(const double &) const , const double &a, const double &b, const unsigned int &n) const |
template<class T > | |
Vector< double > | calculate_Simpson_integral (const T &t, Vector< double >(T::*f)(const double &) const , const double &a, const double &b, const unsigned int &n) const |
template<class T > | |
double | calculate_integral (const T &t, double(T::*f)(const double &) const , const double &a, const double &b, const unsigned int &n) const |
template<class T > | |
Vector< double > | calculate_integral (const T &t, Vector< double >(T::*f)(const double &) const , const double &a, const double &b, const unsigned int &n) const |
Definition at line 34 of file numerical_integration.h.
Enumeration of available methods for numerical integration.
Definition at line 49 of file numerical_integration.h.
OpenNN::NumericalIntegration::NumericalIntegration | ( | void | ) | [explicit] |
OpenNN::NumericalIntegration::~NumericalIntegration | ( | void | ) | [virtual] |
const NumericalIntegration::NumericalIntegrationMethod & OpenNN::NumericalIntegration::get_numerical_integration_method | ( | void | ) | const |
This method returns the method used for numerical integration (trapezoid method or Simpson's method).
Definition at line 58 of file numerical_integration.cpp.
std::string OpenNN::NumericalIntegration::write_numerical_integration_method | ( | void | ) | const |
This method returns a string with the name of the method to be used for numerical integration.
Definition at line 68 of file numerical_integration.cpp.
const bool & OpenNN::NumericalIntegration::get_display | ( | void | ) | const |
This method returns the flag used by this class for displaying or not displaying warnings.
Definition at line 103 of file numerical_integration.cpp.
void OpenNN::NumericalIntegration::set | ( | const NumericalIntegration & | other_numerical_integration | ) |
This method sets the members of this object to be equal to those of another object.
other_numerical_integration | Numerical integration object to be copied. |
Definition at line 114 of file numerical_integration.cpp.
void OpenNN::NumericalIntegration::set_numerical_integration_method | ( | const NumericalIntegrationMethod & | new_numerical_integration_method | ) |
This method sets the method to be used for numerical integration (trapezoid method or Simpson's method).
new_numerical_integration_method | New numerical integration method. |
Definition at line 128 of file numerical_integration.cpp.
void OpenNN::NumericalIntegration::set_numerical_integration_method | ( | const std::string & | new_numerical_integration_method | ) |
This method sets the method to be used for the numerical integration. The argument is a string with the name of the numerical integration method.
new_numerical_integration_method | Numerical integration method name string. |
Definition at line 140 of file numerical_integration.cpp.
void OpenNN::NumericalIntegration::set_display | ( | const bool & | new_display | ) |
This method sets a new flag for displaying warnings from this class or not.
new_display | Display flag. |
Definition at line 168 of file numerical_integration.cpp.
void OpenNN::NumericalIntegration::set_default | ( | void | ) |
This method sets the default values to the numerical integration object:
Definition at line 182 of file numerical_integration.cpp.
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.
Definition at line 197 of file numerical_integration.cpp.
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.
Definition at line 225 of file numerical_integration.cpp.
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).
Definition at line 309 of file numerical_integration.cpp.
TiXmlElement * OpenNN::NumericalIntegration::to_XML | ( | void | ) | const |
This method serializes this numerical integration object into a XML element.
Definition at line 344 of file numerical_integration.cpp.
void OpenNN::NumericalIntegration::from_XML | ( | TiXmlElement * | numerical_integration_element | ) |
This method deserializes the object from a XML element.
numerical_integration_element | TinyXML element with the member data. |
Definition at line 383 of file numerical_integration.cpp.
double OpenNN::NumericalIntegration::calculate_trapezoid_integral | ( | const T & | t, | |
double(T::*)(const double &) const | f, | |||
const double & | a, | |||
const double & | b, | |||
const unsigned int & | n | |||
) | const [inline] |
This method evaluates the integral of a function given as a class member method using the composite trapezoid rule with n intervals.
t | : Object constructor containing the member method to integrate. | |
f,: | Pointer to the member method. | |
a,: | Lower integration limit. | |
b,: | Upper integration limit. | |
n,: | Number of intervals. |
Definition at line 94 of file numerical_integration.h.
Vector<double> OpenNN::NumericalIntegration::calculate_trapezoid_integral | ( | const T & | t, | |
Vector< double >(T::*)(const double &) const | f, | |||
const double & | a, | |||
const double & | b, | |||
const unsigned int & | n | |||
) | const [inline] |
This method evaluates the integral of a vector function given as a class member method using the composite trapezoid rule with n intervals.
t | : Object constructor containing the member method to integrate. | |
f,: | Pointer to the member method. | |
a,: | Lower integration limit. | |
b,: | Upper integration limit. | |
n,: | Number of intervals. |
Definition at line 130 of file numerical_integration.h.
double OpenNN::NumericalIntegration::calculate_Simpson_integral | ( | const T & | t, | |
double(T::*)(const double &) const | f, | |||
const double & | a, | |||
const double & | b, | |||
const unsigned int & | n | |||
) | const [inline] |
This method evaluates the integral of a function given as a class member method using the composite Simpsons rule with n intervals.
t | : Object constructor containing the member method to integrate. | |
f,: | Pointer to the member method. | |
a,: | Lower integration limit. | |
b,: | Upper integration limit. | |
n,: | Number of intervals. |
Definition at line 165 of file numerical_integration.h.
Vector<double> OpenNN::NumericalIntegration::calculate_Simpson_integral | ( | const T & | t, | |
Vector< double >(T::*)(const double &) const | f, | |||
const double & | a, | |||
const double & | b, | |||
const unsigned int & | n | |||
) | const [inline] |
This method evaluates the integral of a vector function given as a class member method using the composite Simpsons rule with n intervals.
t | : Object constructor containing the member method to integrate. | |
f,: | Pointer to the member method. | |
a,: | Lower integration limit. | |
b,: | Upper integration limit. | |
n,: | Number of intervals. |
Definition at line 201 of file numerical_integration.h.
double OpenNN::NumericalIntegration::calculate_integral | ( | const T & | t, | |
double(T::*)(const double &) const | f, | |||
const double & | a, | |||
const double & | b, | |||
const unsigned int & | n | |||
) | const [inline] |
This method evaluates the integral of a function given as a class member method.
t | : Object constructor containing the member method to integrate. | |
f,: | Pointer to the member method. | |
a,: | Lower integration limit. | |
b,: | Upper integration limit. | |
n,: | Number of intervals. |
Definition at line 238 of file numerical_integration.h.
Vector<double> OpenNN::NumericalIntegration::calculate_integral | ( | const T & | t, | |
Vector< double >(T::*)(const double &) const | f, | |||
const double & | a, | |||
const double & | b, | |||
const unsigned int & | n | |||
) | const [inline] |
This method evaluates the integral of a vector function given as a class member method with n intervals.
t | : Object constructor containing the member method to integrate. | |
f,: | Pointer to the member method. | |
a,: | Lower integration limit. | |
b,: | Upper integration limit. | |
n,: | Number of intervals. |
Definition at line 280 of file numerical_integration.h.