limes 3.1.0
Composable Calculus Expressions for C++20
Loading...
Searching...
No Matches
product_integral.hpp File Reference

Separable integral composition for independent integrals. More...

#include <type_traits>
#include <cmath>
#include <utility>
#include "../algorithms/core/result.hpp"
#include "analysis.hpp"
+ Include dependency graph for product_integral.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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 > >
 

Namespaces

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

Concepts

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

Functions

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 std::uint64_t limes::expr::detail::integral_variable_set_v = integral_variable_set<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

Separable integral composition for independent integrals.

This module provides ProductIntegral for composing independent integrals. When two integrals depend on disjoint sets of variables, their product can be computed as the product of the individual results—a significant optimization.

Usage

using namespace limes::expr;
auto x = arg<0>;
auto y = arg<1>;
// Two independent integrals
auto I = integral(sin(x)).over<0>(0.0, 3.14159); // depends on x only
auto J = integral(exp(y)).over<1>(0.0, 1.0); // depends on y only
// Product integral: evaluates each separately, then multiplies
auto IJ = I * J;
auto result = IJ.eval(); // Much faster than nested integration!
// Chaining
auto z = arg<2>;
auto K = integral(cos(z)).over<2>(0.0, 1.0);
auto IJK = I * J * K;
Expression layer for composable calculus.
Definition analysis.hpp:7
Compile-time Independence Check
The library uses variable_set analysis to verify at compile time that the integrals are over disjoint variable sets. If they share variables, compilation fails with a clear error message.
See also
ProductIntegral The composition type
product() Variadic factory function
are_independent_integrals_v Compile-time independence check

Definition in file product_integral.hpp.