53template <
typename Variable>
84template <
typename Signature>
94template <
typename Result, base::concepts::real_scalar Variable>
120 template <base::concepts::invocable_as<result_type(variable_type)> Function>
127 constexpr auto center_weight_rate =
static_cast<variable_type>(0.5);
128 const variable_type center_weight = width * center_weight_rate;
130 sum += function(center) * center_weight;
141 function(var_plus) + function(var_minus);
144 "A function value was not a finite value. "
145 "Stopped numerical integration.");
148 sum += function_values * weight;
168 template <base::concepts::invocable_as<result_type(variable_type)>
169 LeftBoundaryFunction,
170 base::concepts::invocable_as<result_type(variable_type)>
171 RightBoundaryFunction>
173 const LeftBoundaryFunction& left_boundary_function,
174 const RightBoundaryFunction& right_boundary_function,
179 const variable_type half_width = half<variable_type> * width;
181 constexpr auto center_weight_rate =
static_cast<variable_type>(0.5);
182 const variable_type center_weight = width * center_weight_rate;
184 sum += left_boundary_function(half_width) * center_weight;
193 left_boundary_function(variable_distance) +
194 right_boundary_function(-variable_distance);
197 "A function value was not a finite value. "
198 "Stopped numerical integration.");
201 sum += function_values * weight;
216 template <base::concepts::invocable_as<result_type(variable_type)> Function>
236 template <base::concepts::invocable_as<result_type(variable_type)>
237 LeftBoundaryFunction,
238 base::concepts::invocable_as<result_type(variable_type)>
239 RightBoundaryFunction>
241 const LeftBoundaryFunction& left_boundary_function,
242 const RightBoundaryFunction& right_boundary_function,
245 left_boundary_function, right_boundary_function, left, right);
256 this->
logger(),
"Maximum point must be a positive value.");
270 "Number of points must a positive integer.");
296 const variable_type denominator = one<variable_type> + exp_value;
299 exp_value / (denominator * denominator));
std::vector< variable_type > variable_rate_list_
List of rates of distances of points from the upper bound.
tanh_finite_integrator()
Constructor.
variable_type interval_
Interval of changed variable.
auto operator()(const LeftBoundaryFunction &left_boundary_function, const RightBoundaryFunction &right_boundary_function, variable_type left, variable_type right) const -> result_type
Integrate a function.
variable_type max_point_
Maximum point in changed variable.
auto integrate(const LeftBoundaryFunction &left_boundary_function, const RightBoundaryFunction &right_boundary_function, variable_type left, variable_type right) const -> result_type
Integrate a function.
auto integrate(const Function &function, variable_type left, variable_type right) const -> result_type
Integrate a function.
index_type points_
Number of points.
static constexpr index_type default_points
Default number of points.
void calculate_coefficients()
Calculate coefficients for integration.
auto max_point(variable_type val) -> tanh_finite_integrator &
Set maximum point in changed variable.
static constexpr auto default_max_point
Default maximum point in changed variable.
std::vector< variable_type > weight_rate_list_
List of rates of weights of points.
auto operator()(const Function &function, variable_type left, variable_type right) const -> result_type
Integrate a function.
std::decay_t< Result > result_type
Type of results.
std::decay_t< Variable > variable_type
Type of variables.
auto points(index_type val) -> tanh_finite_integrator &
Set number of points.
Class to perform numerical integration on finite range using TANH rule.
Class of tags of logs without memory management.
Class to incorporate logging in algorithms.
logging_mixin(log_tag_view tag)
Constructor.
auto logger() const noexcept -> const num_collect::logging::logger &
Access to the logger.
Class to add numbers using Kahan summation kahan1965.
auto sum() const noexcept -> const T &
Get sum.
Definition of exceptions.
Definition of index_type type.
Definition of invocable_as concept.
Definition of isfinite function.
Definition of kahan_adder class.
Definition of log_tag_view class.
Definition of macros for logging.
#define NUM_COLLECT_LOG_WARNING(LOGGER,...)
Write a warning log.
Definition of logging_mixin class.
std::ptrdiff_t index_type
Type of indices in this library.
auto isfinite(const T &val) -> bool
Check whether a number is finite.
constexpr T half
Value 0.5.
Namespace of internal implementations.
Namespace of numerical integration.
constexpr auto tanh_finite_integrator_tag
Tag of de_finite_integrator.
Definition of NUM_COLLECT_PRECONDITION macro.
#define NUM_COLLECT_PRECONDITION(CONDITION,...)
Check whether a precondition is satisfied and throw an exception if not.
Definition of real_scalar concept.
static constexpr double default_max_point
Default maximum point in changed variable.
static constexpr double default_max_point
Default maximum point in changed variable.
Helper class of constants for use in tanh_finite_integrator class.