From c7ba441814b8ee993558e41f66ee30cae6a684e5 Mon Sep 17 00:00:00 2001 From: Thibault Vatter Date: Fri, 15 Aug 2025 14:19:05 +0200 Subject: [PATCH] Checks should rely on whether the grid has been initialized --- include/kde1d/kde1d.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kde1d/kde1d.hpp b/include/kde1d/kde1d.hpp index e46d970..324ff28 100644 --- a/include/kde1d/kde1d.hpp +++ b/include/kde1d/kde1d.hpp @@ -814,7 +814,7 @@ Kde1d::check_xmin_xmax(const double& xmin, const double& xmax) const inline void Kde1d::check_fitted() const { - if (std::isnan(loglik_)) { + if (grid_.get_grid_points().size() == 0) { throw std::runtime_error("You must first fit the KDE to data."); } } @@ -822,7 +822,7 @@ Kde1d::check_fitted() const inline void Kde1d::check_notfitted() const { - if (!std::isnan(loglik_)) { + if (grid_.get_grid_points().size() > 0) { throw std::runtime_error( "This method can't be used for already fitted objects."); }