# Orthogonal Matching Pursuit with Newton step

I'm implementing the Orthogonal Matching Pursuit algorithm with Newton step refinement.

However, it doesn't work because sometimes I obtain a negative Hessian matrix. I've already tried with both with adding an identity matrix and with using the LDL factorization and changing the negative entries of matrix D but these don't help.

In the code published by the author of the method (https://bitbucket.org/wcslspectralestimation/continuous-frequency-estimation/src/NOMP/), I found these lines:

% UPDATE OMEGA
if der2 > 0
omega_next = omega - der1/der2;
else
omega_next = omega - sign(der1)*(1/4)*(2*pi/N)*rand(1);
end


where der2 is the second order derivative.

I can't understand the reason behind the update:

omega_next = omega - sign(der1)*(1/4)*(2*pi/N)*rand(1)


Could you please give some intuition about it?

Moreover, I'm applying this method to a vector not to a scalar as in the example, therefore I'd like to understand the logic behind the update.

Thanks.