6 #ifndef CHEBYSHEV_PREC_STRUCTURES_H
7 #define CHEBYSHEV_PREC_STRUCTURES_H
13 #include "../core/common.h"
37 long double maxErr = get_nan<long double>();
40 long double meanErr = get_nan<long double>();
43 long double rmsErr = get_nan<long double>();
46 long double relErr = get_nan<long double>();
49 long double absErr = get_nan<long double>();
70 template<
typename Type>
76 template<
typename R,
typename ...Args>
79 using Estimator_t = std::function<
81 std::function<R(Args...)>,
82 std::function<R(Args...)>,
91 std::function<R(Args...)> f1,
92 std::function<R(Args...)> f2,
106 return (r.maxErr > r.tolerance) || (r.maxErr != r.maxErr);
147 std::vector<interval> omega,
157 template<
typename R,
typename ...Args>
203 const auto diff = x - y;
204 return (
long double) (diff > 0 ? diff : -diff);
#define CHEBYSHEV_PREC_ITER
Default number of function evaluations in precision testing.
Definition: common.h:12
#define CHEBYSHEV_PREC_TOLERANCE
Default tolerance in precision testing.
Definition: common.h:17
Interval over the real numbers.
std::function< long double(Type, Type)> DistanceFunction
Distance function between two elements.
Definition: prec_structures.h:71
std::function< bool(const estimate_result &)> FailFunction
A function which determines whether an estimation failed.
Definition: prec_structures.h:66
typename estimate_options< R, Args... >::Estimator_t Estimator
Generic precision estimator function signature.
Definition: prec_structures.h:158
std::string string(size_t length)
Generate a random string made of human-readable ASCII characters.
Definition: random.h:102
General namespace of the framework.
Definition: benchmark_structures.h:16
Structure holding options for equivalence evaluation.
Definition: prec_structures.h:195
bool quiet
Print to standard output or not.
Definition: prec_structures.h:208
equation_options(long double tolerance, DistanceFunction< T > dist, bool quiet=false)
Construct equation options from the tolerance, the distance function and the quiet flag (defaults to ...
Definition: prec_structures.h:222
long double tolerance
Tolerance on the absolute difference.
Definition: prec_structures.h:198
equation_options()
Default constructor for equation options.
Definition: prec_structures.h:212
DistanceFunction< T > distance
Distance function to measure the distance between the expected and evaluated value.
Definition: prec_structures.h:202
equation_options(long double tolerance)
Construct equation options from the tolerance, setting the distance function to a simple Euclidean di...
Definition: prec_structures.h:217
A structure holding the result of an evaluation.
Definition: prec_structures.h:163
long double tolerance
Tolerance on the absolute difference.
Definition: prec_structures.h:182
bool failed
Whether the test failed.
Definition: prec_structures.h:185
bool quiet
Print to standard output or not.
Definition: prec_structures.h:188
std::string name
Identifying name of the function or test case.
Definition: prec_structures.h:166
long double difference
Evaluated difference between expected and evaluated values.
Definition: prec_structures.h:175
std::map< std::string, long double > additionalFields
Additional fields by name, as a floating point value.
Definition: prec_structures.h:179
long double evaluated
Evaluated value.
Definition: prec_structures.h:169
long double expected
Expected value.
Definition: prec_structures.h:172
A structure holding the options for precision estimation.
Definition: prec_structures.h:77
FailFunction fail
The function to determine whether the test failed (defaults to fail::fail_on_max_err).
Definition: prec_structures.h:105
unsigned int iterations
Number of function evaluations to use.
Definition: prec_structures.h:101
estimate_options(interval omega, Estimator_t estimator)
Construct estimate options from a one-dimensional interval domain and an estimator,...
Definition: prec_structures.h:122
estimate_options(interval omega, Estimator_t estimator, long double tolerance, bool quiet=false)
Construct estimate options from a one-dimensional interval domain, an estimator, a tolerance and an o...
Definition: prec_structures.h:129
estimate_options(std::vector< interval > omega, Estimator_t estimator)
Construct estimate options from a multidimensional interval domain and an estimator,...
Definition: prec_structures.h:140
std::vector< interval > domain
The domain of estimation.
Definition: prec_structures.h:86
Estimator_t estimator
The precision estimator to use (defaults to a dummy estimator)
Definition: prec_structures.h:90
estimate_options(std::vector< interval > omega, Estimator_t estimator, long double tolerance, bool quiet=false)
Construct estimate options from a multidimensional interval domain, an estimator, a tolerance and an ...
Definition: prec_structures.h:146
long double tolerance
The tolerance to use to determine whether the test failed.
Definition: prec_structures.h:98
bool quiet
Whether to show the test result or not.
Definition: prec_structures.h:110
estimate_options()
Construct estimate options with all default values.
Definition: prec_structures.h:116
A structure holding the result of precision estimation.
Definition: prec_structures.h:25
std::string name
Identifying name of the function or test case.
Definition: prec_structures.h:28
std::map< std::string, long double > additionalFields
Additional fields by name, as a floating point value.
Definition: prec_structures.h:52
bool quiet
Print to standard output or not.
Definition: prec_structures.h:58
long double meanErr
Estimated mean error on interval.
Definition: prec_structures.h:40
long double relErr
Estimated relative error on interval.
Definition: prec_structures.h:46
long double maxErr
Estimated maximum absolute error on interval.
Definition: prec_structures.h:37
bool failed
Whether the test failed.
Definition: prec_structures.h:55
std::vector< interval > domain
Interval of estimation.
Definition: prec_structures.h:31
long double rmsErr
Estimated RMS error on interval.
Definition: prec_structures.h:43
unsigned int iterations
Total number of iterations for integral quadrature.
Definition: prec_structures.h:61
long double absErr
Estimated absolute error on interval.
Definition: prec_structures.h:49
long double tolerance
Tolerance on the max absolute error.
Definition: prec_structures.h:34
An interval on the real numbers.
Definition: interval.h:16