% Function to calculate the Hessian of r to to the entries of projection
% matrix A.
%
% Input:
%    A = the projection matrix (n by n matrix)
%    DA = D[vecA;theta] (n^2 by s matrix)
%
% Function outputs result of Equation (40) (n^2 by n^2 matrix).
%

function H = Hr_A(A)

[lambda, w, v] = domeig(A);

H = -1/lambda^2*kron(w*w', v*v') + 1/lambda*Hlambda_A(A); % Eq (40)

end