Mercurial > hg > ltpda
diff m-toolbox/classes/@ssm/blockMatFillDiag.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@ssm/blockMatFillDiag.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,37 @@ +% adds corresponding matrices of same sizes or empty inside cell array +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: blockMatFillDiag ensures the extended diagonal terms contain +% the matrix size information +% +% CALL: a = blockMatFillDiag(a, isizes, jsizes) +% INPUTS: +% a - cell array of matrices representing a matrix by blocs. +% blocs may be empty +% isizes - heigth of the elements in the lines +% jsizes - width of the elements in the rows +% +% +% OUTPUTS: +% cell3 - cell array of matrices representing a matrix by blocs. +% blocs may be empty +% +% NOTE : function is private to the ssm class +% +% VERSION: '$Id: blockMatFillDiag.m,v 1.4 2011/04/08 08:56:23 hewitson Exp $' +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function a = blockMatFillDiag(a, isizes, jsizes) + if ~isempty(a) % checking the cell array is not of empty size + ni = numel(isizes); + nj = numel(jsizes); + for p=1:(max(ni, nj)) + ii = min(p, ni); + jj = min(p, nj); + if isempty(a{ii,jj}) + a{ii,jj} = zeros(isizes(ii), jsizes(jj)); + end + end + end +end