stop when gradient norm is too small
This commit is contained in:
parent
e965dd0119
commit
67f71e0ac5
|
@ -881,10 +881,11 @@ lbfgs_fit(
|
||||||
/* parameters c1=1e-4 c2=0.9, alpha1=1.0, alphamax=10.0, step (for alpha)=1e-4*/
|
/* parameters c1=1e-4 c2=0.9, alpha1=1.0, alphamax=10.0, step (for alpha)=1e-4*/
|
||||||
//alphak=linesearch_nw(func,xk,pk,1.0,10.0,1e-4,0.9,x,m,n,1e-4,adata);
|
//alphak=linesearch_nw(func,xk,pk,1.0,10.0,1e-4,0.9,x,m,n,1e-4,adata);
|
||||||
//alphak=1.0;
|
//alphak=1.0;
|
||||||
/* check if step size is too small, then stop */
|
/* check if step size is too small, or nan, then stop */
|
||||||
if (fabs(alphak)<CLM_EPSILON) {
|
if (!isnormal(alphak) || fabs(alphak)<CLM_EPSILON) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update parameters xk1=xk+alpha_k *pk */
|
/* update parameters xk1=xk+alpha_k *pk */
|
||||||
my_dcopy(m,xk,1,xk1,1);
|
my_dcopy(m,xk,1,xk1,1);
|
||||||
my_daxpy(m,pk,alphak,xk1);
|
my_daxpy(m,pk,alphak,xk1);
|
||||||
|
|
|
@ -1023,6 +1023,11 @@ lbfgs_fit_robust(
|
||||||
/* parameters c1=1e-4 c2=0.9, alpha1=1.0, alphamax=10.0, step (for alpha)=1e-4*/
|
/* parameters c1=1e-4 c2=0.9, alpha1=1.0, alphamax=10.0, step (for alpha)=1e-4*/
|
||||||
//alphak=linesearch_nw(func_robust,xk,pk,1.0,10.0,1e-4,0.9,x,m,n,1e-4,adata);
|
//alphak=linesearch_nw(func_robust,xk,pk,1.0,10.0,1e-4,0.9,x,m,n,1e-4,adata);
|
||||||
//alphak=1.0;
|
//alphak=1.0;
|
||||||
|
/* check if step size is too small, or nan, then stop */
|
||||||
|
if (!isnormal(alphak) || fabs(alphak)<CLM_EPSILON) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* update parameters xk1=xk+alpha_k *pk */
|
/* update parameters xk1=xk+alpha_k *pk */
|
||||||
my_dcopy(m,xk,1,xk1,1);
|
my_dcopy(m,xk,1,xk1,1);
|
||||||
my_daxpy(m,pk,alphak,xk1);
|
my_daxpy(m,pk,alphak,xk1);
|
||||||
|
|
Loading…
Reference in New Issue