function [f,g,Hessian]=fun(x)

% Generates a sample cost function, f=0.5*dot(x,B*x)+dot(a,x).
% Here, B is a 10x10 symmetric positive defnite matrix and
% a is a column vector.

temp=load('problem.mat');
B=temp.ans.B;
a=temp.ans.a;

% B=B(1:5,1:5);
% a=a(1:5);

% B is initially a random matrix generated from a file, now I turn it into
% a symmetric positive definite matrix.

B=(B+B.')/2;
B=B/max(max(abs(B)));
B=(B.')*B;

f=0.5*dot(x,B*x)+dot(a,x);
g=B*x+a;

Hessian=B;


end