comparison +blockmatrix/isDivision.m @ 203:764438b52541 feature/grids

blockmatrix: Added functions to test for block matrcies and divisions.
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 15 Jun 2016 14:29:56 +0200
parents
children a5f1b0267dba
comparison
equal deleted inserted replaced
202:e2fefb6f0746 203:764438b52541
1 function b = isDivision(div)
2 % Make sure it is a cellarray
3 if ~iscell(div)
4 b = false;
5 return
6 end
7
8 % Make sure it has the right shape
9 if numel(div) ~= 2
10 b = false;
11 return
12 end
13
14 if ~isDivisionVector(div{1}) || ~isDivisionVector(div{2})
15 b = false;
16 return
17 end
18
19 b = true;
20 end
21
22 function b = isDivisionVector(v)
23 if isempty(v)
24 b = false;
25 return
26 end
27
28 if any(v <= 0)
29 b = false;
30 return
31 end
32
33 b = true;
34 end