66template <
typename FunctionSignature,
89template <
typename Variable,
typename FunctionValue,
concepts::rbf RBF,
93 requires std::is_same_v<Variable,
94 typename DistanceFunction::variable_type> &&
95 std::is_same_v<
typename DistanceFunction::value_type,
96 typename RBF::scalar_type> &&
97 std::is_same_v<DistanceFunction,
98 typename LengthParameterCalculator::distance_function_type>
100 DistanceFunction, LengthParameterCalculator>
119 static constexpr bool uses_global_length_parameter =
120 length_parameter_calculator_type::uses_global_length_parameter;
128 KernelMatrixType, uses_global_length_parameter>;
132 typename kernel_matrix_solver_type::kernel_matrix_type;
138 static constexpr index_type default_max_mle_evaluations = 20;
150 distance_function_(
std::move(distance_function)),
151 rbf_(
std::move(rbf)) {}
162 void compute(
const std::vector<variable_type>& variables,
165 length_parameter_calculator_, variables, kernel_matrix_);
166 kernel_matrix_solver_.compute(kernel_matrix_, function_values);
167 kernel_matrix_solver_.solve(coeffs_, reg_param, function_values);
168 variables_ = &variables;
180 for (std::size_t i = 0; i < variables_->size(); ++i) {
182 distance_function_(variable, (*variables_)[i]) /
183 length_parameter_calculator_.length_parameter_at(
186 if (distance_rate < rbf_type::support_boundary()) {
187 value += coeffs_(
static_cast<index_type>(i)) *
192 coeffs_(
static_cast<index_type>(i)) * rbf_(distance_rate);
204 length_parameter_calculator_.scale(value);
220 const std::vector<variable_type>& variables,
222 index_type max_mle_evaluations = default_max_mle_evaluations)
223 requires uses_global_length_parameter
227 auto objective_function =
228 [
this, &variables, &function_values](
231 this->length_parameter_calculator_.scale(scale);
233 this->length_parameter_calculator_, variables,
234 this->kernel_matrix_);
235 this->kernel_matrix_solver_.compute(
236 this->kernel_matrix_, function_values);
238 this->kernel_matrix_solver_.calc_mle_objective(reg_param));
241 using objective_function_object_type =
decltype(objective_function);
242 using objective_function_wrapper_type =
244 objective_function_object_type>;
245 using optimizer_type =
248 optimizer_type optimizer{
249 objective_function_wrapper_type{objective_function}};
250 configure_child_algorithm_logger_if_exists(optimizer);
253 optimizer.max_evaluations(max_mle_evaluations);
254 optimizer.init(lower_boundary, upper_boundary);
260 "Selected an optimized scale of length parameters: {}", scale);
261 this->length_parameter_calculator_.scale(scale);
271 return distance_function_;
279 [[nodiscard]]
auto rbf() const noexcept -> const
rbf_type& {
return rbf_; }
288 return length_parameter_calculator_;
296 [[nodiscard]]
auto coeffs() const noexcept
319 return kernel_matrix_solver_;
341 const std::vector<variable_type>* variables_{
nullptr};
360template <
typename FunctionSignature,
362 rbfs::gaussian_rbf<impl::get_default_scalar_type<FunctionSignature>>,
364 concepts::distance_function DistanceFunction =
365 distance_functions::euclidean_distance_function<
368 rbf_interpolator<FunctionSignature, RBF, KernelMatrixType, DistanceFunction,
381template <
typename FunctionSignature,
389 rbf_interpolator<FunctionSignature, RBF, KernelMatrixType, DistanceFunction,
402template <
typename FunctionSignature,
Class of tags of logs without memory management.
Class to incorporate logging in algorithms.
Class of dividing rectangles (DIRECT) method jones1993 for optimization.
Wrapper class of a function object to use as an objective function.
Class to calculate Euclidean distance.
Class to calculate length parameters for RBF using global fixed length parameter.
Class to calculate length parameters for RBF using length parameters localized for each sample point.
auto coeffs() const noexcept -> const function_value_vector_type &
Get the coefficients for samples points.
distance_function_type distance_function_
Distance function.
Eigen::VectorX< function_value_type > function_value_vector_type
Type of vectors of function values.
DistanceFunction distance_function_type
Type of the distance function.
LengthParameterCalculator length_parameter_calculator_type
Type of the calculator of length parameters.
rbf_interpolator(distance_function_type distance_function=distance_function_type(), rbf_type rbf=rbf_type())
Constructor.
typename DistanceFunction::value_type kernel_value_type
Type of kernel values.
typename kernel_matrix_solver_type::kernel_matrix_type kernel_matrix_type
Type of kernel matrices.
auto variables() const noexcept -> const std::vector< variable_type > &
Get the variables.
void compute(const std::vector< variable_type > &variables, const function_value_vector_type &function_values)
Compute parameters for interpolation.
RBF rbf_type
Type of the RBF.
void fix_length_parameter_scale(kernel_value_type value)
Set the scale of length parameters to a fixed value.
Variable variable_type
Type of variables.
auto interpolate(const variable_type &variable) const -> function_value_type
Interpolate for a variable.
auto length_parameter_calculator() const noexcept -> const length_parameter_calculator_type &
Get the calculator of length parameters.
auto rbf() const noexcept -> const rbf_type &
Get the RBF.
void optimize_length_parameter_scale(const std::vector< variable_type > &variables, const function_value_vector_type &function_values, index_type max_mle_evaluations=default_max_mle_evaluations)
Set the scale of length parameters with optimization using MLE scheuerer2011.
auto kernel_matrix_solver() const noexcept -> const kernel_matrix_solver_type &
Get the solver of the linear equation of kernel matrix.
auto distance_function() const noexcept -> const distance_function_type &
Get the distance function.
FunctionValue function_value_type
Type of function values.
Class to interpolate using RBF.
Class of Gaussian RBF fornberg2015.
Class of Wendland's Compactly Supported RBF wendland1995.
Definition of compute_kernel_matrix function.
Concept of CSRBFs (compactly supported RBFs).
Concept of distance functions.
Concept of calculator of length parameters.
Definition of csrbf concept.
Definition of distance_function concept.
Definition of dividing_rectangles class.
Definition of euclidean_distance_function class.
Definition of function_object_wrapper class.
Definition of gaussian_rbf class.
Definition of get_default_scalar_type type.
Definition of get_variable_type class.
Definition of global_length_parameter_calculator class.
Definition of index_type type.
Definition of kernel_matrix_solver class.
Definition of kernel_matrix_type enumeration.
Definition of length_parameter_calculator concept.
Definition of local_length_parameter_calculator class.
Definition of log_tag_view class.
Definition of macros for logging.
#define NUM_COLLECT_LOG_DEBUG(LOGGER,...)
Write a debug log.
Definition of logging_mixin class.
std::ptrdiff_t index_type
Type of indices in this library.
typename get_variable_type< FunctionSignature >::type get_variable_type_t
Get the type of variables from function signature.
typename distance_functions::euclidean_distance_function< impl::get_variable_type_t< FunctionSignature > >::value_type get_default_scalar_type
Get the default type of scalars from function signature.
Namespace of RBF interpolation.
kernel_matrix_type
Enumeration of types of kernel matrices.
constexpr auto rbf_interpolator_tag
Tag of rbf_interpolator.
void compute_kernel_matrix(const DistanceFunction &distance_function, const RBF &rbf, LengthParameterCalculator &length_parameter_calculator, const std::vector< typename DistanceFunction::variable_type > &variables, KernelMatrix &kernel_matrix)
Compute a kernel matrix.
Definition of rbf concept.
Definition of wendland_csrbf class.