function [Bk,Hk]=SR1(ddf,Xk,df,f,Bk_old)

pt2=Xk(1,1);
pt3=Xk(2,1);
pr2=Xk(3,1);
pr3=Xk(4,1);


Bk_temp=eval(ddf);

[V,D]=eig(Bk_old);

if (D(1,1)<=0 || D(2,2)<=0 || D(3,3)<=0 || D(4,4)<=0)
    alpha=-1.5*min([D(1,1),D(2,2),D(3,3),D(4,4)]);
    
    Bk_old=Bk_old+alpha*eye(length(df));
end

gk_temp=eval(df);

pk=-inv(Bk_old)*gk_temp;

alpha_k=wolfe(Xk,f,pk,df);

sk=alpha_k*pk;

gk=eval(df);

temp=Xk+alpha_k*pk;
pt2=temp(1,1);
pt3=temp(2,1);
pr2=temp(3,1);
pr3=temp(4,1);

temp_gk=eval(df);

yk=temp_gk-gk;

rouk=1/(yk.'*sk);


r=1e-7;
if abs(sk.'*(yk-Bk_old*sk))>=r*norm(sk)*norm(yk-Bk_old*sk)
    Bk=Bk_old+(yk-Bk_old*sk)*(yk-Bk_old*sk).'/((yk-Bk_old*sk).'*sk);
    Hk=inv(Bk_old)+(sk-inv(Bk_old)*yk)*(sk-inv(Bk_old)*yk).'/((sk-inv(Bk_old)*yk).'*yk);
else Bk=Bk_old;
end







