Go to the source code of this file.
|
| template<class function_2d_t > |
| double | qx::integrate_rectangle_rule (const function_2d_t &func, double x0, double x1, size_t nIntervalsPer1=10) noexcept(noexcept(static_cast< double >(func(0.0)))) |
| | Integrate using rectangle rule. More...
|
| |
| template<class function_2d_t > |
| double | qx::integrate_trapezoid_rule (const function_2d_t &func, double x0, double x1, size_t nIntervalsPer1=10) noexcept(noexcept(static_cast< double >(func(0.0)))) |
| | Integrate using trapezoid rule. More...
|
| |
| template<class function_2d_t > |
| double | qx::integrate_adaptive_midpoint (const function_2d_t &func, double x0, double x1, double fMaxSliceError, size_t nIntervalsPer1=10, size_t nMaxRecursion=300) noexcept(noexcept(static_cast< double >(func(0.0)))) |
| | Integrate using adaptive midpoint. More...
|
| |
| template<class function_2d_t > |
| double | qx::integrate_monte_carlo (const function_2d_t &funcIsInside, glm::dvec2 pos0, glm::dvec2 pos1, size_t nPointsPerOneSquare=1000) noexcept(noexcept(static_cast< int >(funcIsInside(0.0, 0.0)))) |
| | Integrate using probabilistic algorithm Monte Carlo. More...
|
| |
- Author
- Khrapov
- Date
- 29.04.2023
- Copyright
- (c) Nick Khrapov, 2023. All right reserved.
Definition in file integration.inl.
◆ integrate_adaptive_midpoint()
template<class function_2d_t >
| double qx::integrate_adaptive_midpoint |
( |
const function_2d_t & |
func, |
|
|
double |
x0, |
|
|
double |
x1, |
|
|
double |
fMaxSliceError, |
|
|
size_t |
nIntervalsPer1 = 10, |
|
|
size_t |
nMaxRecursion = 300 |
|
) |
| |
|
inlinenoexcept |
Integrate using adaptive midpoint.
Supports reversed bounds; noexcept depends on the callback.
- Parameters
-
| func | - target function |
| x0 | - left border |
| x1 | - right border |
| fMaxSliceError | - max error per one slice |
| nIntervalsPer1 | - number of intervals per dx = 1 |
| nMaxRecursion | - max recursion depth @tpara m function_2d_t - function that takes double and returns double |
- Return values
-
| - | approximate integral; 0 for zero extent; NaN for invalid bounds, zero density or sample count overflow |
Definition at line 86 of file integration.inl.
◆ integrate_monte_carlo()
template<class function_2d_t >
| double qx::integrate_monte_carlo |
( |
const function_2d_t & |
funcIsInside, |
|
|
glm::dvec2 |
pos0, |
|
|
glm::dvec2 |
pos1, |
|
|
size_t |
nPointsPerOneSquare = 1000 |
|
) |
| |
|
inlinenoexcept |
Integrate using probabilistic algorithm Monte Carlo.
Supports reversed bounds; noexcept depends on the callback.
- Parameters
-
| funcIsInside | - func that returns 1 if point is inside shape with positive value 0 if point is not inside shape -1 if point is inside shape with negative value |
| pos0 | - left down corner coordinates |
| pos1 | - right up corner coordinates |
| nPointsPerOneSquare | - points per 1 square (more is better) |
- Template Parameters
-
| function_2d_t | - function that takes double and returns double |
- Return values
-
| - | approximate integral; 0 for zero area; NaN for invalid bounds, zero density or sample count overflow |
Definition at line 149 of file integration.inl.
◆ integrate_rectangle_rule()
template<class function_2d_t >
| double qx::integrate_rectangle_rule |
( |
const function_2d_t & |
func, |
|
|
double |
x0, |
|
|
double |
x1, |
|
|
size_t |
nIntervalsPer1 = 10 |
|
) |
| |
|
inlinenoexcept |
Integrate using rectangle rule.
Supports reversed bounds; noexcept depends on the callback.
- Parameters
-
| func | - target function |
| x0 | - left border |
| x1 | - right border |
| nIntervalsPer1 | - number of intervals per dx = 1 @tpara m function_2d_t - function that takes double and returns double |
- Return values
-
| - | approximate integral; 0 for zero extent; NaN for invalid bounds, zero density or sample count overflow |
Definition at line 36 of file integration.inl.
◆ integrate_trapezoid_rule()
template<class function_2d_t >
| double qx::integrate_trapezoid_rule |
( |
const function_2d_t & |
func, |
|
|
double |
x0, |
|
|
double |
x1, |
|
|
size_t |
nIntervalsPer1 = 10 |
|
) |
| |
|
inlinenoexcept |
Integrate using trapezoid rule.
Supports reversed bounds; noexcept depends on the callback.
- Parameters
-
| func | - target function |
| x0 | - left border |
| x1 | - right border |
| nIntervalsPer1 | - number of intervals per dx = 1 |
- Template Parameters
-
| function_2d_t | - function that takes double and returns double |
- Return values
-
| - | approximate integral; 0 for zero extent; NaN for invalid bounds, zero density or sample count overflow |
Definition at line 61 of file integration.inl.