41template <concepts::distance_function DistanceFunction>
67 void compute(
const std::vector<variable_type>& variables,
69 const std::size_t num_samples = variables.size();
71 num_samples > 0,
"Sample points must be given.");
74 for (std::size_t i = 0; i < num_samples; ++i) {
75 auto min_distance = std::numeric_limits<scalar_type>::max();
76 for (std::size_t j = 0; j < num_samples; ++j) {
79 distance_function(variables[i], variables[j]);
80 if (distance < min_distance) {
81 min_distance = distance;
85 if (min_distance > max_min_distance) {
86 max_min_distance = min_distance;
118 "Scale of length parameters must be a positive number.");
global_length_parameter_calculator()=default
Constructor.
DistanceFunction distance_function_type
Type of the distance function.
static constexpr auto default_scale
Default value of the scalar of length parameters.
void scale(scalar_type value)
Set the scale of length parameters.
static constexpr bool uses_global_length_parameter
Whether this calculator uses the globally fixed length parameters.
scalar_type scale_
Scale of length parameters.
typename DistanceFunction::value_type scalar_type
Type of scalars.
void compute(const std::vector< variable_type > &variables, const distance_function_type &distance_function)
Compute the length parameters.
auto scale() const noexcept -> scalar_type
Get the current scale of length parameters.
scalar_type length_parameter_
Length parameter.
typename DistanceFunction::variable_type variable_type
Type of variables.
auto length_parameter_at(index_type i) const -> scalar_type
Get the length parameter at a point.
Definition of distance_function concept.
Definition of exceptions.
Definition of index_type type.
Definition of macros for logging.
std::ptrdiff_t index_type
Type of indices in this library.
Namespace of calculators of length parameters.
Definition of NUM_COLLECT_PRECONDITION macro.
#define NUM_COLLECT_PRECONDITION(CONDITION,...)
Check whether a precondition is satisfied and throw an exception if not.