%Generate positive semidefinite LCP

n = input('no of variables ');
m = input('rank of A ');
A = (rand(n,m) - rand(n,m))*10.0;
M = A*A';
for i=1:n
    for j=2:n
	tmp=rand(1,1)-rand(1,1);
	M(i,j)=M(i,j)+tmp;
	M(j,i)=M(j,i)-tmp;
    end
end
x=zeros(n,1);
y=zeros(n,1);
for i=1:n
    if     rand(1,1)>0.5
	x(i)=rand(1,1);
	y(i)=0.0;
    else
	x(i)=0.0;
	y(i)=rand(1,1);
    end
end
q=y-M*x;
save data M q n
save soln x y
end






