|
limes 3.1.0
Composable Calculus Expressions for C++20
|
N-dimensional integral over a rectangular box. More...
#include <box_integral.hpp>
Public Types | |
| using | value_type = typename E::value_type |
| using | integrand_type = E |
| using | bounds_type = std::array< std::pair< value_type, value_type >, Dims > |
Public Member Functions | |
| constexpr | BoxIntegral (E e, bounds_type b) noexcept |
| algorithms::integration_result< value_type > | eval (methods::monte_carlo< value_type > const &method) const |
| Evaluate using Monte Carlo integration. | |
| algorithms::integration_result< value_type > | eval () const |
| Evaluate with default Monte Carlo (10000 samples) | |
| algorithms::integration_result< value_type > | eval (std::size_t samples) const |
| Evaluate with sample count. | |
| algorithms::integration_result< value_type > | evaluate () const |
| std::string | to_string () const |
| String representation. | |
| template<typename Constraint > | |
| constexpr auto | where (Constraint c) const |
| Add a constraint to the box integral (for rejection sampling) | |
Public Attributes | |
| E | integrand |
| bounds_type | bounds |
Static Public Attributes | |
| static constexpr std::size_t | dims_v = Dims |
| static constexpr std::size_t | arity_v = (E::arity_v > Dims) ? (E::arity_v - Dims) : 0 |
N-dimensional integral over a rectangular box.
Represents:
Box integrals are evaluated using Monte Carlo integration, which scales well to high dimensions (error decreases as O(1/√n) regardless of dimension).
| E | Integrand expression type |
| Dims | Number of dimensions |
Definition at line 132 of file box_integral.hpp.
| using limes::expr::BoxIntegral< E, Dims >::bounds_type = std::array<std::pair<value_type, value_type>, Dims> |
Definition at line 135 of file box_integral.hpp.
| using limes::expr::BoxIntegral< E, Dims >::integrand_type = E |
Definition at line 134 of file box_integral.hpp.
| using limes::expr::BoxIntegral< E, Dims >::value_type = typename E::value_type |
Definition at line 133 of file box_integral.hpp.
|
inlineconstexprnoexcept |
Definition at line 143 of file box_integral.hpp.
|
inline |
Evaluate with default Monte Carlo (10000 samples)
Definition at line 179 of file box_integral.hpp.
References limes::expr::BoxIntegral< E, Dims >::eval().
Referenced by limes::expr::BoxIntegral< E, Dims >::eval(), limes::expr::BoxIntegral< E, Dims >::eval(), and limes::expr::BoxIntegral< E, Dims >::evaluate().
|
inline |
Evaluate using Monte Carlo integration.
Definition at line 152 of file box_integral.hpp.
References limes::expr::BoxIntegral< E, Dims >::bounds, limes::expr::BoxIntegral< E, Dims >::integrand, limes::methods::monte_carlo< T >::samples, limes::methods::monte_carlo< T >::seed, limes::expr::sum(), and limes::expr::y.
|
inline |
Evaluate with sample count.
Definition at line 185 of file box_integral.hpp.
References limes::expr::BoxIntegral< E, Dims >::eval().
|
inline |
Definition at line 191 of file box_integral.hpp.
References limes::expr::BoxIntegral< E, Dims >::eval().
|
inline |
String representation.
Definition at line 196 of file box_integral.hpp.
References limes::expr::BoxIntegral< E, Dims >::bounds, and limes::expr::BoxIntegral< E, Dims >::integrand.
|
inlineconstexpr |
Add a constraint to the box integral (for rejection sampling)
Definition at line 209 of file box_integral.hpp.
References limes::expr::BoxIntegral< E, Dims >::bounds, and limes::expr::BoxIntegral< E, Dims >::integrand.
|
staticconstexpr |
Definition at line 138 of file box_integral.hpp.
| bounds_type limes::expr::BoxIntegral< E, Dims >::bounds |
Definition at line 141 of file box_integral.hpp.
Referenced by limes::expr::BoxIntegral< E, Dims >::eval(), limes::expr::BoxIntegral< E, Dims >::to_string(), and limes::expr::BoxIntegral< E, Dims >::where().
|
staticconstexpr |
Definition at line 137 of file box_integral.hpp.
| E limes::expr::BoxIntegral< E, Dims >::integrand |
Definition at line 140 of file box_integral.hpp.
Referenced by limes::expr::BoxIntegral< E, Dims >::eval(), limes::expr::BoxIntegral< E, Dims >::to_string(), and limes::expr::BoxIntegral< E, Dims >::where().