Mercurial > repos > public > sbplib
comparison +blockmatrix/getDivision.m @ 579:a5f1b0267dba feature/grids
Be less strict about what is considered a block matrix
Empty blocks of different sizes are now allowed as well as empty block dimensions
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 07 Sep 2017 09:21:04 +0200 |
parents | f0ef314e2070 |
children |
comparison
equal
deleted
inserted
replaced
578:1fe16b34f114 | 579:a5f1b0267dba |
---|---|
14 | 14 |
15 function m = col_width(C) | 15 function m = col_width(C) |
16 m = zeros(1,size(C,2)); | 16 m = zeros(1,size(C,2)); |
17 for j = 1:size(C,2) | 17 for j = 1:size(C,2) |
18 for i = 1:size(C,1) | 18 for i = 1:size(C,1) |
19 if isempty(C{i,j}) | 19 if isNullMatrix(C{i,j}) |
20 continue | 20 continue |
21 end | 21 end |
22 m(j) = size(C{i,j},2); | 22 m(j) = size(C{i,j},2); |
23 end | 23 end |
24 end | 24 end |
26 | 26 |
27 function n = row_height(C) | 27 function n = row_height(C) |
28 n = zeros(1,size(C,1)); | 28 n = zeros(1,size(C,1)); |
29 for i = 1:size(C,1) | 29 for i = 1:size(C,1) |
30 for j = 1:size(C,2) | 30 for j = 1:size(C,2) |
31 if isempty(C{i,j}) | 31 if isNullMatrix(C{i,j}) |
32 continue | 32 continue |
33 end | 33 end |
34 n(i) = size(C{i,j},1); | 34 n(i) = size(C{i,j},1); |
35 end | 35 end |
36 end | 36 end |
37 end | 37 end |
38 | |
39 function b = isNullMatrix(A) | |
40 [n, m] = size(A); | |
41 b = n == 0 && m == 0; | |
42 end |