common load function for bfgs & gd