completed cost/gradient w/ regularization.