kusano 7d535a
kusano 7d535a
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
kusano 7d535a
<title>SuperLU: SRC/colamd.h Source File</title>
kusano 7d535a
<link href="doxygen.css" rel="stylesheet" type="text/css">
kusano 7d535a
<link href="tabs.css" rel="stylesheet" type="text/css">
kusano 7d535a
kusano 7d535a
kusano 7d535a
kusano 7d535a
  
kusano 7d535a
    
    kusano 7d535a
          
  • Main Page
  • kusano 7d535a
          
  • Data Structures
  • kusano 7d535a
          
  • Files
  • kusano 7d535a
        
    kusano 7d535a
      
    kusano 7d535a

    SRC/colamd.h

    Go to the documentation of this file.
    00001 
    kusano 7d535a
    00055 #ifndef COLAMD_H
    kusano 7d535a
    00056 #define COLAMD_H
    kusano 7d535a
    00057 
    kusano 7d535a
    00058 /* ========================================================================== */
    kusano 7d535a
    00059 /* === Include files ======================================================== */
    kusano 7d535a
    00060 /* ========================================================================== */
    kusano 7d535a
    00061 
    kusano 7d535a
    00062 #include <stdlib.h>
    kusano 7d535a
    00063 
    kusano 7d535a
    00064 /* ========================================================================== */
    kusano 7d535a
    00065 /* === Knob and statistics definitions ====================================== */
    kusano 7d535a
    00066 /* ========================================================================== */
    kusano 7d535a
    00067 
    kusano 7d535a
    00068 /* size of the knobs [ ] array.  Only knobs [0..1] are currently used. */
    kusano 7d535a
    00069 #define COLAMD_KNOBS 20
    kusano 7d535a
    00070 
    kusano 7d535a
    00071 /* number of output statistics.  Only stats [0..6] are currently used. */
    kusano 7d535a
    00072 #define COLAMD_STATS 20
    kusano 7d535a
    00073 
    kusano 7d535a
    00074 /* knobs [0] and stats [0]: dense row knob and output statistic. */
    kusano 7d535a
    00075 #define COLAMD_DENSE_ROW 0
    kusano 7d535a
    00076 
    kusano 7d535a
    00077 /* knobs [1] and stats [1]: dense column knob and output statistic. */
    kusano 7d535a
    00078 #define COLAMD_DENSE_COL 1
    kusano 7d535a
    00079 
    kusano 7d535a
    00080 /* stats [2]: memory defragmentation count output statistic */
    kusano 7d535a
    00081 #define COLAMD_DEFRAG_COUNT 2
    kusano 7d535a
    00082 
    kusano 7d535a
    00083 /* stats [3]: colamd status:  zero OK, > 0 warning or notice, < 0 error */
    kusano 7d535a
    00084 #define COLAMD_STATUS 3
    kusano 7d535a
    00085 
    kusano 7d535a
    00086 /* stats [4..6]: error info, or info on jumbled columns */ 
    kusano 7d535a
    00087 #define COLAMD_INFO1 4
    kusano 7d535a
    00088 #define COLAMD_INFO2 5
    kusano 7d535a
    00089 #define COLAMD_INFO3 6
    kusano 7d535a
    00090 
    kusano 7d535a
    00091 /* error codes returned in stats [3]: */
    kusano 7d535a
    00092 #define COLAMD_OK                               (0)
    kusano 7d535a
    00093 #define COLAMD_OK_BUT_JUMBLED                   (1)
    kusano 7d535a
    00094 #define COLAMD_ERROR_A_not_present              (-1)
    kusano 7d535a
    00095 #define COLAMD_ERROR_p_not_present              (-2)
    kusano 7d535a
    00096 #define COLAMD_ERROR_nrow_negative              (-3)
    kusano 7d535a
    00097 #define COLAMD_ERROR_ncol_negative              (-4)
    kusano 7d535a
    00098 #define COLAMD_ERROR_nnz_negative               (-5)
    kusano 7d535a
    00099 #define COLAMD_ERROR_p0_nonzero                 (-6)
    kusano 7d535a
    00100 #define COLAMD_ERROR_A_too_small                (-7)
    kusano 7d535a
    00101 #define COLAMD_ERROR_col_length_negative        (-8)
    kusano 7d535a
    00102 #define COLAMD_ERROR_row_index_out_of_bounds    (-9)
    kusano 7d535a
    00103 #define COLAMD_ERROR_out_of_memory              (-10)
    kusano 7d535a
    00104 #define COLAMD_ERROR_internal_error             (-999)
    kusano 7d535a
    00105 
    kusano 7d535a
    00106 /* ========================================================================== */
    kusano 7d535a
    00107 /* === Row and Column structures ============================================ */
    kusano 7d535a
    00108 /* ========================================================================== */
    kusano 7d535a
    00109 
    kusano 7d535a
    00110 /* User code that makes use of the colamd/symamd routines need not directly */
    kusano 7d535a
    00111 /* reference these structures.  They are used only for the COLAMD_RECOMMENDED */
    kusano 7d535a
    00112 /* macro. */
    kusano 7d535a
    00113 
    kusano 7d535a
    00114 typedef struct Colamd_Col_struct
    kusano 7d535a
    00115 {
    kusano 7d535a
    00116     int start ;         /* index for A of first row in this column, or DEAD */
    kusano 7d535a
    00117                         /* if column is dead */
    kusano 7d535a
    00118     int length ;        /* number of rows in this column */
    kusano 7d535a
    00119     union
    kusano 7d535a
    00120     {
    kusano 7d535a
    00121         int thickness ; /* number of original columns represented by this */
    kusano 7d535a
    00122                         /* col, if the column is alive */
    kusano 7d535a
    00123         int parent ;    /* parent in parent tree super-column structure, if */
    kusano 7d535a
    00124                         /* the column is dead */
    kusano 7d535a
    00125     } shared1 ;
    kusano 7d535a
    00126     union
    kusano 7d535a
    00127     {
    kusano 7d535a
    00128         int score ;     /* the score used to maintain heap, if col is alive */
    kusano 7d535a
    00129         int order ;     /* pivot ordering of this column, if col is dead */
    kusano 7d535a
    00130     } shared2 ;
    kusano 7d535a
    00131     union
    kusano 7d535a
    00132     {
    kusano 7d535a
    00133         int headhash ;  /* head of a hash bucket, if col is at the head of */
    kusano 7d535a
    00134                         /* a degree list */
    kusano 7d535a
    00135         int hash ;      /* hash value, if col is not in a degree list */
    kusano 7d535a
    00136         int prev ;      /* previous column in degree list, if col is in a */
    kusano 7d535a
    00137                         /* degree list (but not at the head of a degree list) */
    kusano 7d535a
    00138     } shared3 ;
    kusano 7d535a
    00139     union
    kusano 7d535a
    00140     {
    kusano 7d535a
    00141         int degree_next ;       /* next column, if col is in a degree list */
    kusano 7d535a
    00142         int hash_next ;         /* next column, if col is in a hash list */
    kusano 7d535a
    00143     } shared4 ;
    kusano 7d535a
    00144 
    kusano 7d535a
    00145 } Colamd_Col ;
    kusano 7d535a
    00146 
    kusano 7d535a
    00147 typedef struct Colamd_Row_struct
    kusano 7d535a
    00148 {
    kusano 7d535a
    00149     int start ;         /* index for A of first col in this row */
    kusano 7d535a
    00150     int length ;        /* number of principal columns in this row */
    kusano 7d535a
    00151     union
    kusano 7d535a
    00152     {
    kusano 7d535a
    00153         int degree ;    /* number of principal & non-principal columns in row */
    kusano 7d535a
    00154         int p ;         /* used as a row pointer in init_rows_cols () */
    kusano 7d535a
    00155     } shared1 ;
    kusano 7d535a
    00156     union
    kusano 7d535a
    00157     {
    kusano 7d535a
    00158         int mark ;      /* for computing set differences and marking dead rows*/
    kusano 7d535a
    00159         int first_column ;/* first column in row (used in garbage collection) */
    kusano 7d535a
    00160     } shared2 ;
    kusano 7d535a
    00161 
    kusano 7d535a
    00162 } Colamd_Row ;
    kusano 7d535a
    00163 
    kusano 7d535a
    00164 /* ========================================================================== */
    kusano 7d535a
    00165 /* === Colamd recommended memory size ======================================= */
    kusano 7d535a
    00166 /* ========================================================================== */
    kusano 7d535a
    00167 
    kusano 7d535a
    00168 /*
    kusano 7d535a
    00169     The recommended length Alen of the array A passed to colamd is given by
    kusano 7d535a
    00170     the COLAMD_RECOMMENDED (nnz, n_row, n_col) macro.  It returns -1 if any
    kusano 7d535a
    00171     argument is negative.  2*nnz space is required for the row and column
    kusano 7d535a
    00172     indices of the matrix. COLAMD_C (n_col) + COLAMD_R (n_row) space is
    kusano 7d535a
    00173     required for the Col and Row arrays, respectively, which are internal to
    kusano 7d535a
    00174     colamd.  An additional n_col space is the minimal amount of "elbow room",
    kusano 7d535a
    00175     and nnz/5 more space is recommended for run time efficiency.
    kusano 7d535a
    00176 
    kusano 7d535a
    00177     This macro is not needed when using symamd.
    kusano 7d535a
    00178 
    kusano 7d535a
    00179     Explicit typecast to int added Sept. 23, 2002, COLAMD version 2.2, to avoid
    kusano 7d535a
    00180     gcc -pedantic warning messages.
    kusano 7d535a
    00181 */
    kusano 7d535a
    00182 
    kusano 7d535a
    00183 #define COLAMD_C(n_col) ((int) (((n_col) + 1) * sizeof (Colamd_Col) / sizeof (int)))
    kusano 7d535a
    00184 #define COLAMD_R(n_row) ((int) (((n_row) + 1) * sizeof (Colamd_Row) / sizeof (int)))
    kusano 7d535a
    00185 
    kusano 7d535a
    00186 #define COLAMD_RECOMMENDED(nnz, n_row, n_col)                                 \
    kusano 7d535a
    00187 (                                                                             \
    kusano 7d535a
    00188 ((nnz) < 0 || (n_row) < 0 || (n_col) < 0)                                     \
    kusano 7d535a
    00189 ?                                                                             \
    kusano 7d535a
    00190     (-1)                                                                      \
    kusano 7d535a
    00191 :                                                                             \
    kusano 7d535a
    00192     (2 * (nnz) + COLAMD_C (n_col) + COLAMD_R (n_row) + (n_col) + ((nnz) / 5)) \
    kusano 7d535a
    00193 )
    kusano 7d535a
    00194 
    kusano 7d535a
    00195 /* ========================================================================== */
    kusano 7d535a
    00196 /* === Prototypes of user-callable routines ================================= */
    kusano 7d535a
    00197 /* ========================================================================== */
    kusano 7d535a
    00198 
    kusano 7d535a
    00199 int colamd_recommended          /* returns recommended value of Alen, */
    kusano 7d535a
    00200                                 /* or (-1) if input arguments are erroneous */
    kusano 7d535a
    00201 (
    kusano 7d535a
    00202     int nnz,                    /* nonzeros in A */
    kusano 7d535a
    00203     int n_row,                  /* number of rows in A */
    kusano 7d535a
    00204     int n_col                   /* number of columns in A */
    kusano 7d535a
    00205 ) ;
    kusano 7d535a
    00206 
    kusano 7d535a
    00207 void colamd_set_defaults        /* sets default parameters */
    kusano 7d535a
    00208 (                               /* knobs argument is modified on output */
    kusano 7d535a
    00209     double knobs [COLAMD_KNOBS] /* parameter settings for colamd */
    kusano 7d535a
    00210 ) ;
    kusano 7d535a
    00211 
    kusano 7d535a
    00212 int colamd                      /* returns (1) if successful, (0) otherwise*/
    kusano 7d535a
    00213 (                               /* A and p arguments are modified on output */
    kusano 7d535a
    00214     int n_row,                  /* number of rows in A */
    kusano 7d535a
    00215     int n_col,                  /* number of columns in A */
    kusano 7d535a
    00216     int Alen,                   /* size of the array A */
    kusano 7d535a
    00217     int A [],                   /* row indices of A, of size Alen */
    kusano 7d535a
    00218     int p [],                   /* column pointers of A, of size n_col+1 */
    kusano 7d535a
    00219     double knobs [COLAMD_KNOBS],/* parameter settings for colamd */
    kusano 7d535a
    00220     int stats [COLAMD_STATS]    /* colamd output statistics and error codes */
    kusano 7d535a
    00221 ) ;
    kusano 7d535a
    00222 
    kusano 7d535a
    00223 int symamd                              /* return (1) if OK, (0) otherwise */
    kusano 7d535a
    00224 (
    kusano 7d535a
    00225     int n,                              /* number of rows and columns of A */
    kusano 7d535a
    00226     int A [],                           /* row indices of A */
    kusano 7d535a
    00227     int p [],                           /* column pointers of A */
    kusano 7d535a
    00228     int perm [],                        /* output permutation, size n_col+1 */
    kusano 7d535a
    00229     double knobs [COLAMD_KNOBS],        /* parameters (uses defaults if NULL) */
    kusano 7d535a
    00230     int stats [COLAMD_STATS],           /* output statistics and error codes */
    kusano 7d535a
    00231     void * (*allocate) (size_t, size_t),
    kusano 7d535a
    00232                                         /* pointer to calloc (ANSI C) or */
    kusano 7d535a
    00233                                         /* mxCalloc (for MATLAB mexFunction) */
    kusano 7d535a
    00234     void (*release) (void *)
    kusano 7d535a
    00235                                         /* pointer to free (ANSI C) or */
    kusano 7d535a
    00236                                         /* mxFree (for MATLAB mexFunction) */
    kusano 7d535a
    00237 ) ;
    kusano 7d535a
    00238 
    kusano 7d535a
    00239 void colamd_report
    kusano 7d535a
    00240 (
    kusano 7d535a
    00241     int stats [COLAMD_STATS]
    kusano 7d535a
    00242 ) ;
    kusano 7d535a
    00243 
    kusano 7d535a
    00244 void symamd_report
    kusano 7d535a
    00245 (
    kusano 7d535a
    00246     int stats [COLAMD_STATS]
    kusano 7d535a
    00247 ) ;
    kusano 7d535a
    00248 
    kusano 7d535a
    00249 #endif /* COLAMD_H */
    kusano 7d535a
    kusano 7d535a

    <address style="text-align: right;"><small>Generated on Mon Nov 22 10:23:47 2010 for SuperLU by </small></address>
    kusano 7d535a
    kusano 7d535a
    doxygen 1.5.5 
    kusano 7d535a
    kusano 7d535a