time | Calls | line |
---|
| | 102 | function blk_sizes = get_blk_sizes(blk_nz)
|
| 1 | 103 |
|
< 0.001 | 1 | 104 | % get the block sizes
|
< 0.001 | 1 | 105 | m = length(blk_nz);
|
| 1 | 106 | blk_sizes = zeros(m,1);
|
< 0.001 | 1 | 107 | blk_sizes(1) = 1;
|
| | 108 | k = 1;
|
0.004 | 1024 | 109 | for i = 2:m
|
< 0.001 | 197 | 110 | % create a new block if this is satisfied
|
< 0.001 | 197 | 111 | if sum(blk_nz(1:i-1,i)) == 0 && sum(blk_nz(i:end,i-1)) == 0
|
| | 112 | k = k + 1;
|
< 0.001 | 1024 | 113 | end
|
< 0.001 | 1024 | 114 | % the cardinality of the k-th block is increased by 1
|
< 0.001 | 1 | 115 | blk_sizes(k) = blk_sizes(k) + 1;
|
| | 116 | end
|
| | 117 | blk_sizes = blk_sizes(1:k);
|
| | 118 |
|
| | 119 | % remark: difference between zero_pattern and block_pattern
|
< 0.001 | 1 | 120 | % if (i,j) is an entry in k-th block and B_l(i,j) = 0 for all l,
|
| | 121 | % then zero_pattern(i,j) = 0, but block_pattern(i,j) = k
|
| | 122 | end
|