edu.ufl.cise.amd.tdouble
Class Damd_2

java.lang.Object
  extended by edu.ufl.cise.amd.tdouble.Damd
      extended by edu.ufl.cise.amd.tdouble.Damd_internal
          extended by edu.ufl.cise.amd.tdouble.Damd_2

public class Damd_2
extends Damd_internal

AMD_2: performs the AMD ordering on a symmetric sparse matrix A, followed by a postordering (via depth-first search) of the assembly tree using the AMD_postorder routine.


Field Summary
 
Fields inherited from class edu.ufl.cise.amd.tdouble.Damd_internal
EMPTY, FALSE, ID, Int_MAX, NDEBUG, NPRINT, TRUE
 
Fields inherited from class edu.ufl.cise.amd.tdouble.Damd
AMD_AGGRESSIVE, AMD_CONTROL, AMD_DATE, AMD_debug, AMD_DEFAULT_AGGRESSIVE, AMD_DEFAULT_DENSE, AMD_DENSE, AMD_DMAX, AMD_INFO, AMD_INVALID, AMD_LNZ, AMD_MAIN_VERSION, AMD_MEMORY, AMD_N, AMD_NCMPA, AMD_NDENSE, AMD_NDIV, AMD_NMULTSUBS_LDL, AMD_NMULTSUBS_LU, AMD_NZ, AMD_NZ_A_PLUS_AT, AMD_NZDIAG, AMD_OK, AMD_OK_BUT_JUMBLED, AMD_OUT_OF_MEMORY, AMD_STATUS, AMD_SUB_VERSION, AMD_SUBSUB_VERSION, AMD_SYMMETRY, AMD_VERSION
 
Constructor Summary
Damd_2()
           
 
Method Summary
static void amd_2(int n, int[] Pe, int[] Iw, int[] Len, int iwlen, int pfree, int[] Nv, int[] Next, int[] Last, int[] Head, int[] Elen, int[] Degree, int[] W, double[] Control, double[] Info)
          Given a representation of the nonzero pattern of a symmetric matrix, A, (excluding the diagonal) perform an approximate minimum (UMFPACK/MA38-style) degree ordering to compute a pivot order such that the introduction of nonzeros (fill-in) in the Cholesky factors A = LL' is kept low.
static int clear_flag(int wflg, int wbig, int[] W, int n)
           
 
Methods inherited from class edu.ufl.cise.amd.tdouble.Damd_internal
AMD_DEBUG0, AMD_DEBUG1, AMD_DEBUG2, AMD_DEBUG3, AMD_DEBUG4, ASSERT, ASSERT, FLIP, IMPLIES, MAX, MAX, MIN, MIN, PRINTF, sqrt, UNFLIP
 
Methods inherited from class edu.ufl.cise.amd.tdouble.Damd
AMD_VERSION_CODE
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Damd_2

public Damd_2()
Method Detail

clear_flag

public static int clear_flag(int wflg,
                             int wbig,
                             int[] W,
                             int n)

amd_2

public static void amd_2(int n,
                         int[] Pe,
                         int[] Iw,
                         int[] Len,
                         int iwlen,
                         int pfree,
                         int[] Nv,
                         int[] Next,
                         int[] Last,
                         int[] Head,
                         int[] Elen,
                         int[] Degree,
                         int[] W,
                         double[] Control,
                         double[] Info)
