Gradient with regularization