Mercurial > repos > public > sbplib
comparison +blockmatrix/isDivision.m @ 886:8894e9c49e40 feature/timesteppers
Merge with default for latest changes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 15 Nov 2018 16:36:21 -0800 |
parents | a5f1b0267dba |
children |
comparison
equal
deleted
inserted
replaced
816:b5e5b195da1e | 886:8894e9c49e40 |
---|---|
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 = true; | |
25 return | |
26 end | |
27 | |
28 if any(v < 0) | |
29 b = false; | |
30 return | |
31 end | |
32 | |
33 b = true; | |
34 end |