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

  1. % function [blkp,rp,fp,widd,widp,nrd,ncd,rnblk,rblk,rblkp] = ptrs(blk)
  2.  
  3. %  BLK is the user-defined block structure. It is a NBLK x 2
  4. %  matrix of nonnegative integers. the i'th row of BLK describes
  5. %  the dimensions of the i'th block in the perturbation structure.
  6. %  if the i'th row of BLK is of the form  [ r c ], where r and c
  7. %  are both positive, then the i'th block is a rxc full block.
  8. %  if the i'th row of BLK is [ r 0 ], where r is positive, then
  9. %  the i'th block is a repeated scalar block of dimension r. the
  10. %  argument r must always be positive.
  11. %
  12. %  NBLK is the number of blocks in the block structure (it is the
  13. %  row dimension of BLK)
  14. %
  15. %  BLKP is a NBLK+1 x 2 matrix of pointers for the block structure.
  16. %  If Delta is a matrix with the correct block structure, then the
  17. %  i'th pertubation block begins in row BLKP(i,1), and column BLKP(i,2)
  18. %  (WARNING: since m*delta is square, though neither m nor Delta need
  19. %  be square, to reference the block of m that the i'th pertubation
  20. %  block feeds back across starts in row BLKP(i,2) of m, and column
  21. %  BLKP(i,1))
  22. %
  23. %  RBLK is derived from BLK be replacing all of the repeated scalar
  24. %  blocks with a different structure. in particular, if there is an
  25. %  rxr repeated scalar block in BLK, then this turns into r 1x1 blocks
  26. %  in RBLK. then, RNBLK and RBLKP are defined as above, but with reference
  27. %  to RBLK.
  28. %
  29. %  RP is a pointer to the repeated scalar block of BLK. the number
  30. %  of repeated scalar blocks in BLK is LENGTH(RP). for instance, if
  31. %  RP(1) = 3, then this says that the first repeated scalar block
  32. %  of BLK is the 3rd block.
  33. %
  34. %  FP is the analogue of RP but for full blocks.
  35. %
  36. %  in MU, the d-scaling matrices are returned as a row vector, and
  37. %  may be unwrapped into their complete block diagonal form using
  38. %  UNWRAPD. the variable WIDD gives the column dimension of this row
  39. %  vector form of the d-scalings
  40. %
  41. %  in MU, the perturbation matrices are returned as a row vector, and
  42. %  may be unwrapped into their complete block diagonal form using
  43. %  UNWRAPP. the variable WIDP gives the column dimension of this row
  44. %  vector form of the perturbations.
  45. %
  46. %  NRD is the row dimension of the perturbation, while NCD is the
  47. %  column dimension of the perturbation. Modulo representing repeated
  48. %  scalar blocks with zeros in the second column of BLK, NRD and NCD
  49. %  are the column sums of BLK
  50.  
  51. function [blkp,rp,fp,widd,widp,nrd,ncd,rnblk,rblk,rblkp] = ptrs(blk)
  52.   [nblk,dum] = size(blk);
  53.   blkp = zeros(nblk+1,2);
  54.   blkp(1,:) = [1 1];
  55.   nrd = 0;
  56.   ncd = 0;
  57.   widp = 0;
  58.   widd = 0;
  59.   rp = [];
  60.   fp = [];
  61.   rblk = [];
  62.   rnblk = 0;
  63.   for i=1:nblk
  64.     nrd = nrd + blk(i,1);
  65.     if blk(i,2) == 0
  66.       if blk(i,1) > 1
  67.         rp = [rp i];
  68.       else
  69.         fp = [fp i];
  70.       end
  71.       ncd = ncd + blk(i,1);
  72.       blkp(i+1,:) = blkp(i,:) + [blk(i,1) blk(i,1)];
  73.       widp = widp + 1;
  74.       widd = widd + blk(i,1)*blk(i,1);
  75.       rblk = [rblk ; ones(blk(i,1),2)];
  76.       rnblk = rnblk + blk(i,1);
  77.     else
  78.       fp = [fp i];
  79.       blkp(i+1,:) = blkp(i,:) + blk(i,:);
  80.       ncd = ncd + blk(i,2);
  81.       widd = widd + 1;
  82.       widp = widp + blk(i,1)*blk(i,2);
  83.       rblk = [rblk ; blk(i,:)];
  84.       rnblk = rnblk + 1;
  85.     end
  86.   end
  87.   if nargout == 10
  88.     rblkp = ptrs(rblk);
  89.   end
  90. %
  91. % Copyright MUSYN INC 1991,  All Rights Reserved
  92.