Skip to content

Commit c7ba441

Browse files
committed
Checks should rely on whether the grid has been initialized
1 parent 1fff9e2 commit c7ba441

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

include/kde1d/kde1d.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,15 +814,15 @@ Kde1d::check_xmin_xmax(const double& xmin, const double& xmax) const
814814
inline void
815815
Kde1d::check_fitted() const
816816
{
817-
if (std::isnan(loglik_)) {
817+
if (grid_.get_grid_points().size() == 0) {
818818
throw std::runtime_error("You must first fit the KDE to data.");
819819
}
820820
}
821821

822822
inline void
823823
Kde1d::check_notfitted() const
824824
{
825-
if (!std::isnan(loglik_)) {
825+
if (grid_.get_grid_points().size() > 0) {
826826
throw std::runtime_error(
827827
"This method can't be used for already fitted objects.");
828828
}

0 commit comments

Comments
 (0)