Chebyshev
Unit testing for scientific software
Loading...
Searching...
No Matches
chebyshev::prec::estimator Namespace Reference

Precision estimators. More...

Functions

template<typename FloatType = double>
auto quadrature1D ()
 Use Simpson's quadrature scheme to approximate error integrals for univariate real functions (endofunctions on real number types).
 
template<typename IntType = int, typename ReturnType = IntType>
auto discrete1D ()
 Use a discrete estimator over a lattice of points, here implemented in one dimension, to compute error sums over a discrete domain.
 
template<typename FloatType = double>
auto montecarlo1D (std::shared_ptr< random::random_context > rnd_ctx)
 Use crude Monte Carlo integration to approximate error integrals for univariate real functions.
 
template<typename FloatType = double, typename Vector = std::vector<FloatType>>
auto montecarlo (std::shared_ptr< random::random_context > rnd_ctx, unsigned int dimensions)
 Use crude Monte Carlo integration to approximate error integrals for multivariate real functions.
 

Detailed Description

Precision estimators.

Function Documentation

◆ discrete1D()

template<typename IntType = int, typename ReturnType = IntType>
auto chebyshev::prec::estimator::discrete1D ( )
inline

Use a discrete estimator over a lattice of points, here implemented in one dimension, to compute error sums over a discrete domain.

The function is evaluated at the discrete integer values inside the prec::interval domain and the errors are summed and averaged, returning a prec::estimate_result.

ReturnType must be a type that has operator-() and is castable to long double.

◆ montecarlo()

template<typename FloatType = double, typename Vector = std::vector<FloatType>>
auto chebyshev::prec::estimator::montecarlo ( std::shared_ptr< random::random_context rnd_ctx,
unsigned int  dimensions 
)
inline

Use crude Monte Carlo integration to approximate error integrals for multivariate real functions.

Parameters
rnd_ctxA shared pointer to the random context to use for random number generation.
dimensionsThe dimension of the space of inputs

Since multiple concurrent test cases may use the same estimator, the creation of multiple random sources is handled by the random context itself.

Note
You may specify a custom vector type to use as input, but it must provide a constructor taking in the number of elements.

◆ montecarlo1D()

template<typename FloatType = double>
auto chebyshev::prec::estimator::montecarlo1D ( std::shared_ptr< random::random_context rnd_ctx)
inline

Use crude Monte Carlo integration to approximate error integrals for univariate real functions.

A uniform random sampler is used to sample points over the one-dimensional domain

◆ quadrature1D()

template<typename FloatType = double>
auto chebyshev::prec::estimator::quadrature1D ( )
inline

Use Simpson's quadrature scheme to approximate error integrals for univariate real functions (endofunctions on real number types).

The estimator is returned as a lambda function.