parallel gradient finally works
updating gradient descent to only periodically calculate the cost