% the program gives the totally nondegenerate pg diagonals of length k of % the interval square matrix [m,M]; precisely it gives a matrix U such that the % first half and the second half of every row are the indices of a totally % nondgenerate pg-diagonal of [m,M] function U=nondegpgdiag(k,m,M) p=size(m,2); X=zeros(1,0); Y={}; %For every column we construct the array C given by the indices of the nondegenerate entries; %we construct Y whose elements are the columns C so obtained; %moreover we construct the row X with the indices of the columns with at least a nondegenerate entry for j=1:p C=zeros(0,1); for i=1:p if m(i,j)~=M(i,j) C=[C;i]; end end if size(C,1)>0 X=[X,j]; Y(j)=C; end end U=zeros(0,2*k); A= nchoosek([1:size(X,2)],k); for i=1:size(A,1) R=sceltabis(Y(A(i,:))); for j=1:size(R,1) U=[U; [R(j,:), X(A(i,:))]]; end end