limes 3.1.0
Composable Calculus Expressions for C++20
Loading...
Searching...
No Matches
Expression Operations

Differentiation, integration, and analysis operations. More...

Files

file  box_integral.hpp
 N-dimensional box integration with Monte Carlo methods.
 
file  derivative_builder.hpp
 Fluent builder pattern for symbolic differentiation.
 
file  integral.hpp
 Fluent builder and node types for numerical integration.
 
file  product_integral.hpp
 Separable integral composition for independent integrals.
 

Namespaces

namespace  limes
 
namespace  limes::expr
 Expression layer for composable calculus.
 
namespace  limes::expr::detail
 
namespace  limes::expr::transforms
 

Concepts

concept  limes::expr::EvaluableIntegral
 Concept for types that can be evaluated as integrals.
 

Classes

struct  limes::expr::ConstrainedBoxIntegral< E, Dims, Constraint >
 Box integral with constraint for irregular regions. More...
 
struct  limes::expr::BoxIntegral< E, Dims >
 N-dimensional integral over a rectangular box. More...
 
struct  limes::expr::is_box_integral< T >
 
struct  limes::expr::is_box_integral< BoxIntegral< E, D > >
 
struct  limes::expr::is_constrained_box_integral< T >
 
struct  limes::expr::is_constrained_box_integral< ConstrainedBoxIntegral< E, D, C > >
 
struct  limes::expr::DerivativeBuilder< E >
 Fluent builder for computing symbolic derivatives. More...
 
struct  limes::expr::is_derivative_builder< T >
 
struct  limes::expr::is_derivative_builder< DerivativeBuilder< E > >
 
struct  limes::expr::Integral< E, Dim, Lo, Hi >
 Definite integral expression node. More...
 
struct  limes::expr::IntegralBuilder< E >
 Fluent builder for constructing integrals. More...
 
struct  limes::expr::TransformedIntegral< OriginalIntegral, Phi, Jacobian >
 Integral with change of variables (substitution). More...
 
struct  limes::expr::is_integral< Integral< E, Dim, Lo, Hi > >
 
struct  limes::expr::ConstBound< T >
 Constant integration bound (e.g., 0.0, 1.0) More...
 
struct  limes::expr::ExprBound< E >
 Expression-valued integration bound (depends on outer variables) More...
 
struct  limes::expr::ProductIntegral< I1, I2 >
 Product of two independent integrals. More...
 
struct  limes::expr::is_product_integral< T >
 
struct  limes::expr::is_product_integral< ProductIntegral< I1, I2 > >
 

Functions

template<typename E , std::size_t Dims>
constexpr auto limes::expr::over_box (E expr, std::array< std::pair< typename E::value_type, typename E::value_type >, Dims > bounds)
 Create a box integral from an expression.
 
template<typename E >
auto limes::expr::box2d (E expr, typename E::value_type x0, typename E::value_type x1, typename E::value_type y0, typename E::value_type y1)
 Create a 2D box integral (specialization for common case)
 
template<typename E >
auto limes::expr::box3d (E expr, typename E::value_type x0, typename E::value_type x1, typename E::value_type y0, typename E::value_type y1, typename E::value_type z0, typename E::value_type z1)
 Create a 3D box integral (specialization for common case)
 
template<typename E >
requires (is_expr_node_v<E> && !is_derivative_builder_v<E>)
constexpr auto limes::expr::derivative (E expr)
 Create a DerivativeBuilder for fluent derivative computation.
 
template<typename T >
requires std::is_arithmetic_v<T>
constexpr auto limes::expr::make_bound (T value)
 
template<typename E >
requires is_expr_node_v<E>
constexpr auto limes::expr::make_bound (E expr)
 
template<typename E >
requires is_expr_node_v<E>
constexpr auto limes::expr::integral (E expr)
 Create an IntegralBuilder for fluent integral construction.
 
template<typename I1 , typename I2 >
requires (is_integral_v<I1> && is_integral_v<I2>)
constexpr auto limes::expr::operator* (I1 const &i1, I2 const &i2)
 
template<typename I1 , typename I2 , typename I3 >
requires is_integral_v<I3>
constexpr auto limes::expr::operator* (ProductIntegral< I1, I2 > const &pi, I3 const &i3)
 Multiply ProductIntegral with another integral.
 
