UtilsLite
Utilities for C++ programming
Loading...
Searching...
No Matches
Utils::Trichotomy_base_fun< Real > Class Template Referenceabstract

Abstract base class for defining mathematical functions used in the minimization algorithm. More...

#include <Utils_Trichotomy.hh>

Public Member Functions

virtual Real eval (Real x) const =0
 
Real operator() (Real x) const
 

Detailed Description

template<typename Real>
class Utils::Trichotomy_base_fun< Real >

Abstract base class for defining mathematical functions used in the minimization algorithm.

This class serves as a base interface for user-defined functions that can be evaluated. It allows for the implementation the numerical method to find the minimum of the one dimensional equation \( f(x) \). Users must inherit from this class and implement the virtual method to define their specific functions.

Template Parameter:

  • Real: A numeric type representing the data type of the function's input and output, such as float, double, etc.

Usage Example: To create a custom function, derive from this class and implement the required methods. Here is an example for the function \( f(x) = x^2 - 2 \):

class Fun1 : public Trichotomy_base_fun<double> {
public:
double eval(double x) const override { return x*x - 2; }
};
Abstract base class for defining mathematical functions used in the minimization algorithm.
Definition Utils_Trichotomy.hh:71
virtual Real eval(Real x) const =0

Member Function Documentation

◆ eval()

template<typename Real>
virtual Real Utils::Trichotomy_base_fun< Real >::eval ( Real x) const
pure virtual

Evaluate the function \( f(x) \)

Parameters
[in]xthe point to evaluate \( f(x) \)
Returns
the value of \( f(x) \)

◆ operator()()

template<typename Real>
Real Utils::Trichotomy_base_fun< Real >::operator() ( Real x) const
inline

Evaluate the function \( f(x) \)

Parameters
[in]xthe point to evaluate \( f(x) \)
Returns
the value of \( f(x) \)

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