% File spqp.m for testing large scale quadprog - can use runspqp.m
rand('seed',100);
k=20;   % number of blocks in block structure
t = 400;  % size of each block
n=t*k;
rc=.5;
Q = sprandsym(n,.0006,rc,1);
f = randn( 1, n );
x=randn(n,1);
A=[];
for i=1:k,
     a = sprandn( t, t, .06 );
     A=blkdiag(A,a);
end
A=[A
  randn(k,size(A,2))];
  [m,n]=size(A);
spy(A);
disp(['spy: block diagonal A with lower rows full - hit return to continue']);
pause
indsn=randperm(n);
A=A(:,indsn);
spy(A);
disp(['spy: permuted A - hit return to continue']);
pause

%A = sprandn( m, n, .0006 );
%disp(['spy: random A ']);
%spy(A);

disp(['m and n are ',num2str([m n])]);
disp(['number of nonzeros in Q ',num2str(nnz(Q))]);
disp(['number of nonzeros in A ',num2str(nnz(A))]);
b = A*x+10*rand( m, 1 );

options=optimset('quadprog');     
options=optimset(options,'display','on');
options=optimset(options,'diagnostics','on');
tic; [x fval] = quadprog(Q,f,A,b,[],[],[],[],[],options); toc;