template<typename I1 , typename I2 , typename I3 >
requires is_integral_v<I3>
constexpr auto limes::expr::operator* (I3 const &i3, ProductIntegral< I1, I2 > const &pi)
 Multiply integral with ProductIntegral.
 
template<typename I1 , typename I2 >
requires (EvaluableIntegral<I1> && EvaluableIntegral<I2>)
constexpr auto limes::expr::product (I1 const &i1, I2 const &i2)
 Create a product of two independent integrals.
 
template<typename I1 , typename I2 , typename... Is>
requires (EvaluableIntegral<I1> && EvaluableIntegral<I2> && (EvaluableIntegral<Is> && ...))
constexpr auto limes::expr::product (I1 const &i1, I2 const &i2, Is const &... is)
 Create a product of multiple independent integrals.
 

Variables

template<typename T >
constexpr bool limes::expr::is_box_integral_v = is_box_integral<T>::value
 
template<typename T >
constexpr bool limes::expr::is_constrained_box_integral_v = is_constrained_box_integral<T>::value
 
template<typename T >
constexpr bool limes::expr::is_derivative_builder_v = is_derivative_builder<T>::value
 
template<typename T >
constexpr bool limes::expr::is_integral_v = is_integral<T>::value
 
template<typename T >
constexpr bool limes::expr::is_product_integral_v = is_product_integral<T>::value
 
template<typename I1 , typename I2 >
constexpr bool limes::expr::are_independent_integrals_v
 Check if multiplying integrals is valid (they must be over independent dimensions)
 

Detailed Description

Differentiation, integration, and analysis operations.

Function Documentation

◆ box2d()

template<typename E >
auto limes::expr::box2d ( expr,
typename E::value_type  x0,
typename E::value_type  x1,
typename E::value_type  y0,
typename E::value_type  y1 
)

Create a 2D box integral (specialization for common case)

Definition at line 370 of file box_integral.hpp.

◆ box3d()

template<typename E >
auto limes::expr::box3d ( expr,
typename E::value_type  x0,
typename E::value_type  x1,
typename E::value_type  y0,
typename E::value_type  y1,
typename E::value_type  z0,
typename E::value_type  z1 
)

Create a 3D box integral (specialization for common case)

Definition at line 377 of file box_integral.hpp.

◆ derivative()

template<typename E >
requires (is_expr_node_v<E> && !is_derivative_builder_v<E>)
constexpr auto limes::expr::derivative ( expr)
constexpr

Create a DerivativeBuilder for fluent derivative computation.

This is the main entry point for the derivative builder pattern. Returns a DerivativeBuilder that can be chained with .wrt<Dim>() calls.

Template Parameters
EExpression type (automatically deduced)
Parameters
exprThe expression to differentiate
Returns
DerivativeBuilder<E> A builder for fluent differentiation
Example
auto x = arg<0>;
auto y = arg<1>;
auto f = x*x + y*y;
auto df_dx = derivative(f).wrt<0>(); // 2x
auto d2f = derivative(f).wrt<0, 1>(); // 0 (no mixed term)
auto grad = derivative(f).gradient(); // (2x, 2y)
constexpr auto derivative(E expr)
constexpr Var< 1, T > y
Definition var.hpp:49
constexpr Var< 0, T > x
Definition var.hpp:46

Definition at line 195 of file derivative_builder.hpp.

◆ integral()

template<typename E >
requires is_expr_node_v<E>
constexpr auto limes::expr::integral ( expr)
constexpr

Create an IntegralBuilder for fluent integral construction.

This is the main entry point for building integrals. Returns an IntegralBuilder that can be chained with .over<Dim>(a, b) or .over_box(bounds) to specify integration bounds.

Template Parameters
EExpression type (automatically deduced)
Parameters
exprThe integrand expression
Returns
IntegralBuilder<E> A builder for specifying bounds
Example
auto x = arg<0>;
auto I = integral(x*x).over<0>(0.0, 1.0); // ∫₀¹ x² dx
auto result = I.eval(); // ≈ 0.333
constexpr auto integral(E expr)
Create an IntegralBuilder for fluent integral construction.
Definition integral.hpp:505

Definition at line 505 of file integral.hpp.

◆ make_bound() [1/2]

template<typename E >
requires is_expr_node_v<E>
constexpr auto limes::expr::make_bound ( expr)
constexpr

