From e7fe093ba3c61275fe75a93d1b2dd4e05417b2f6 Mon Sep 17 00:00:00 2001 From: Weslley da Silva Pereira Date: Tue, 9 Jul 2024 10:59:05 -0600 Subject: [PATCH] Fix bug when updating the RBF coefficients --- blackboxopt/rbf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/blackboxopt/rbf.py b/blackboxopt/rbf.py index c9d2f50..3588a93 100644 --- a/blackboxopt/rbf.py +++ b/blackboxopt/rbf.py @@ -546,21 +546,21 @@ def hessp(self, x: np.ndarray, p: np.ndarray) -> np.ndarray: return y.flatten() def update_coefficients( - self, fx: np.ndarray, filter: Optional[RbfFilter] = None + self, fx, filter: Optional[RbfFilter] = None ) -> None: """Updates the coefficients of the RBF model. Parameters ---------- - fx : np.ndarray + fx : array-like Function values on the sampled points. filter : RbfFilter | None, optional Filter used with the function values. The default is None, which means the filter used in the initialization of the RBF model is used. """ - if fx.size <= self._m: - self.get_fsamples()[self._m - fx.size : self._m] = fx + if len(fx) <= self._m: + self._fx[self._m - len(fx) : self._m] = fx else: raise ValueError("Invalid number of function values") if filter is None: