comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % adds corresponding matrices of same sizes or empty inside cell array
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: blockMatFillDiag ensures the extended diagonal terms contain
5 % the matrix size information
6 %
7 % CALL: a = blockMatFillDiag(a, isizes, jsizes)
8 % INPUTS:
9 % a - cell array of matrices representing a matrix by blocs.
10 % blocs may be empty
11 % isizes - heigth of the elements in the lines
12 % jsizes - width of the elements in the rows
13 %
14 %
15 % OUTPUTS:
16 % cell3 - cell array of matrices representing a matrix by blocs.
17 % blocs may be empty
18 %
19 % NOTE : function is private to the ssm class
20 %
21 % VERSION: '$Id: blockMatFillDiag.m,v 1.4 2011/04/08 08:56:23 hewitson Exp $'
22 %
23 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24
25 function a = blockMatFillDiag(a, isizes, jsizes)
26 if ~isempty(a) % checking the cell array is not of empty size
27 ni = numel(isizes);
28 nj = numel(jsizes);
29 for p=1:(max(ni, nj))
30 ii = min(p, ni);
31 jj = min(p, nj);
32 if isempty(a{ii,jj})
33 a{ii,jj} = zeros(isizes(ii), jsizes(jj));
34 end
35 end
36 end
37 end