Calculates an approximation to the Newton-Raphson search direction using past gradients to build a serviceable substitute to a Hessian. The Hessian matrix is never explicitly formed or inverted. This function is the implementation from section 4 of http://dx.doi.org/10.1090/S0025-5718-1980-0572855-7
dx_hist - history of x increments, bookshelf array dg_hist - history of gradient increments, bookshelf array g - current gradient
direction - LBFGS approximation to the search direction
The L-BFGS algorithm is the default of fminnewton.m, and is a good mix of computational efficiency and fast convergence.