%function [rv,condd] = dscl_vec(dl,nblk,blk,blkp)
%	Converts a matrix D into a row vector, and
%       calculates the condition number of D.
function [rv,condd] = dscl_vec(dl,nblk,blk,blkp)
% it would be faster if we knew the dimension of RV
% in advance
 maxsv = 0;
 minsv = inf;
 rv = [];
 for i=1:nblk
   if blk(i,2) == 0
     sv = svd(dl(blkp(i,2):blkp(i+1,2)-1,blkp(i,2):blkp(i+1,2)-1));
     if max(sv) > maxsv
       maxsv = max(sv);
     end
     if min(sv) < minsv
       minsv = min(sv);
     end
     for j=1:blk(i,1)
       rv = [rv dl(blkp(i,2)+j-1,blkp(i,2):blkp(i+1,2)-1)];
     end
   else
     if abs(dl(blkp(i,2),blkp(i,2))) > maxsv
       maxsv = abs(dl(blkp(i,2),blkp(i,2)));
     end
     if abs(dl(blkp(i,2),blkp(i,2))) < minsv
       minsv = abs(dl(blkp(i,2),blkp(i,2)));
     end
     rv = [rv dl(blkp(i,2),blkp(i,2))];
   end
 end
 condd = maxsv/minsv;
%
% Copyright MUSYN INC 1991,  All Rights Reserved