Given a representation of the nonzero pattern of a symmetric matrix, A, (excluding the diagonal) perform an approximate minimum (UMFPACK/MA38-style) degree ordering to compute a pivot order such that the introduction of nonzeros (fill-in) in the Cholesky factors A = LL' is kept low. At each step, the pivot selected is the one with the minimum UMFAPACK/MA38-style upper-bound on the external degree. This routine can optionally perform aggresive absorption (as done by MC47B in the Harwell Subroutine Library). The approximate degree algorithm implemented here is the symmetric analog of the degree update algorithm in MA38 and UMFPACK (the Unsymmetric-pattern MultiFrontal PACKage, both by Davis and Duff). The routine is based on the MA27 minimum degree ordering algorithm by Iain Duff and John Reid. This routine is a translation of the original AMDBAR and MC47B routines, in Fortran, with the following modifications: (1) dense rows/columns are removed prior to ordering the matrix, and placed last in the output order. The presence of a dense row/column can increase the ordering time by up to O(n^2), unless they are removed prior to ordering. (2) the minimum degree ordering is followed by a postordering (depth-first search) of the assembly tree. Note that mass elimination (discussed below) combined with the approximate degree update can lead to the mass elimination of nodes with lower exact degree than the current pivot element. No additional fill-in is caused in the representation of the Schur complement. The mass-eliminated nodes merge with the current pivot element. They are ordered prior to the current pivot element. Because they can have lower exact degree than the current element, the merger of two or more of these nodes in the current pivot element can lead to a single element that is not a "fundamental supernode". The diagonal block can have zeros in it. Thus, the assembly tree used here is not guaranteed to be the precise supernodal elemination tree (with "funadmental" supernodes), and the postordering performed by this routine is not guaranteed to be a precise postordering of the elimination tree. (3) input parameters are added, to control aggressive absorption and the detection of "dense" rows/columns of A. (4) additional statistical information is returned, such as the number of nonzeros in L, and the flop counts for subsequent LDL' and LU factorizations. These are slight upper bounds, because of the mass elimination issue discussed above. (5) additional routines are added to interface this routine to MATLAB to provide a simple C-callable user-interface, to check inputs for errors, compute the symmetry of the pattern of A and the number of nonzeros in each row/column of A+A', to compute the pattern of A+A', to perform the assembly tree postordering, and to provide debugging ouput. Many of these functions are also provided by the Fortran Harwell Subroutine Library routine MC47A. (6) both int and UF_long versions are provided. In the descriptions below and integer is and int or UF_long depending on which version is being used. CAUTION: ARGUMENTS ARE NOT CHECKED FOR ERRORS ON INPUT. ****** If you want error checking, a more versatile input format, and a ** simpler user interface, use amd_order or amd_l_order instead. ** This routine is not meant to be user-callable. ** ---------------------------------------------------------------------------- References: ---------------------------------------------------------------------------- [1] Timothy A. Davis and Iain Duff, "An unsymmetric-pattern multifrontal method for sparse LU factorization", SIAM J. Matrix Analysis and Applications, vol. 18, no. 1, pp. 140-158. Discusses UMFPACK / MA38, which first introduced the approximate minimum degree used by this routine. [2] Patrick Amestoy, Timothy A. Davis, and Iain S. Duff, "An approximate minimum degree ordering algorithm," SIAM J. Matrix Analysis and Applications, vol. 17, no. 4, pp. 886-905, 1996. Discusses AMDBAR and MC47B, which are the Fortran versions of this routine. [3] Alan George and Joseph Liu, "The evolution of the minimum degree ordering algorithm," SIAM Review, vol. 31, no. 1, pp. 1-19, 1989. We list below the features mentioned in that paper that this code includes: mass elimination: Yes. MA27 relied on supervariable detection for mass elimination. indistinguishable nodes: Yes (we call these "supervariables"). This was also in the MA27 code - although we modified the method of detecting them (the previous hash was the true degree, which we no longer keep track of). A supervariable is a set of rows with identical nonzero pattern. All variables in a supervariable are eliminated together. Each supervariable has as its numerical name that of one of its variables (its principal variable). quotient graph representation: Yes. We use the term "element" for the cliques formed during elimination. This was also in the MA27 code. The algorithm can operate in place, but it will work more efficiently if given some "elbow room." element absorption: Yes. This was also in the MA27 code. external degree: Yes. The MA27 code was based on the true degree. incomplete degree update and multiple elimination: No. This was not in MA27, either. Our method of degree update within MC47B is element-based, not variable-based. It is thus not well-suited for use with incomplete degree update or multiple elimination. Authors, and Copyright (C) 2004 by: Timothy A. Davis, Patrick Amestoy, Iain S. Duff, John K. Reid. Acknowledgements: This work (and the UMFPACK package) was supported by the National Science Foundation (ASC-9111263, DMS-9223088, and CCR-0203270). The UMFPACK/MA38 approximate degree update algorithm, the unsymmetric analog which forms the basis of AMD, was developed while Tim Davis was supported by CERFACS (Toulouse, France) in a post-doctoral position. This C version, and the etree postorder, were written while Tim Davis was on sabbatical at Stanford University and Lawrence Berkeley National Laboratory. ---------------------------------------------------------------------------- INPUT ARGUMENTS (unaltered): ---------------------------------------------------------------------------- n: The matrix order. Restriction: n >= 1. iwlen: The size of the Iw array. On input, the matrix is stored in Iw [0..pfree-1]. However, Iw [0..iwlen-1] should be slightly larger than what is required to hold the matrix, at least iwlen >= pfree + n. Otherwise, excessive compressions will take place. The recommended value of iwlen is 1.2 * pfree + n, which is the value used in the user-callable interface to this routine (amd_order.c). The algorithm will not run at all if iwlen < pfree. Restriction: iwlen >= pfree + n. Note that this is slightly more restrictive than the actual minimum (iwlen >= pfree), but AMD_2 will be very slow with no elbow room. Thus, this routine enforces a bare minimum elbow room of size n. pfree: On input the tail end of the array, Iw [pfree..iwlen-1], is empty, and the matrix is stored in Iw [0..pfree-1]. During execution, additional data is placed in Iw, and pfree is modified so that Iw [pfree..iwlen-1] is always the unused part of Iw. Control: A double array of size AMD_CONTROL containing input parameters that affect how the ordering is computed. If null, then default settings are used. Control [AMD_DENSE] is used to determine whether or not a given input row is "dense". A row is "dense" if the number of entries in the row exceeds Control [AMD_DENSE] times sqrt (n), except that rows with 16 or fewer entries are never considered "dense". To turn off the detection of dense rows, set Control [AMD_DENSE] to a negative number, or to a number larger than sqrt (n). The default value of Control [AMD_DENSE] is AMD_DEFAULT_DENSE, which is defined in amd.h as 10. Control [AMD_AGGRESSIVE] is used to determine whether or not aggressive absorption is to be performed. If nonzero, then aggressive absorption is performed (this is the default). ---------------------------------------------------------------------------- INPUT/OUPUT ARGUMENTS: ---------------------------------------------------------------------------- Pe: An integer array of size n. On input, Pe [i] is the index in Iw of the start of row i. Pe [i] is ignored if row i has no off-diagonal entries. Thus Pe [i] must be in the range 0 to pfree-1 for non-empty rows. During execution, it is used for both supervariables and elements: Principal supervariable i: index into Iw of the description of supervariable i. A supervariable represents one or more rows of the matrix with identical nonzero pattern. In this case, Pe [i] >= 0. Non-principal supervariable i: if i has been absorbed into another supervariable j, then Pe [i] = FLIP (j), where FLIP (j) is defined as (-(j)-2). Row j has the same pattern as row i. Note that j might later be absorbed into another supervariable j2, in which case Pe [i] is still FLIP (j), and Pe [j] = FLIP (j2) which is < EMPTY, where EMPTY is defined as (-1) in amd_internal.h. Unabsorbed element e: the index into Iw of the description of element e, if e has not yet been absorbed by a subsequent element. Element e is created when the supervariable of the same name is selected as the pivot. In this case, Pe [i] >= 0. Absorbed element e: if element e is absorbed into element e2, then Pe [e] = FLIP (e2). This occurs when the pattern of e (which we refer to as Le) is found to be a subset of the pattern of e2 (that is, Le2). In this case, Pe [i] < EMPTY. If element e is "null" (it has no nonzeros outside its pivot block), then Pe [e] = EMPTY, and e is the root of an assembly subtree (or the whole tree if there is just one such root). Dense variable i: if i is "dense", then Pe [i] = EMPTY. On output, Pe holds the assembly tree/forest, which implicitly represents a pivot order with identical fill-in as the actual order (via a depth-first search of the tree), as follows. If Nv [i] > 0, then i represents a node in the assembly tree, and the parent of i is Pe [i], or EMPTY if i is a root. If Nv [i] = 0, then (i, Pe [i]) represents an edge in a subtree, the root of which is a node in the assembly tree. Note that i refers to a row/column in the original matrix, not the permuted matrix. Info: A double array of size AMD_INFO. If present, (that is, not null), then statistics about the ordering are returned in the Info array. See amd.h for a description. ---------------------------------------------------------------------------- INPUT/MODIFIED (undefined on output): ---------------------------------------------------------------------------- Len: An integer array of size n. On input, Len [i] holds the number of entries in row i of the matrix, excluding the diagonal. The contents of Len are undefined on output. Iw: An integer array of size iwlen. On input, Iw [0..pfree-1] holds the description of each row i in the matrix. The matrix must be symmetric, and both upper and lower triangular parts must be present. The diagonal must not be present. Row i is held as follows: Len [i]: the length of the row i data structure in the Iw array. Iw [Pe [i] ... Pe [i] + Len [i] - 1]: the list of column indices for nonzeros in row i (simple supervariables), excluding the diagonal. All supervariables start with one row/column each (supervariable i is just row i). If Len [i] is zero on input, then Pe [i] is ignored on input. Note that the rows need not be in any particular order, and there may be empty space between the rows. During execution, the supervariable i experiences fill-in. This is represented by placing in i a list of the elements that cause fill-in in supervariable i: Len [i]: the length of supervariable i in the Iw array. Iw [Pe [i] ... Pe [i] + Elen [i] - 1]: the list of elements that contain i. This list is kept short by removing absorbed elements. Iw [Pe [i] + Elen [i] ... Pe [i] + Len [i] - 1]: the list of supervariables in i. This list is kept short by removing nonprincipal variables, and any entry j that is also contained in at least one of the elements (j in Le) in the list for i (e in row i). When supervariable i is selected as pivot, we create an element e of the same name (e=i): Len [e]: the length of element e in the Iw array. Iw [Pe [e] ... Pe [e] + Len [e] - 1]: the list of supervariables in element e. An element represents the fill-in that occurs when supervariable i is selected as pivot (which represents the selection of row i and all non-principal variables whose principal variable is i). We use the term Le to denote the set of all supervariables in element e. Absorbed supervariables and elements are pruned from these lists when computationally convenient. CAUTION: THE INPUT MATRIX IS OVERWRITTEN DURING COMPUTATION. The contents of Iw are undefined on output. ---------------------------------------------------------------------------- OUTPUT (need not be set on input): ---------------------------------------------------------------------------- Nv: An integer array of size n. During execution, ABS (Nv [i]) is equal to the number of rows that are represented by the principal supervariable i. If i is a nonprincipal or dense variable, then Nv [i] = 0. Initially, Nv [i] = 1 for all i. Nv [i] < 0 signifies that i is a principal variable in the pattern Lme of the current pivot element me. After element me is constructed, Nv [i] is set back to a positive value. On output, Nv [i] holds the number of pivots represented by super row/column i of the original matrix, or Nv [i] = 0 for non-principal rows/columns. Note that i refers to a row/column in the original matrix, not the permuted matrix. Elen: An integer array of size n. See the description of Iw above. At the start of execution, Elen [i] is set to zero for all rows i. During execution, Elen [i] is the number of elements in the list for supervariable i. When e becomes an element, Elen [e] = FLIP (esize) is set, where esize is the size of the element (the number of pivots, plus the number of nonpivotal entries). Thus Elen [e] < EMPTY. Elen (i) = EMPTY set when variable i becomes nonprincipal. For variables, Elen (i) >= EMPTY holds until just before the postordering and permutation vectors are computed. For elements, Elen [e] < EMPTY holds. On output, Elen [i] is the degree of the row/column in the Cholesky factorization of the permuted matrix, corresponding to the original row i, if i is a super row/column. It is equal to EMPTY if i is non-principal. Note that i refers to a row/column in the original matrix, not the permuted matrix. Note that the contents of Elen on output differ from the Fortran version (Elen holds the inverse permutation in the Fortran version, which is instead returned in the Next array in this C version, described below). Last: In a degree list, Last [i] is the supervariable preceding i, or EMPTY if i is the head of the list. In a hash bucket, Last [i] is the hash key for i. Last [Head [hash]] is also used as the head of a hash bucket if Head [hash] contains a degree list (see the description of Head, below). On output, Last [0..n-1] holds the permutation. That is, if i = Last [k], then row i is the kth pivot row (where k ranges from 0 to n-1). Row Last [k] of A is the kth row in the permuted matrix, PAP'. Next: Next [i] is the supervariable following i in a link list, or EMPTY if i is the last in the list. Used for two kinds of lists: degree lists and hash buckets (a supervariable can be in only one kind of list at a time). On output Next [0..n-1] holds the inverse permutation. That is, if k = Next [i], then row i is the kth pivot row. Row i of A appears as the (Next[i])-th row in the permuted matrix, PAP'. Note that the contents of Next on output differ from the Fortran version (Next is undefined on output in the Fortran version). ---------------------------------------------------------------------------- LOCAL WORKSPACE (not input or output - used only during execution): ---------------------------------------------------------------------------- Degree: An integer array of size n. If i is a supervariable, then Degree [i] holds the current approximation of the external degree of row i (an upper bound). The external degree is the number of nonzeros in row i, minus ABS (Nv [i]), the diagonal part. The bound is equal to the exact external degree if Elen [i] is less than or equal to two. We also use the term "external degree" for elements e to refer to |Le \ Lme|. If e is an element, then Degree [e] is |Le|, which is the degree of the off-diagonal part of the element e (not including the diagonal part). Head: An integer array of size n. Head is used for degree lists. Head [deg] is the first supervariable in a degree list. All supervariables i in a degree list Head [deg] have the same approximate degree, namely, deg = Degree [i]. If the list Head [deg] is empty then Head [deg] = EMPTY. During supervariable detection Head [hash] also serves as a pointer to a hash bucket. If Head [hash] >= 0, there is a degree list of degree hash. The hash bucket head pointer is Last [Head [hash]]. If Head [hash] = EMPTY, then the degree list and hash bucket are both empty. If Head [hash] < EMPTY, then the degree list is empty, and FLIP (Head [hash]) is the head of the hash bucket. After supervariable detection is complete, all hash buckets are empty, and the (Last [Head [hash]] = EMPTY) condition is restored for the non-empty degree lists. W: An integer array of size n. The flag array W determines the status of elements and variables, and the external degree of elements. for elements: if W [e] = 0, then the element e is absorbed. if W [e] >= wflg, then W [e] - wflg is the size of the set |Le \ Lme|, in terms of nonzeros (the sum of ABS (Nv [i]) for each principal variable i that is both in the pattern of element e and NOT in the pattern of the current pivot element, me). if wflg > W [e] > 0, then e is not absorbed and has not yet been seen in the scan of the element lists in the computation of |Le\Lme| in Scan 1 below. for variables: during supervariable detection, if W [j] != wflg then j is not in the pattern of variable i. The W array is initialized by setting W [i] = 1 for all i, and by setting wflg = 2. It is reinitialized if wflg becomes too large (to ensure that wflg+n does not cause integer overflow).

Parameters:
n - A is n-by-n, where n > 0
Pe - Pe [0..n-1]: index in Iw of row i on input
Iw - workspace of size iwlen. Iw [0..pfree-1] holds the matrix on input
Len - Len [0..n-1]: length for row/column i on input
iwlen - length of Iw. iwlen >= pfree + n
pfree - Iw [pfree ... iwlen-1] is empty on input
Nv - size-n, the size of each supernode on output
Next - size-n, the output inverse permutation
Last - size-n, the output permutation
Head - size-n
Elen - size-n, the size columns of L for each supernode
Degree - size-n
W - size-n
Control - array of size AMD_CONTROL
Info - array of size AMD_INFO


Copyright © 2012. All Rights Reserved.