protected boolean computeStep ( double lambda , DMatrixRMaj gradient , DMatrixRMaj step ) { final double mixture = config . mixture ; for ( int i = 0 ; i < diagOrig . numRows ; i ++ ) { double v = min ( config . diagonal_max , max ( config . diagonal_min , diagOrig . data [ i ] ) ) ; diagStep . data [ i ] = v + lambda * ( mixture + ( 1.0 - mixture ) * v ) ; } hessian . setDiagonals ( diagStep ) ; if ( ! hessian . initializeSolver ( ) ) { return false ; } // In the book formulation it solves something like (B + lambda*I)*p = -g // but we don't want to modify g, so we apply the negative to the step instead if ( hessian . solve ( gradient , step ) ) { CommonOps_DDRM . scale ( - 1 , step ) ; return true ; } else { return false ; } }
Adjusts the Hessian s diagonal elements value and computes the next step