clear;
load Q;
[n,m]=size(Q);
for r=1:m;
for i=1:n;
A(i,i)=Q(i,r);
for j=1:n;
s=n*i+j;
A(i,s)=-Q(i,r)*Q(j,r);
end
end
C(n*(r-1)+1:n*r,:)=A;
Y(n*(r-1)+1:n*r,1)=dQ(:,r);
end
lb=zeros(n*(n+1),1);
[x,resnorm,residual,exitflag,output,lambda] = lsqlin(C,Y,[],[],[ ],[ ],lb,[]);
save results x resnorm residual exitflag output lambda;