comparison +blockmatrix/zeroTest.m @ 207:d521e17f72b6 feature/grids

blockmatrix: Added function to create zero blockmatrices.
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 15 Jun 2016 16:55:40 +0200
parents
children a5f1b0267dba
comparison
equal deleted inserted replaced
206:50a323da7c7f 207:d521e17f72b6
1 function tests = zeroTest()
2 tests = functiontests(localfunctions);
3 end
4
5 function testZero(testCase)
6 cases = {
7 {
8 {[],[]},
9 {},
10 },
11 {
12 {0,0},
13 {[]};
14 },
15 {
16 {1,1},
17 {0};
18 },
19 {
20 {2,1},
21 {[0; 0]};
22 },
23 {
24 {1,2},
25 {[0 0]};
26 },
27 {
28 {[1 2],2},
29 {[0 0];[0 0; 0 0]};
30 },
31 {
32 {[1 2],[2 1]},
33 {[0 0],[0];[0 0; 0 0],[0; 0]};
34 },
35 };
36
37 for i = 1:length(cases)
38 out = convertToFull(blockmatrix.zero(cases{i}{1}));
39 expected = cases{i}{2};
40 testCase.verifyEqual(out,expected);
41 end
42 end
43
44
45 function C = convertToFull(C)
46 [N,M] = size(C);
47 for i = 1:N
48 for j = 1:M
49 C{i,j} = full(C{i,j});
50 end
51 end
52 end