|
Mantid
|
SimpleChebfun : approximates smooth 1d functions and provides methods to manipulate them. More...
#include <SimpleChebfun.h>
Public Member Functions | |
| double | accuracy () const |
| Get the accuracy of the approximation. | |
| const std::vector< double > & | coeffs () const |
| Get a reference to the Chebyshev expansion coefficients. | |
| SimpleChebfun | derivative () const |
| Create a derivative of this function. | |
| double | endX () const |
| End of the interval. | |
| SimpleChebfun | integral () const |
| Create an integral of this function. | |
| double | integrate () const |
| Integrate the function on its interval. | |
| bool | isGood () const |
| Check if approximation is good. | |
| std::vector< double > | linspace (size_t n) const |
| Create a vector of x values linearly spaced on the approximation interval. | |
| std::vector< double > | operator() (const std::vector< double > &x) const |
| Evaluate the function. | |
| double | operator() (double x) const |
| Evaluate the function. | |
| SimpleChebfun & | operator+= (const ChebfunFunctionType &fun) |
| Add a C++ function to the function. | |
| size_t | order () const |
| Order of the approximating polynomial. | |
| std::vector< double > | roughRoots (double level=0.0) const |
| Get rough estimates of the roots. | |
| SimpleChebfun (const API::IFunction &fun, double start, double end, double accuracy=0.0, size_t badSize=10) | |
| Constructor. | |
| SimpleChebfun (const ChebfunFunctionType &fun, double start, double end, double accuracy=0.0, size_t badSize=10) | |
| Constructor. | |
| SimpleChebfun (const std::vector< double > &x, const std::vector< double > &y) | |
| Constructor. | |
| SimpleChebfun (size_t n, ChebfunFunctionType fun, double start, double end) | |
| Constructor. | |
| SimpleChebfun (size_t n, const API::IFunction &fun, double start, double end) | |
| Constructor. | |
| size_t | size () const |
| Number of points in the approximation. | |
| double | startX () const |
| Start of the interval. | |
| double | width () const |
| Get the width of the interval. | |
| const std::vector< double > & | xPoints () const |
| Get a reference to the x-points. | |
| const std::vector< double > & | yPoints () const |
| Get a reference to the y-points. | |
Private Member Functions | |
| SimpleChebfun (const ChebfunBase_sptr &base) | |
| Constructor. | |
Private Attributes | |
| std::vector< double > | m_A |
| Chebyshev expansion coefficients. | |
| bool | m_badFit |
| Set in a case of a bad fit. | |
| ChebfunBase_sptr | m_base |
| Underlying base that does actual job. | |
| std::vector< double > | m_P |
| Function values at the chebfun x-points. | |
SimpleChebfun : approximates smooth 1d functions and provides methods to manipulate them.
Main functionality is implemented in ChebfunBase class.
Definition at line 21 of file SimpleChebfun.h.
| Mantid::CurveFitting::Functions::SimpleChebfun::SimpleChebfun | ( | size_t | n, |
| ChebfunFunctionType | fun, | ||
| double | start, | ||
| double | end | ||
| ) |
Constructor.
Constructs a SimpleChebfun that approximates a function with a polynomial of a given order in an interval of x-values.
| n | :: Polynomial order == number of points - 1. |
| fun | :: A function to approximate. |
| start | :: The start (lower bound) of an interval on the x-axis. |
| end | :: The end (upper bound) of an interval on the x-axis. |
Definition at line 25 of file SimpleChebfun.cpp.
| Mantid::CurveFitting::Functions::SimpleChebfun::SimpleChebfun | ( | size_t | n, |
| const API::IFunction & | fun, | ||
| double | start, | ||
| double | end | ||
| ) |
| Mantid::CurveFitting::Functions::SimpleChebfun::SimpleChebfun | ( | const ChebfunFunctionType & | fun, |
| double | start, | ||
| double | end, | ||
| double | accuracy = 0.0, |
||
| size_t | badSize = 10 |
||
| ) |
Constructor.
Constructs a SimpleChebfun that approximates a function to a given accuracy in an interval of x-values.
The approximation may fail (too large interval, function discontinuous, etc). In this case a default sized polynomial is created and isGood() will be returning false.
| fun | :: A function to approximate. |
| start | :: The start (lower bound) of an interval on the x-axis. |
| end | :: The end (upper bound) of an interval on the x-axis. |
| accuracy | :: The accuracy of the approximation. |
| badSize | :: If automatic approxiamtion fails the base will have this size. |
Definition at line 47 of file SimpleChebfun.cpp.
References accuracy(), m_A, m_badFit, m_base, and m_P.
| Mantid::CurveFitting::Functions::SimpleChebfun::SimpleChebfun | ( | const API::IFunction & | fun, |
| double | start, | ||
| double | end, | ||
| double | accuracy = 0.0, |
||
| size_t | badSize = 10 |
||
| ) |
Constructor.
Definition at line 57 of file SimpleChebfun.cpp.
References accuracy(), m_A, m_badFit, m_base, and m_P.
| Mantid::CurveFitting::Functions::SimpleChebfun::SimpleChebfun | ( | const std::vector< double > & | x, |
| const std::vector< double > & | y | ||
| ) |
Constructor.
Construct a SimpleChebfun by smoothing data in vectors with x and y data.
| x | :: A vector of x values. |
| y | :: A vector of y values. Must have same size as x. |
Definition at line 70 of file SimpleChebfun.cpp.
References m_base, m_P, Mantid::Geometry::x, and Mantid::Geometry::y.
|
private |
Constructor.
Construct an empty SimpleChebfun with shared base.
Definition at line 76 of file SimpleChebfun.cpp.
| double Mantid::CurveFitting::Functions::SimpleChebfun::accuracy | ( | ) | const |
Get the accuracy of the approximation.
Definition at line 103 of file SimpleChebfun.cpp.
References m_base.
Referenced by SimpleChebfun(), and SimpleChebfun().
| const std::vector< double > & Mantid::CurveFitting::Functions::SimpleChebfun::coeffs | ( | ) | const |
| SimpleChebfun Mantid::CurveFitting::Functions::SimpleChebfun::derivative | ( | ) | const |
Create a derivative of this function.
Definition at line 106 of file SimpleChebfun.cpp.
References m_A, m_base, and m_P.
Referenced by Mantid::CurveFitting::ParameterEstimator::estimate(), and Mantid::CurveFitting::ParameterEstimator::setBackToBackExponential().
|
inline |
End of the interval.
Definition at line 42 of file SimpleChebfun.h.
Referenced by Mantid::CurveFitting::ParameterEstimator::getPeakHWHM().
| SimpleChebfun Mantid::CurveFitting::Functions::SimpleChebfun::integral | ( | ) | const |
Create an integral of this function.
Definition at line 117 of file SimpleChebfun.cpp.
References integral(), m_A, m_base, and m_P.
Referenced by integral().
| double Mantid::CurveFitting::Functions::SimpleChebfun::integrate | ( | ) | const |
Integrate the function on its interval.
Definition at line 150 of file SimpleChebfun.cpp.
|
inline |
Check if approximation is good.
Definition at line 38 of file SimpleChebfun.h.
| std::vector< double > Mantid::CurveFitting::Functions::SimpleChebfun::linspace | ( | size_t | n | ) | const |
Create a vector of x values linearly spaced on the approximation interval.
| n | :: Number of points in the vector. |
Definition at line 100 of file SimpleChebfun.cpp.
| std::vector< double > Mantid::CurveFitting::Functions::SimpleChebfun::operator() | ( | const std::vector< double > & | x | ) | const |
Evaluate the function.
Evaluate the function for each value in a vector.
| x | :: Points where the function is evaluated. |
Definition at line 96 of file SimpleChebfun.cpp.
References m_base, m_P, and Mantid::Geometry::x.
| double Mantid::CurveFitting::Functions::SimpleChebfun::operator() | ( | double | x | ) | const |
Evaluate the function.
| x | :: Point where the function is evaluated. |
Definition at line 92 of file SimpleChebfun.cpp.
References m_base, m_P, and Mantid::Geometry::x.
| SimpleChebfun & Mantid::CurveFitting::Functions::SimpleChebfun::operator+= | ( | const ChebfunFunctionType & | fun | ) |
Add a C++ function to the function.
| fun | :: A function to add. |
Definition at line 154 of file SimpleChebfun.cpp.
References m_A, m_P, Mantid::Geometry::x, and xPoints().
|
inline |
Order of the approximating polynomial.
Definition at line 36 of file SimpleChebfun.h.
Referenced by Mantid::CurveFitting::ParameterEstimator::setBackToBackExponential().
| std::vector< double > Mantid::CurveFitting::Functions::SimpleChebfun::roughRoots | ( | double | level = 0.0 | ) | const |
Get rough estimates of the roots.
| level | :: An optional right-hand-side of equation (*this)(x) == level. |
Definition at line 131 of file SimpleChebfun.cpp.
References m_base, m_P, Mantid::Geometry::x, xPoints(), and Mantid::Geometry::y.
Referenced by Mantid::CurveFitting::ParameterEstimator::getPeakCentre(), Mantid::CurveFitting::ParameterEstimator::getPeakHWHM(), and Mantid::CurveFitting::ParameterEstimator::getPeakLeftRightWidth().
|
inline |
Number of points in the approximation.
Definition at line 34 of file SimpleChebfun.h.
|
inline |
Start of the interval.
Definition at line 40 of file SimpleChebfun.h.
Referenced by Mantid::CurveFitting::ParameterEstimator::getPeakHWHM().
|
inline |
Get the width of the interval.
Definition at line 44 of file SimpleChebfun.h.
Referenced by Mantid::CurveFitting::ParameterEstimator::getPeakCentre().
|
inline |
Get a reference to the x-points.
Definition at line 46 of file SimpleChebfun.h.
Referenced by Mantid::CurveFitting::ParameterEstimator::getPeakLeftRightWidth(), operator+=(), and roughRoots().
|
inline |
Get a reference to the y-points.
Definition at line 48 of file SimpleChebfun.h.
|
mutableprivate |
Chebyshev expansion coefficients.
Definition at line 78 of file SimpleChebfun.h.
Referenced by coeffs(), derivative(), integral(), operator+=(), SimpleChebfun(), and SimpleChebfun().
|
private |
Set in a case of a bad fit.
Definition at line 81 of file SimpleChebfun.h.
Referenced by SimpleChebfun(), and SimpleChebfun().
|
private |
Underlying base that does actual job.
Definition at line 74 of file SimpleChebfun.h.
Referenced by accuracy(), coeffs(), derivative(), integral(), integrate(), linspace(), operator()(), operator()(), roughRoots(), SimpleChebfun(), SimpleChebfun(), SimpleChebfun(), SimpleChebfun(), SimpleChebfun(), and SimpleChebfun().
|
private |
Function values at the chebfun x-points.
Definition at line 76 of file SimpleChebfun.h.
Referenced by coeffs(), derivative(), integral(), integrate(), operator()(), operator()(), operator+=(), roughRoots(), SimpleChebfun(), SimpleChebfun(), SimpleChebfun(), SimpleChebfun(), SimpleChebfun(), and SimpleChebfun().