home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 2.ddi / MUTOOLS1.DI$ / BLKNORM.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  1.3 KB  |  49 lines

  1. %function out = blknorm(mat,blk)
  2. %
  3. %   Takes block by block norms of the input matrix MAT.
  4. %   BLK represents the block structure associated with MAT.
  5. %   Note that all blocks are treated as full block 
  6. %   regardless of their block structure.
  7. %
  8. %   See also: MU, PKVNORM, VNORM, and VSVD.
  9.  
  10. function out = blknorm(mat,blk)
  11.   if nargin < 2
  12.     disp('usage: out = blknorm(mat,blk)')
  13.     return
  14.   end
  15.   [mtype,mrows,mcols,mnum] = minfo(mat);
  16.   [nblk,dum] = size(blk);
  17.   for i=1:nblk
  18.     if blk(i,2)==0
  19.        blk(i,2)=blk(i,1);
  20.     end %if
  21.   end %for
  22.   [nr,nc] = size(mat);
  23.     if mtype == 'cons'
  24.       out = blknrms(mat,blk);
  25.     elseif mtype == 'vary'
  26.       omega = mat(1:mnum,mcols+1);
  27.       npts = mnum;
  28.       nrout = nblk;
  29.       ncout = nblk;
  30.       out = zeros(npts*nrout+1,ncout+1);
  31.       ftop = (npts+1)*mrows;
  32.       ptop = 1:mrows:ftop;
  33.       ptopm1 = ptop(2:npts+1) - 1;
  34.       for i=1:npts
  35.         out((i-1)*nrout+1:i*nrout,1:ncout) = ...
  36.            blknrms(mat(ptop(i):ptopm1(i),1:mcols),blk);
  37.       end
  38.       out(1:mnum,ncout+1) = omega;
  39.       out(nrout*mnum+1,ncout) = npts;
  40.       out(nrout*mnum+1,ncout+1) = Inf;
  41.     elseif mtype == 'syst'
  42.       error('BLKNORM is undefined for SYSTEM matrices')
  43.       return
  44.     else
  45.       out = [];
  46.     end
  47. %
  48. % Copyright MUSYN INC 1991,  All Rights Reserved
  49.