Theoretica
A C++ numerical and automatic mathematical library
|
Precision testing module. More...
Namespaces | |
distance | |
Distance functions for use in prec::equals. | |
estimator | |
Precision estimators. | |
fail | |
Fail functions for use in prec::estimate. | |
property | |
Property testing of functions. | |
Classes | |
class | interval |
An interval on the real numbers. More... | |
class | estimate_result |
A structure holding the result of precision estimation. More... | |
class | estimate_options |
A structure holding the options for precision estimation. More... | |
class | equation_result |
A structure holding the result of an evaluation. More... | |
class | equation_options |
Structure holding options for equivalence evaluation. More... | |
class | prec_settings |
of the precision testing module. More... | |
class | prec_results |
of the precision testing module. More... | |
Typedefs | |
using | FailFunction = std::function< bool(const estimate_result &)> |
A function which determines whether an estimation failed. | |
template<typename Type > | |
using | DistanceFunction = std::function< long double(Type, Type)> |
Distance function between two elements. | |
template<typename R , typename ... Args> | |
using | Estimator = typename estimate_options< R, Args... >::Estimator_t |
Generic precision estimator function signature. | |
Functions | |
void | setup (std::string moduleName, int argc=0, const char **argv=nullptr) |
Setup the precision testing environment. More... | |
void | terminate (bool exit=true) |
Terminate the precision testing environment, printing the results to standard output and output files. More... | |
template<typename R , typename ... Args, typename Function1 = std::function<R(Args...)>, typename Function2 = Function1> | |
void | estimate (const std::string &name, Function1 funcApprox, Function2 funcExpected, estimate_options< R, Args... > opt) |
Estimate error integrals over a function with respect to an exact function, with the given options. More... | |
template<typename R , typename ... Args, typename Function1 = std::function<R(Args...)>, typename Function2 = Function1> | |
void | estimate (const std::string &name, Function1 funcApprox, Function2 funcExpected, std::vector< interval > domain, long double tolerance, unsigned int iterations, FailFunction fail, Estimator< R, Args... > estimator, bool quiet=false) |
Estimate error integrals over a function with respect to an exact function. More... | |
void | estimate (const std::string &name, EndoFunction< double > funcApprox, EndoFunction< double > funcExpected, interval domain, long double tolerance=settings.defaultTolerance, unsigned int iterations=settings.defaultIterations, FailFunction fail=fail::fail_on_max_err(), Estimator< double, double > estimator=estimator::quadrature1D< double >(), bool quiet=false) |
Estimate error integrals over a real function of real variable, with respect to an exact function. More... | |
template<typename T = double> | |
void | equals (const std::string &name, const T &evaluated, const T &expected, equation_options< T > opt=equation_options< T >()) |
Test an equivalence up to a tolerance, with the given options (e.g. More... | |
template<typename T = double> | |
void | equals (const std::string &name, const T &evaluated, const T &expected, long double tolerance, DistanceFunction< T > distance, bool quiet=false) |
Test an equivalence up to a tolerance, with the given options (e.g. More... | |
void | equals (const std::string &name, long double evaluated, long double expected, long double tolerance=settings.defaultTolerance, bool quiet=false) |
Test an equivalence up to a tolerance, with the given options (e.g. More... | |
template<typename T > | |
void | equals (const std::string &name, std::vector< std::array< T, 2 >> values, long double tolerance=settings.defaultTolerance, bool quiet=false) |
Evaluate multiple pairs of values for equivalence up to the given tolerance (e.g. More... | |
Variables | |
struct chebyshev::prec::prec_settings | settings |
struct chebyshev::prec::prec_results | results |
Precision testing module.
This module provides functions to estimate the precision and accuracy of mathematical approximations, over an entire domain using prec::estimate or at single points using prec:equals. For estimates over a domain, precision estimators are used.
|
inline |
Test an equivalence up to a tolerance, with the given options (e.g.
for residual testing).
name | The name of the test case |
evaluate | The evaluated value |
expected | The expected value |
opt | The options for the evaluation |
|
inline |
Test an equivalence up to a tolerance, with the given options (e.g.
for residual testing).
name | The name of the test case |
evaluate | The evaluated value |
expected | The expected value |
distance | The distance function to use |
tolerance | The tolerance for the evaluation |
quiet | Whether to output the result |
|
inline |
Test an equivalence up to a tolerance, with the given options (e.g.
for residual testing).
name | The name of the test case |
evaluate | The evaluated value |
expected | The expected value |
tolerance | The tolerance for the evaluation |
quiet | Whether to output the result |
|
inline |
Evaluate multiple pairs of values for equivalence up to the given tolerance (e.g.
for residual testing).
name | The name of the function or test case |
values | A list of values to equate |
tolerance | The tolerance for the evaluation |
quiet | Whether to output the result |
|
inline |
Estimate error integrals over a real function of real variable, with respect to an exact function.
name | The name of the test case. |
funcApprox | The approximation to test. |
funcExpected | The expected result. |
intervals | The (potentially multidimensional) domain of estimation. |
iterations | The number of function evaluations. |
fail | The fail function to determine whether the test failed (defaults to fail_on_max_err). |
estimator | The precision estimator to use (defaults to the trapezoid<double> estimator). |
quiet | Whether to output the result. |
|
inline |
Estimate error integrals over a function with respect to an exact function, with the given options.
name | The name of the test case |
funcApprox | The approximation to test |
funcExpected | The expected result |
opt | The options for the estimation |
|
inline |
Estimate error integrals over a function with respect to an exact function.
name | The name of the test case. |
funcApprox | The approximation to test. |
funcExpected | The expected result. |
intervals | The (potentially multidimensional) domain of estimation. |
iterations | The number of function evaluations. |
fail | The fail function to determine whether the test failed. |
estimator | The precision estimator to use. |
quiet | Whether to output the result. |
|
inline |
Setup the precision testing environment.
moduleName | Name of the module under test. |
argc | The number of command line arguments |
argv | A list of C-style strings containing the command line arguments. |
|
inline |
Terminate the precision testing environment, printing the results to standard output and output files.
exit | Whether to exit after terminating the module. |