00001 00002 /* ========================================================================== */ 00003 /* === colamd/symamd prototypes and definitions ============================= */ 00004 /* ========================================================================== */ 00005 00006 /* COLAMD / SYMAMD include file 00007 00008 You must include this file (colamd.h) in any routine that uses colamd, 00009 symamd, or the related macros and definitions. 00010 00011 Authors: 00012 00013 The authors of the code itself are Stefan I. Larimore and Timothy A. 00014 Davis (DrTimothyAldenDavis@gmail.com). The algorithm was 00015 developed in collaboration with John Gilbert, Xerox PARC, and Esmond 00016 Ng, Oak Ridge National Laboratory. 00017 00018 Acknowledgements: 00019 00020 This work was supported by the National Science Foundation, under 00021 grants DMS-9504974 and DMS-9803599. 00022 00023 Notice: 00024 00025 Copyright (c) 1998-2007, Timothy A. Davis, All Rights Reserved. 00026 00027 THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY 00028 EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 00029 00030 Permission is hereby granted to use, copy, modify, and/or distribute 00031 this program, provided that the Copyright, this License, and the 00032 Availability of the original version is retained on all copies and made 00033 accessible to the end-user of any code or package that includes COLAMD 00034 or any modified version of COLAMD. 00035 00036 Availability: 00037 00038 The colamd/symamd library is available at http://www.suitesparse.com 00039 This file is required by the colamd.c, colamdmex.c, and symamdmex.c 00040 files, and by any C code that calls the routines whose prototypes are 00041 listed below, or that uses the colamd/symamd definitions listed below. 00042 00043 */ 00044 00045 #ifndef COLAMD_H 00046 #define COLAMD_H 00047 00048 /* make it easy for C++ programs to include COLAMD */ 00049 #ifdef __cplusplus 00050 extern "C" { 00051 #endif 00052 00053 #if defined ( _LONGINT ) 00054 #define DLONG 00055 #endif 00056 00057 00058 /* ========================================================================== */ 00059 /* === Include files ======================================================== */ 00060 /* ========================================================================== */ 00061 00062 #include <stdlib.h> 00063 00064 /* ========================================================================== */ 00065 /* === COLAMD version ======================================================= */ 00066 /* ========================================================================== */ 00067 00068 /* COLAMD Version 2.4 and later will include the following definitions. 00069 * As an example, to test if the version you are using is 2.4 or later: 00070 * 00071 * #ifdef COLAMD_VERSION 00072 * if (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) ... 00073 * #endif 00074 * 00075 * This also works during compile-time: 00076 * 00077 * #if defined(COLAMD_VERSION) && (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) 00078 * printf ("This is version 2.4 or later\n") ; 00079 * #else 00080 * printf ("This is an early version\n") ; 00081 * #endif 00082 * 00083 * Versions 2.3 and earlier of COLAMD do not include a #define'd version number. 00084 */ 00085 00086 #define COLAMD_DATE "Oct 10, 2014" 00087 #define COLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) 00088 #define COLAMD_MAIN_VERSION 2 00089 #define COLAMD_SUB_VERSION 9 00090 #define COLAMD_SUBSUB_VERSION 1 00091 #define COLAMD_VERSION \ 00092 COLAMD_VERSION_CODE(COLAMD_MAIN_VERSION,COLAMD_SUB_VERSION) 00093 00094 /* ========================================================================== */ 00095 /* === Knob and statistics definitions ====================================== */ 00096 /* ========================================================================== */ 00097 00098 /* size of the knobs [ ] array. Only knobs [0..1] are currently used. */ 00099 #define COLAMD_KNOBS 20 00100 00101 /* number of output statistics. Only stats [0..6] are currently used. */ 00102 #define COLAMD_STATS 20 00103 00104 /* knobs [0] and stats [0]: dense row knob and output statistic. */ 00105 #define COLAMD_DENSE_ROW 0 00106 00107 /* knobs [1] and stats [1]: dense column knob and output statistic. */ 00108 #define COLAMD_DENSE_COL 1 00109 00110 /* knobs [2]: aggressive absorption */ 00111 #define COLAMD_AGGRESSIVE 2 00112 00113 /* stats [2]: memory defragmentation count output statistic */ 00114 #define COLAMD_DEFRAG_COUNT 2 00115 00116 /* stats [3]: colamd status: zero OK, > 0 warning or notice, < 0 error */ 00117 #define COLAMD_STATUS 3 00118 00119 /* stats [4..6]: error info, or info on jumbled columns */ 00120 #define COLAMD_INFO1 4 00121 #define COLAMD_INFO2 5 00122 #define COLAMD_INFO3 6 00123 00124 /* error codes returned in stats [3]: */ 00125 #define COLAMD_OK (0) 00126 #define COLAMD_OK_BUT_JUMBLED (1) 00127 #define COLAMD_ERROR_A_not_present (-1) 00128 #define COLAMD_ERROR_p_not_present (-2) 00129 #define COLAMD_ERROR_nrow_negative (-3) 00130 #define COLAMD_ERROR_ncol_negative (-4) 00131 #define COLAMD_ERROR_nnz_negative (-5) 00132 #define COLAMD_ERROR_p0_nonzero (-6) 00133 #define COLAMD_ERROR_A_too_small (-7) 00134 #define COLAMD_ERROR_col_length_negative (-8) 00135 #define COLAMD_ERROR_row_index_out_of_bounds (-9) 00136 #define COLAMD_ERROR_out_of_memory (-10) 00137 #define COLAMD_ERROR_internal_error (-999) 00138 00139 00140 #define SUITESPARSE_PRINTF printf 00141 00142 00143 /* ========================================================================== */ 00144 /* === Prototypes of user-callable routines ================================= */ 00145 /* ========================================================================== */ 00146 00147 /*#include "SuiteSparse_config.h" */ 00148 /**** The following is from SuiteSparse_config.h ****/ 00149 #ifndef SuiteSparse_long 00150 00151 #ifdef _WIN64 00152 00153 #define SuiteSparse_long __int64 00154 #define SuiteSparse_long_max _I64_MAX 00155 #define SuiteSparse_long_idd "I64d" 00156 00157 #else 00158 00159 #if 0 /* commented out by Sherry */ 00160 #define SuiteSparse_long long 00161 #define SuiteSparse_long_max LONG_MAX 00162 #define SuiteSparse_long_idd "ld" 00163 #endif 00164 #define SuiteSparse_long long long int 00165 #define SuiteSparse_long_max LONG_MAX 00166 #define SuiteSparse_long_idd "lld" 00167 00168 #endif 00169 #define SuiteSparse_long_id "%" SuiteSparse_long_idd 00170 #endif 00171 /**** end from SuiteSparse_config.h ********/ 00172 00173 00174 /* ========================================================================== */ 00175 /* === int or SuiteSparse_long ============================================== */ 00176 /* ========================================================================== */ 00177 00178 #ifdef DLONG 00179 00180 #define Int SuiteSparse_long 00181 #define ID SuiteSparse_long_id 00182 #define Int_MAX SuiteSparse_long_max 00183 00184 #define COLAMD_recommended colamd_l_recommended 00185 #define COLAMD_set_defaults colamd_l_set_defaults 00186 #define COLAMD_MAIN colamd_l 00187 #define SYMAMD_MAIN symamd_l 00188 #define COLAMD_report colamd_l_report 00189 #define SYMAMD_report symamd_l_report 00190 00191 #else 00192 00193 #define Int int 00194 #define ID "%d" 00195 #define Int_MAX INT_MAX 00196 00197 #define COLAMD_recommended colamd_recommended 00198 #define COLAMD_set_defaults colamd_set_defaults 00199 #define COLAMD_MAIN colamd 00200 #define SYMAMD_MAIN symamd 00201 #define COLAMD_report colamd_report 00202 #define SYMAMD_report symamd_report 00203 00204 #endif 00205 00206 00207 size_t colamd_recommended /* returns recommended value of Alen, */ 00208 /* or 0 if input arguments are erroneous */ 00209 ( 00210 int nnz, /* nonzeros in A */ 00211 int n_row, /* number of rows in A */ 00212 int n_col /* number of columns in A */ 00213 ) ; 00214 00215 size_t colamd_l_recommended /* returns recommended value of Alen, */ 00216 /* or 0 if input arguments are erroneous */ 00217 ( 00218 SuiteSparse_long nnz, /* nonzeros in A */ 00219 SuiteSparse_long n_row, /* number of rows in A */ 00220 SuiteSparse_long n_col /* number of columns in A */ 00221 ) ; 00222 00223 void colamd_set_defaults /* sets default parameters */ 00224 ( /* knobs argument is modified on output */ 00225 double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ 00226 ) ; 00227 00228 void colamd_l_set_defaults /* sets default parameters */ 00229 ( /* knobs argument is modified on output */ 00230 double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ 00231 ) ; 00232 00233 int colamd /* returns (1) if successful, (0) otherwise*/ 00234 ( /* A and p arguments are modified on output */ 00235 int n_row, /* number of rows in A */ 00236 int n_col, /* number of columns in A */ 00237 int Alen, /* size of the array A */ 00238 int A [], /* row indices of A, of size Alen */ 00239 int p [], /* column pointers of A, of size n_col+1 */ 00240 double knobs [COLAMD_KNOBS],/* parameter settings for colamd */ 00241 int stats [COLAMD_STATS] /* colamd output statistics and error codes */ 00242 ) ; 00243 00244 SuiteSparse_long colamd_l /* returns (1) if successful, (0) otherwise*/ 00245 ( /* A and p arguments are modified on output */ 00246 SuiteSparse_long n_row, /* number of rows in A */ 00247 SuiteSparse_long n_col, /* number of columns in A */ 00248 SuiteSparse_long Alen, /* size of the array A */ 00249 SuiteSparse_long A [], /* row indices of A, of size Alen */ 00250 SuiteSparse_long p [], /* column pointers of A, of size n_col+1 */ 00251 double knobs [COLAMD_KNOBS],/* parameter settings for colamd */ 00252 SuiteSparse_long stats [COLAMD_STATS] /* colamd output statistics 00253 * and error codes */ 00254 ) ; 00255 00256 int symamd /* return (1) if OK, (0) otherwise */ 00257 ( 00258 int n, /* number of rows and columns of A */ 00259 int A [], /* row indices of A */ 00260 int p [], /* column pointers of A */ 00261 int perm [], /* output permutation, size n_col+1 */ 00262 double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */ 00263 int stats [COLAMD_STATS], /* output statistics and error codes */ 00264 void * (*allocate) (size_t, size_t), 00265 /* pointer to calloc (ANSI C) or */ 00266 /* mxCalloc (for MATLAB mexFunction) */ 00267 void (*release) (void *) 00268 /* pointer to free (ANSI C) or */ 00269 /* mxFree (for MATLAB mexFunction) */ 00270 ) ; 00271 00272 SuiteSparse_long symamd_l /* return (1) if OK, (0) otherwise */ 00273 ( 00274 SuiteSparse_long n, /* number of rows and columns of A */ 00275 SuiteSparse_long A [], /* row indices of A */ 00276 SuiteSparse_long p [], /* column pointers of A */ 00277 SuiteSparse_long perm [], /* output permutation, size n_col+1 */ 00278 double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */ 00279 SuiteSparse_long stats [COLAMD_STATS], /* output stats and error codes */ 00280 void * (*allocate) (size_t, size_t), 00281 /* pointer to calloc (ANSI C) or */ 00282 /* mxCalloc (for MATLAB mexFunction) */ 00283 void (*release) (void *) 00284 /* pointer to free (ANSI C) or */ 00285 /* mxFree (for MATLAB mexFunction) */ 00286 ) ; 00287 00288 void colamd_report 00289 ( 00290 int stats [COLAMD_STATS] 00291 ) ; 00292 00293 void colamd_l_report 00294 ( 00295 SuiteSparse_long stats [COLAMD_STATS] 00296 ) ; 00297 00298 void symamd_report 00299 ( 00300 int stats [COLAMD_STATS] 00301 ) ; 00302 00303 void symamd_l_report 00304 ( 00305 SuiteSparse_long stats [COLAMD_STATS] 00306 ) ; 00307 00308 #ifdef __cplusplus 00309 } 00310 #endif 00311 00312 #endif /* COLAMD_H */
1.6.1