function [H]=hess_V(x,y,parms);
%still not sure if we can use langevin

x0=parms(:,1);  y0=parms(:,2);
R1=parms(:,3);  R2=parms(:,4);
theta=parms(:,5); gamma=parms(:,6); w=parms(:,7); 
Q=0;dq=0; dz=0; GV=zeros(2,1);
for i=1:length(R1)
   R=[cos(theta(i)) sin(theta(i)); -sin(theta(i)) cos(theta(i))];
   S=[R1(i)^2 0 ; 0 R2(i)^2];
   G=R'*S^-1*R;
   G
   %disp ( ['gamma:',num2str(G) ] )
   G_h=0.5*gamma(i)*G;
   q=[x-x0(i);y-y0(i)];
   s_i=G_h*q;
%   Q = Q + 2*pi/gamma(i)/ sqrt( det(G) );
   g_i=w(i)*exp(-q'*G_h*q);
   for j=1:2
     for k=1:2
       H( j , k ) = g_i * (-2*s_i(j)*s_i(k) + g_i * G_h(j,k) ) ;  
     end
   end
   dz=dz + g_i;
%   keyboard;
end

H=2*H/dz;

%%computing eigenvalues

[U,L]=eig(H)
test=U*L*U';


dot(U(:,1),U(:,2))

R1
R2

R_re_1 = diag( U(:,1)*L(1,1)^-1*U(:,1)' )
sqrt( sum(R_re_1.^2) )
R_re_2 = diag( U(:,2)*L(2,2)^-1*U(:,2)' )
sqrt( sum(R_re_2.^2) )
dot(R_re_1,R_re_2);









