% program which calculates the minimal rank for every interval % matrix with 3 columns function a=mrkpx3(n,N) if rk01(n,N)==0 a=0; return elseif rk01(n,N)==1 a=1; return else X=reduce(n,N) ; [p,r]=size(X) q=r/2; if q==2 a=2; return end m=X(:,1:q); M=X(:,q+1:r); v=zeros(1,0); for i=1:p if m(i,1)<=0 & M(i,1)>=0 & -m(i,1)+M(i,1)>0 v=[v i]; end end % v is the set of the indices i st of [m,M]_1i has % min negative max positive or % min zero max positive or % min negative max zero % now we construct two tridimensional matrices A and B such that % for every i the slice [A(:,:,i) B(:,:,i)] is an interval matrix % whose entries of the first column % are all either contained in the set of the % nonnegative real numbers or in the set of nonpositive real numbers % and the union of [A(r,s,i),B(r,s,i)] with i varying is the entry % r,s of [m,M] A=zeros(p,q,1); A(:,:,1) =m; B=zeros(p,q,1); B(:,:,1) =M; for i=1:size(v,2) A=cat(3,A,A); B=cat(3,B,B); for l=1:size(A,3)/2 B(v(i),1,l)=0; A(v(i),1,l+size(A,3)/2)=0; end end % Now we change A and B in such way that the entries of the % first columns of every slice [A(:,:,i) B:,:,i)] are contained %in the set of nonnegative real numbers for k=1:size(A,3) for i=1:size(A,1) if A(i,1,k)<0 X=A(i,:,k); Y=B(i,:,k); A(i,:,k)=min(-X,-Y); B(i,:,k)=max(-X,-Y); end end end end for i=1:size(A,3) if rklesseq2(A(:,:,i),B(:,:,i))==1 a=2; return end end a=3; end