% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/safeguards.R
\name{check_finite}
\alias{check_finite}
\title{Protect Against NaN/Inf in Function Evaluations}
\usage{
check_finite(f_value, g_value)
}
\arguments{
\item{f_value}{Function value to check}

\item{g_value}{Gradient vector to check}
}
\value{
Logical; TRUE if values are finite and valid, FALSE if NaN/Inf detected
}
\description{
Detects NaN or Inf values in function and gradient evaluations and attempts
recovery by increasing regularization to produce smaller steps.
}
\details{
This is a simple check function. The recovery logic (re-solving with larger sigma)
should be implemented in the main optimization loop.

Checks that:
\itemize{
\item Function value is finite (not NaN or Inf)
\item All gradient components are finite
}
}
\keyword{internal}
