31 throw std::runtime_error(kNotFittedErrorMessage);
39 throw std::runtime_error(kNotFittedErrorMessage);
42 set_evaluation_bbox_impl(geometry::bbox3d::from_points(points));
43 return evaluate_impl(points);
48 throw std::runtime_error(kNotFittedErrorMessage);
51 return evaluator_->evaluate(points);
55 double absolute_tolerance,
int max_iter = 32) {
56 auto min_n_points = std::max(index_t{1}, model_.poly_basis_size());
57 if (points.rows() < min_n_points) {
58 throw std::invalid_argument(
"points.rows() must be greater than or equal to " +
59 std::to_string(min_n_points) +
".");
62 if (values.rows() != points.rows()) {
63 throw std::invalid_argument(
"values.rows() must be equal to points.rows().");
66 if (absolute_tolerance <= 0.0) {
67 throw std::invalid_argument(
"absolute_tolerance must be greater than 0.0.");
73 weights_ = fitter.fit(values, absolute_tolerance, max_iter);
77 centers_bbox_ = geometry::bbox3d::from_points(centers_);
81 double absolute_tolerance,
int max_iter = 32) {
82 auto min_n_points = std::max(index_t{1}, model_.poly_basis_size());
83 if (points.rows() < min_n_points) {
84 throw std::invalid_argument(
"points.rows() must be greater than or equal to " +
85 std::to_string(min_n_points) +
".");
88 if (values.rows() != points.rows()) {
89 throw std::invalid_argument(
"values.rows() must be equal to points.rows().");
92 if (absolute_tolerance <= 0.0) {
93 throw std::invalid_argument(
"absolute_tolerance must be greater than 0.0.");
99 std::vector<index_t> center_indices;
100 std::tie(center_indices, weights_) = fitter.fit(values, absolute_tolerance, max_iter);
103 centers_ = points(center_indices, Eigen::all);
104 centers_bbox_ = geometry::bbox3d::from_points(centers_);
108 const valuesd& values_lb,
const valuesd& values_ub,
109 double absolute_tolerance,
int max_iter = 32) {
110 if (model_.nugget() > 0.0) {
111 throw std::runtime_error(
"Non-zero nugget is not supported.");
114 auto min_n_points = std::max(index_t{1}, model_.poly_basis_size());
115 if (points.rows() < min_n_points) {
116 throw std::invalid_argument(
"points.rows() must be greater than or equal to " +
117 std::to_string(min_n_points) +
".");
120 if (values.rows() != points.rows()) {
121 throw std::invalid_argument(
"values.rows() must be equal to points.rows().");
124 if (values_lb.rows() != points.rows()) {
125 throw std::invalid_argument(
"values_lb.rows() must be equal to points.rows().");
128 if (values_ub.rows() != points.rows()) {
129 throw std::invalid_argument(
"values_ub.rows() must be equal to points.rows().");
132 if (absolute_tolerance <= 0.0) {
133 throw std::invalid_argument(
"absolute_tolerance must be greater than 0.0.");
139 std::vector<index_t> center_indices;
140 std::tie(center_indices, weights_) =
141 fitter.fit(values, values_lb, values_ub, absolute_tolerance, max_iter);
144 centers_ = points(center_indices, Eigen::all);
145 centers_bbox_ = geometry::bbox3d::from_points(centers_);
150 throw std::runtime_error(kNotFittedErrorMessage);
155 evaluator_ = std::make_unique<interpolation::rbf_evaluator<>>(model_, centers_, union_bbox);
156 evaluator_->set_weights(weights_);
159 const valuesd& weights()
const {
161 throw std::runtime_error(kNotFittedErrorMessage);
172 weights_ = valuesd();
175 static constexpr const char* kNotFittedErrorMessage =
"The interpolant is not fitted yet.";
184 std::unique_ptr<interpolation::rbf_evaluator<>> evaluator_;