gradient descent by CPP