00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 #ifndef NDEBUG
00052 #define NDEBUG
00053 #endif
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 #include <stdlib.h>
00067 
00068 #if !defined(NPRINT) || !defined(NDEBUG)
00069 
00070 
00071 #include <stdio.h>
00072 #endif
00073 
00074 
00075 #include <limits.h>
00076 
00077 
00078 #include <math.h>
00079 
00080 
00081 
00082 
00083 
00084 #ifdef MATLAB_MEX_FILE
00085 #include "matrix.h"
00086 #include "mex.h"
00087 #endif
00088 
00089 
00090 
00091 
00092 
00093 #ifdef FLIP
00094 #undef FLIP
00095 #endif
00096 
00097 #ifdef MAX
00098 #undef MAX
00099 #endif
00100 
00101 #ifdef MIN
00102 #undef MIN
00103 #endif
00104 
00105 #ifdef EMPTY
00106 #undef EMPTY
00107 #endif
00108 
00109 #ifdef GLOBAL
00110 #undef GLOBAL
00111 #endif
00112 
00113 #ifdef PRIVATE
00114 #undef PRIVATE
00115 #endif
00116 
00117 
00118 
00119 
00120 
00121 #define EMPTY (-1)
00122 #define FLIP(i) (-(i)-2)
00123 #define UNFLIP(i) ((i < EMPTY) ? FLIP (i) : (i))
00124 
00125 
00126 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
00127 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
00128 
00129 
00130 #define IMPLIES(p,q) (!(p) || (q))
00131 
00132 
00133 
00134 #ifdef TRUE
00135 #undef TRUE
00136 #endif
00137 #ifdef FALSE
00138 #undef FALSE
00139 #endif
00140 
00141 #define TRUE (1)
00142 #define FALSE (0)
00143 #define PRIVATE static
00144 #define GLOBAL
00145 #define EMPTY (-1)
00146 
00147 
00148 
00149 
00150 #ifdef NULL
00151 #undef NULL
00152 #endif
00153 
00154 #define NULL 0
00155 
00156 
00157 #ifndef SIZE_T_MAX
00158 #define SIZE_T_MAX ((size_t) (-1))
00159 #endif
00160 
00161 
00162 
00163 
00164 
00165 
00166 #include "UFconfig.h"
00167 
00168 #if defined (DLONG) || defined (ZLONG)
00169 
00170 #define Int UF_long
00171 #define ID  UF_long_id
00172 #define Int_MAX UF_long_max
00173 
00174 #define CAMD_order camd_l_order
00175 #define CAMD_defaults camd_l_defaults
00176 #define CAMD_control camd_l_control
00177 #define CAMD_info camd_l_info
00178 #define CAMD_1 camd_l1
00179 #define CAMD_2 camd_l2
00180 #define CAMD_valid camd_l_valid
00181 #define CAMD_cvalid camd_l_cvalid
00182 #define CAMD_aat camd_l_aat
00183 #define CAMD_postorder camd_l_postorder
00184 #define CAMD_post_tree camd_l_post_tree
00185 #define CAMD_dump camd_l_dump
00186 #define CAMD_debug camd_l_debug
00187 #define CAMD_debug_init camd_l_debug_init
00188 #define CAMD_preprocess camd_l_preprocess
00189 
00190 #else
00191 
00192 #define Int int
00193 #define ID "%d"
00194 #define Int_MAX INT_MAX
00195 
00196 #define CAMD_order camd_order
00197 #define CAMD_defaults camd_defaults
00198 #define CAMD_control camd_control
00199 #define CAMD_info camd_info
00200 #define CAMD_1 camd_1
00201 #define CAMD_2 camd_2
00202 #define CAMD_valid camd_valid
00203 #define CAMD_cvalid camd_cvalid
00204 #define CAMD_aat camd_aat
00205 #define CAMD_postorder camd_postorder
00206 #define CAMD_post_tree camd_post_tree
00207 #define CAMD_dump camd_dump
00208 #define CAMD_debug camd_debug
00209 #define CAMD_debug_init camd_debug_init
00210 #define CAMD_preprocess camd_preprocess
00211 
00212 #endif
00213 
00214 
00215 
00216 
00217 
00218 
00219 #define PRINTF(params) { if (camd_printf != NULL) (void) camd_printf params ; }
00220 
00221 
00222 
00223 
00224 
00225 #include "camd.h"
00226 
00227 
00228 
00229 
00230 
00231 GLOBAL size_t CAMD_aat
00232 (
00233     Int n,
00234     const Int Ap [ ],
00235     const Int Ai [ ],
00236     Int Len [ ],
00237     Int Tp [ ],
00238     double Info [ ]
00239 ) ;
00240 
00241 GLOBAL void CAMD_1
00242 (
00243     Int n,
00244     const Int Ap [ ],
00245     const Int Ai [ ],
00246     Int P [ ],
00247     Int Pinv [ ],
00248     Int Len [ ],
00249     Int slen,
00250     Int S [ ],
00251     double Control [ ],
00252     double Info [ ],
00253     const Int C [ ]
00254 ) ;
00255 
00256 GLOBAL Int CAMD_postorder
00257 (
00258     Int j, Int k, Int n, Int head [], Int next [], Int post [], Int stack []
00259 ) ;
00260 
00261 GLOBAL void CAMD_preprocess
00262 (
00263     Int n,
00264     const Int Ap [ ],
00265     const Int Ai [ ],
00266     Int Rp [ ],
00267     Int Ri [ ],
00268     Int W [ ],
00269     Int Flag [ ]
00270 ) ;
00271 
00272 
00273 
00274 
00275 
00276 #ifndef NDEBUG
00277 
00278 
00279 #include <assert.h>
00280 
00281 #ifndef EXTERN
00282 #define EXTERN extern
00283 #endif
00284 
00285 EXTERN Int CAMD_debug ;
00286 
00287 GLOBAL void CAMD_debug_init ( char *s ) ;
00288 
00289 GLOBAL void CAMD_dump
00290 (
00291     Int n,
00292     Int Pe [ ],
00293     Int Iw [ ],
00294     Int Len [ ],
00295     Int iwlen,
00296     Int pfree,
00297     Int Nv [ ],
00298     Int Next [ ],
00299     Int Last [ ],
00300     Int Head [ ],
00301     Int Elen [ ],
00302     Int Degree [ ],
00303     Int W [ ],
00304     Int nel,
00305     Int BucketSet [],
00306     const Int C [],
00307     Int Curc
00308 ) ;
00309 
00310 #ifdef ASSERT
00311 #undef ASSERT
00312 #endif
00313 
00314 
00315 #ifdef MATLAB_MEX_FILE
00316 #define ASSERT(expression) (mxAssert ((expression), ""))
00317 #else
00318 #define ASSERT(expression) (assert (expression))
00319 #endif
00320 
00321 #define CAMD_DEBUG0(params) { PRINTF (params) ; }
00322 #define CAMD_DEBUG1(params) { if (CAMD_debug >= 1) PRINTF (params) ; }
00323 #define CAMD_DEBUG2(params) { if (CAMD_debug >= 2) PRINTF (params) ; }
00324 #define CAMD_DEBUG3(params) { if (CAMD_debug >= 3) PRINTF (params) ; }
00325 #define CAMD_DEBUG4(params) { if (CAMD_debug >= 4) PRINTF (params) ; }
00326 
00327 #else
00328 
00329 
00330 #define ASSERT(expression)
00331 #define CAMD_DEBUG0(params)
00332 #define CAMD_DEBUG1(params)
00333 #define CAMD_DEBUG2(params)
00334 #define CAMD_DEBUG3(params)
00335 #define CAMD_DEBUG4(params)
00336 
00337 #endif