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.
8
% [p,q,r] = btf (A,maxwork) ;
10
% If the matrix has structural full rank, this is essentially identical to
12
% [p,q,r] = dmperm (A)
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,
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.
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.
33
% See also maxtrans, strongcomp, dmperm, sprank
35
% Copyright 2004-2007, Tim Davis, University of Florida
36
% with support from Sandia National Laboratories. All Rights Reserved.
38
error ('btf mexFunction not found') ;