I want to minimize a non-linear function $f(x)$ using Newton's method. At each optimization step, I compute a descent direction $d$ to update $x$ using a second-order approximation of $f(x)$:
$$ \nabla^2f(x) \ d = -\nabla f(x) $$
So I need to solve a linear system, but the Hessian matrix $\nabla^2f(x)$ might not be positive definite which could give me an invalid descent direction. I want to run conjugate gradient to solve the linear system. In the conjugate gradient method, one of the steps involves this operation $v^T \nabla^2\ f(x)\ v$ (computing $\alpha$ according to Shewchuk's notes, page 50 https://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf , I'm using $v$ rather than $d$ because in my convention $d$ is the descent direction to update $x$). I could recycle this operation to know if the Hessian is not positive definite (if such operation is negative).
I implemented my algorithm like that, so as soon as I detect that operation is negative, I stop the CG solver and return the solution iterated up to that point. I've actually seen it works pretty well in practice, but I have no rigorous justification for doing it. I remember hearing / reading people saying that each CG iteration takes care of different eigenvalues in order of "importance", so by stopping early you end up exploring the positive definite part of the Hessian. Can anybody point me to a more rigorous justification of this? Is this a valid way to enforce positive definiteness using CG for non-linear optimization?