~logan/ubuntu/trusty/suitesparse/4.2.1-3ubuntu1

« back to all changes in this revision

Viewing changes to BTF/MATLAB/Test/checkbtf.m

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2007-05-29 09:36:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529093629-zowquo0b7slkk6nc
Tags: 3.0.0-2
* suitesparse builds properly twice in a row
* Bug fix: "suitesparse - FTBFS: Broken build depens: libgfortran1-dev",
  thanks to Bastian Blank (Closes: #426349).
* Bug fix: "suitesparse_3.0.0-1: FTBFS: build-depends on
  libgfortran1-dev", thanks to Steve Langasek (Closes: #426354).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function checkbtf (A, p, q, r)
 
2
%CHECKBTF ensure A(p,q) is in BTF form
 
3
%
 
4
% A(p,q) is in BTF form, r the block boundaries
 
5
%
 
6
% Example:
 
7
%   [p,q,r] = dmperm (A)
 
8
%   checkbtf (A, p, q, r)
 
9
%
 
10
% See also drawbtf, maxtrans, strongcomp.
 
11
 
 
12
% Copyright 2007, Timothy A. Davis, University of Florida
 
13
 
 
14
[m n] = size (A) ;
 
15
if (m ~= n)
 
16
    error ('A must be square') ;
 
17
end
 
18
 
 
19
if (any (sort (p) ~= 1:n))
 
20
    error ('p not a permutation') ;
 
21
end
 
22
 
 
23
if (any (sort (q) ~= 1:n))
 
24
    error ('q not a permutation') ;
 
25
end
 
26
 
 
27
nblocks = length (r) - 1 ;
 
28
 
 
29
if (r (1) ~= 1)
 
30
    error ('r(1) not one') ;
 
31
end
 
32
 
 
33
if (r (end) ~= n+1)
 
34
    error ('r(end) not n+1') ;
 
35
end
 
36
 
 
37
if (nblocks < 1 | nblocks > n)                                              %#ok
 
38
    error ('nblocks wrong') ;
 
39
end
 
40
 
 
41
nblocks = length (r) - 1 ;
 
42
rdiff = r (2:(nblocks+1)) - r (1:nblocks) ;
 
43
if (any (rdiff < 1) | any (rdiff > n))                                      %#ok
 
44
    error ('r bad')
 
45
end
 
46