Definition at line 174 of file integral.hpp.

◆ make_bound() [2/2]

template<typename T >
requires std::is_arithmetic_v<T>
constexpr auto limes::expr::make_bound ( value)
constexpr

◆ operator*() [1/3]

template<typename I1 , typename I2 >
requires (is_integral_v<I1> && is_integral_v<I2>)
constexpr auto limes::expr::operator* ( I1 const &  i1,
I2 const &  i2 
)
constexpr

Multiply two independent integrals Returns a ProductIntegral that evaluates both separately

Definition at line 229 of file product_integral.hpp.

◆ operator*() [2/3]

template<typename I1 , typename I2 , typename I3 >
requires is_integral_v<I3>
constexpr auto limes::expr::operator* ( I3 const &  i3,
ProductIntegral< I1, I2 > const &  pi 
)
constexpr

Multiply integral with ProductIntegral.

Definition at line 243 of file product_integral.hpp.

◆ operator*() [3/3]

template<typename I1 , typename I2 , typename I3 >
requires is_integral_v<I3>
constexpr auto limes::expr::operator* ( ProductIntegral< I1, I2 > const &  pi,
I3 const &  i3 
)
constexpr

Multiply ProductIntegral with another integral.

Definition at line 236 of file product_integral.hpp.

◆ over_box()

template<typename E , std::size_t Dims>
constexpr auto limes::expr::over_box ( expr,
std::array< std::pair< typename E::value_type, typename E::value_type >, Dims >  bounds 
)
constexpr

Create a box integral from an expression.

Definition at line 356 of file box_integral.hpp.

◆ product() [1/2]

template<typename I1 , typename I2 >
requires (EvaluableIntegral<I1> && EvaluableIntegral<I2>)
constexpr auto limes::expr::product ( I1 const &  i1,
I2 const &  i2 
)
constexpr

Create a product of two independent integrals.

Template Parameters
I1First integral type
I2Second integral type
Parameters
i1First integral
i2Second integral
Returns
ProductIntegral<I1, I2>
Example
auto IJ = product(I, J); // Equivalent to I * J
constexpr auto product(E body, int lo, int hi)

Definition at line 276 of file product_integral.hpp.

◆ product() [2/2]

template<typename I1 , typename I2 , typename... Is>
requires (EvaluableIntegral<I1> && EvaluableIntegral<I2> && (EvaluableIntegral<Is> && ...))
constexpr auto limes::expr::product ( I1 const &  i1,
I2 const &  i2,
Is const &...  is 
)
constexpr

Create a product of multiple independent integrals.

Template Parameters
I1First integral type
I2Second integral type
IsAdditional integral types
Returns
Nested ProductIntegral
Example
auto IJK = product(I, J, K); // Equivalent to I * J * K

Definition at line 295 of file product_integral.hpp.

References limes::expr::product().

Variable Documentation

◆ are_independent_integrals_v

template<typename I1 , typename I2 >
constexpr bool limes::expr::are_independent_integrals_v
inlineconstexpr
Initial value:
=
(detail::integral_variable_set_v<I1> & detail::integral_variable_set_v<I2>) == 0

Check if multiplying integrals is valid (they must be over independent dimensions)

Definition at line 253 of file product_integral.hpp.

◆ is_box_integral_v

template<typename T >
constexpr bool limes::expr::is_box_integral_v = is_box_integral<T>::value
inlineconstexpr

Definition at line 395 of file box_integral.hpp.

◆ is_constrained_box_integral_v

template<typename T >
constexpr bool limes::expr::is_constrained_box_integral_v = is_constrained_box_integral<T>::value
inlineconstexpr

Definition at line 404 of file box_integral.hpp.

◆ is_derivative_builder_v

template<typename T >
constexpr bool limes::expr::is_derivative_builder_v = is_derivative_builder<T>::value
inlineconstexpr

Definition at line 166 of file derivative_builder.hpp.

◆ is_integral_v

template<typename T >
constexpr bool limes::expr::is_integral_v = is_integral<T>::value
inlineconstexpr

Definition at line 114 of file integral.hpp.

◆ is_product_integral_v

template<typename T >
constexpr bool limes::expr::is_product_integral_v = is_product_integral<T>::value
inlineconstexpr

Definition at line 209 of file product_integral.hpp.