diff --git a/src/lib/Dirac/lbfgs_nocuda.c b/src/lib/Dirac/lbfgs_nocuda.c index a3c75b0..edcd8b4 100644 --- a/src/lib/Dirac/lbfgs_nocuda.c +++ b/src/lib/Dirac/lbfgs_nocuda.c @@ -677,6 +677,14 @@ linesearch( #ifdef DEBUG printf("mu=%lf, alpha1=%lf\n",mu,alpha1); #endif + /* catch if not finite (deltaphi=0 or nan) */ + if (!isnormal(mu)) { + free(xp); +#ifdef DEBUG + printf("line interval too small\n"); +#endif + return mu; + } ci=1; alphai=alpha1; /* initial value for alpha(i) : check if 0CLM_STOP_THRESH) { /* mult with hessian pk=-H_k*gk */ if (ck