function [lun,kprint,ipass]=sbocqx(lun,kprint,ipass);
persistent bl bl1 bu bu1 c d firstCall i ib ind iopt irhs itest_v iw j mcon mdw mode mpass mrows msg ncols rhs rnorm rnormc rw sr w x xtrue ; if isempty(firstCall),firstCall=1;end;
if isempty(i), i=0; end;
if isempty(ib), ib=0; end;
if isempty(irhs), irhs=0; end;
if isempty(itest_v), itest_v=0; end;
if isempty(j), j=0; end;
if isempty(mcon), mcon=0; end;
if isempty(mdw), mdw=0; end;
if isempty(mode), mode=0; end;
if isempty(mpass), mpass=0; end;
if isempty(mrows), mrows=0; end;
if isempty(ncols), ncols=0; end;
if isempty(rnorm), rnorm=0; end;
if isempty(rnormc), rnormc=0; end;
if isempty(sr), sr=0; end;
if isempty(d), d=zeros(6,5); end;
if isempty(w), w=zeros(11,11); end;
if isempty(bl), bl=zeros(5,2); end;
if isempty(bu), bu=zeros(5,2); end;
if isempty(x), x=zeros(1,30); end;
if isempty(rw), rw=zeros(1,55); end;
if isempty(xtrue), xtrue=zeros(1,9); end;
if isempty(c), c=zeros(5,5); end;
if isempty(bl1), bl1=zeros(1,10); end;
if isempty(bu1), bu1=zeros(1,10); end;
if isempty(ind), ind=zeros(1,10); end;
if isempty(iw), iw=zeros(1,20); end;
if isempty(iopt), iopt=zeros(1,40); end;
if isempty(rhs), rhs=zeros(6,2); end;
if isempty(msg), msg=repmat(' ',1,4); end;
if firstCall, c=[1.,10.,4.,8.,1.,1.,10.,2.,-1.,1.,1.,-3.,-3.,2.,1.,1.,5.,5.,5.,1.,1.,4.,-1.,-3.,1.]; end;
if firstCall, d=[-74.,14.,66.,-12.,3.,4.,80.,-69.,-72.,66.,8.,-12.,18.,21.,-5.,-30.,-7.,4.,-11.,28.,7.,-23.,-4.,4.,-4.,0.,1.,3.,1.,0.]; end;
if firstCall, bl=[1.,0.,-1.,1.,-4.,-1.,0.,-3.,1.,-6.]; end;
if firstCall, bu=[3.,2.,1.,3.,-2.,3.,4.,1.,5.,-2.]; end;
if firstCall, rhs=[51.,-61.,-56.,69.,10.,-12.,-5.,-9.,708.,4165.,-13266.,8409.]; end;
if firstCall, xtrue=[1.,2.,-1.,3.,-4.,1.,32.,30.,31.]; end;bl=reshape(bl,[5,2]);bu=reshape(bu,[5,2]);c=reshape(c,[5,5]);d=reshape(d,[6,5]);rhs=reshape(rhs,[6,2]);
firstCall=0;
%!!DATA ((c(i,j),i=1,5),j=1,5)/1. , 10. , 4. , 8. , 1. , 1. , 10. ,%!!2. , -1. , 1. , 1. , -3. , -3. , 2. , 1. , 1. , 5. , 5. ,%!!5. , 1. , 1. , 4. , -1. , -3. , 1./
%!!DATA ((d(i,j),i=1,6),j=1,5)/ - 74. , 14. , 66. , -12. , 3. , 4. ,%!!80. , -69. , -72. , 66. , 8. , -12. , 18. , 21. , -5. ,%!!-30. , -7. , 4. , -11. , 28. , 7. , -23. , -4. , 4. , -4. ,%!!0. , 1. , 3. , 1. , 0./
%!!DATA ((bl(i,j),i=1,5),j=1,2)/1. , 0. , -1. , 1. , -4. , -1. , 0. ,%!!-3. , 1. , -6./
%!!DATA ((bu(i,j),i=1,5),j=1,2)/3. , 2. , 1. , 3. , -2. , 3. , 4. ,%!!1. , 5. , -2./
%!!DATA ((rhs(i,j),i=1,6),j=1,2)/51. , -61. , -56. , 69. , 10. ,%!!-12. , -5. , -9. , 708. , 4165. , -13266. , 8409./
%!!DATA (xtrue(j),j=1,9)/1. , 2. , -1. , 3. , -4. , 1. , 32. , 30. ,%!!31./
mdw = 11;
mrows = 6;
ncols = 5;
mcon = 4;
iopt(1) = 99;
ipass = 1;
itest_v = 0;
if( kprint>=2 )
writef(lun,[' TEST IB IRHS SR' ' \n']);
end;
%format (' TEST IB IRHS SR');
for ib = 1 : 2;
for irhs = 1 : 2;
for j = 1 : ncols;
[mrows,d(sub2ind(size(d),1,j):end),dumvar3,w(sub2ind(size(w),1,j):end)]=scopy(mrows,d(sub2ind(size(d),1,j):end),1,w(sub2ind(size(w),1,j):end),1);
end; j = fix(ncols+1);
[mrows,rhs(sub2ind(size(rhs),1,irhs):end),dumvar3,w(sub2ind(size(w),1,ncols+1):end)]=scopy(mrows,rhs(sub2ind(size(rhs),1,irhs):end),1,w(sub2ind(size(w),1,ncols+1):end),1);
for j = 1 : ncols;
ind(j) = 3;
end; j = fix(ncols+1);
[w,mdw,mrows,ncols,bl(sub2ind(size(bl),1,ib):end),bu(sub2ind(size(bu),1,ib):end),ind,iopt,x,rnorm,mode,rw,iw]=sbols(w,mdw,mrows,ncols,bl(sub2ind(size(bl),1,ib):end),bu(sub2ind(size(bu),1,ib):end),ind,iopt,x,rnorm,mode,rw,iw);
for j = 1 : ncols;
x(j) = x(j) - xtrue(j);
end; j = fix(ncols+1);
[sr ,ncols,x]=snrm2(ncols,x,1);
mpass = 1;
if( sr>10.0e3.*sqrt(r1mach(4)) )
mpass = 0;
end;
ipass = fix(ipass.*mpass);
if( kprint>=2 )
msg = 'PASS';
if( mpass==0 )
msg = 'FAIL';
end;
itest_v = fix(itest_v + 1);
writef(lun,[repmat('%5i',1,3),repmat('%f',1,1),'%20.6f',' TEST ','%s','ED.' ' \n'], itest_v , ib , irhs , sr , msg);
end;
end; irhs = fix(2+1);
end; ib = fix(2+1);
for ib = 1 : 2;
for irhs = 1 : 2;
[dumvar1,dumvar2,dumvar3,w]=scopy(11.*10,0.0e0,0,w,1);
[ncols,bl(sub2ind(size(bl),1,ib):end),dumvar3,bl1]=scopy(ncols,bl(sub2ind(size(bl),1,ib):end),1,bl1,1);
[ncols,bu(sub2ind(size(bu),1,ib):end),dumvar3,bu1]=scopy(ncols,bu(sub2ind(size(bu),1,ib):end),1,bu1,1);
ind(ncols+1) = 2;
ind(ncols+2) = 1;
ind(ncols+3) = 2;
ind(ncols+4) = 3;
bu1(ncols+1) = 5.;
bl1(ncols+2) = 20.;
bu1(ncols+3) = 30.;
bl1(ncols+4) = 11.;
bu1(ncols+4) = 40.;
for j = 1 : ncols;
[mcon,c(sub2ind(size(c),1,j):end),dumvar3,w(sub2ind(size(w),1,j):end)]=scopy(mcon,c(sub2ind(size(c),1,j):end),1,w(sub2ind(size(w),1,j):end),1);
[mrows,d(sub2ind(size(d),1,j):end),dumvar3,w(sub2ind(size(w),mcon+1,j):end)]=scopy(mrows,d(sub2ind(size(d),1,j):end),1,w(sub2ind(size(w),mcon+1,j):end),1);
end; j = fix(ncols+1);
[mrows,rhs(sub2ind(size(rhs),1,irhs):end),dumvar3,w(sub2ind(size(w),mcon+1,ncols+1):end)]=scopy(mrows,rhs(sub2ind(size(rhs),1,irhs):end),1,w(sub2ind(size(w),mcon+1,ncols+1):end),1);
iopt(01) = 2;
iopt(02) = 11;
iopt(03) = 11;
iopt(04) = 10;
iopt(05) = 30;
iopt(06) = 55;
iopt(07) = 20;
iopt(08) = 40;
iopt(09) = 99;
[w,mdw,mcon,mrows,ncols,bl1,bu1,ind,iopt,x,rnormc,rnorm,mode,rw,iw]=sbocls(w,mdw,mcon,mrows,ncols,bl1,bu1,ind,iopt,x,rnormc,rnorm,mode,rw,iw);
for j = 1 : ncols + mcon;
x(j) = x(j) - xtrue(j);
end; j = fix(ncols + mcon+1);
[sr ,dumvar2,x]=snrm2(ncols+mcon,x,1);
mpass = 1;
if( sr>10.0e3.*sqrt(r1mach(4)) )
mpass = 0;
end;
ipass = fix(ipass.*mpass);
if( kprint>=2 )
msg = 'PASS';
if( mpass==0 )
msg = 'FAIL';
end;
itest_v = fix(itest_v + 1);
writef(lun,[repmat('%5i',1,3),repmat('%f',1,1),'%20.6f',' TEST ','%s','ED.' ' \n'], itest_v , ib , irhs , sr , msg);
end;
end; irhs = fix(2+1);
end; ib = fix(2+1);
if( kprint>=3 )
writef(lun,[' ipass VALUE. (A 1 IS GOOD, 0 IS BAD.)','%4i'], ipass);
end;
if( kprint>=2 && ipass==0 )
writef(lun,[' ERROR IN SBOCLS OR SBOLS' ' \n']);
end;
%format (' ERROR IN SBOCLS OR SBOLS');
return;
%format (3I5,1P,e20.6,' TEST ',a,'ED.');
end %subroutine sbocqx