67 const RBF& rbf, LengthParameterCalculator& length_parameter_calculator,
68 const std::vector<typename DistanceFunction::variable_type>& variables,
69 KernelMatrix& kernel_matrix) {
70 using scalar_type =
typename KernelMatrix::Scalar;
72 length_parameter_calculator.compute(variables, distance_function);
74 const scalar_type length_parameter =
75 length_parameter_calculator.length_parameter_at(
81 const std::size_t num_variables = variables.size();
82 kernel_matrix.resize(
static_cast<index_type>(num_variables),
85 for (std::size_t i = 0; i < num_variables; ++i) {
88 for (std::size_t j = i + 1; j < num_variables; ++j) {
89 const scalar_type value =
90 rbf(distance_function(variables[i], variables[j]) /
126 const RBF& rbf, LengthParameterCalculator& length_parameter_calculator,
127 const std::vector<typename DistanceFunction::variable_type>& variables,
128 KernelMatrix& kernel_matrix) {
129 using scalar_type =
typename KernelMatrix::Scalar;
131 length_parameter_calculator.compute(variables, distance_function);
133 const std::size_t num_variables = variables.size();
134 kernel_matrix.resize(
static_cast<index_type>(num_variables),
137 for (std::size_t j = 0; j < num_variables; ++j) {
138 const scalar_type length_parameter =
139 length_parameter_calculator.length_parameter_at(
143 for (std::size_t i = 0; i < num_variables; ++i) {
144 const scalar_type value =
145 rbf(distance_function(variables[i], variables[j]) /
179 const RBF& rbf, LengthParameterCalculator& length_parameter_calculator,
180 const std::vector<typename DistanceFunction::variable_type>& variables,
181 KernelMatrix& kernel_matrix) {
182 using scalar_type =
typename KernelMatrix::Scalar;
184 length_parameter_calculator.compute(variables, distance_function);
187 kernel_matrix.resize(num_variables, num_variables);
189 const scalar_type support_boundary = RBF::support_boundary();
192 Eigen::Triplet<scalar_type, typename KernelMatrix::StorageIndex>>
194 for (
int j = 0; j < num_variables; ++j) {
195 const scalar_type length_parameter =
196 length_parameter_calculator.length_parameter_at(j);
199 for (
int i = 0; i < num_variables; ++i) {
200 const scalar_type distance_rate =
201 distance_function(variables[
static_cast<std::size_t
>(i)],
202 variables[
static_cast<std::size_t
>(j)]) /
204 if (distance_rate >= support_boundary) {
207 const scalar_type value = rbf(distance_rate);
208 triplets.emplace_back(i, j, value);
211 kernel_matrix.setFromTriplets(triplets.begin(), triplets.end());