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

« back to all changes in this revision

Viewing changes to BTF/MATLAB/btf.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 [p,q,r] = btf (A)                                                  %#ok
 
2
%BTF permute a square sparse matrix into upper block triangular form
 
3
% with a zero-free diagonal, or with a maximum number of nonzeros along the
 
4
% diagonal if a zero-free permutation does not exist.
 
5
%
 
6
% Example:
 
7
%       [p,q,r] = btf (A) ;
 
8
%       [p,q,r] = btf (A,maxwork) ;
 
9
%
 
10
% If the matrix has structural full rank, this is essentially identical to
 
11
%
 
12
%       [p,q,r] = dmperm (A)
 
13
%
 
14
% except that p, q, and r will differ in trivial ways.  Both return an upper
 
15
% block triangular form with a zero-free diagonal, if the matrix is
 
16
% structurally non-singular.  The number and sizes of the blocks will be
 
17
% identical, but the order of the blocks, and the ordering within the blocks,
 
18
% can be different.
 
19
 
20
% If the matrix is structurally singular, the q from btf will contain negative
 
21
% entries.  The permuted matrix is C = A(p,abs(q)), and find(q<0) gives a list
 
22
% of indices of the diagonal of C that are equal to zero.  This differs from
 
23
% dmperm, which does not place the maximum matching along the main diagonal
 
24
% of C=A(p,q), but places it above the diagonal instead.
 
25
%
 
26
% The second input limits the maximum amount of work the function does to
 
27
% be maxwork*nnz(A), or no limit at all if maxwork <= 0.  If the function
 
28
% terminates early as a result, a maximum matching may not be found, and the
 
29
% diagonal of A(p,abs(q)) might not have the maximum number of nonzeros
 
30
% possible.  Also, the number of blocks (length(r)-1) may be larger than
 
31
% what btf(A) or dmperm(A) would compute.
 
32
%
 
33
% See also maxtrans, strongcomp, dmperm, sprank
 
34
 
 
35
% Copyright 2004-2007, Tim Davis, University of Florida
 
36
% with support from Sandia National Laboratories.  All Rights Reserved.
 
37
 
 
38
error ('btf mexFunction not found') ;