gradient descent for linear registration