alpar@1: /* amd_internal.h */ alpar@1: alpar@1: /* Written by Andrew Makhorin . */ alpar@1: alpar@1: #ifndef AMD_INTERNAL_H alpar@1: #define AMD_INTERNAL_H alpar@1: alpar@1: /* AMD will be exceedingly slow when running in debug mode. */ alpar@1: #if 1 alpar@1: #define NDEBUG alpar@1: #endif alpar@1: alpar@1: #include "amd.h" alpar@1: #define _GLPSTD_STDIO alpar@1: #include "glpenv.h" alpar@1: alpar@1: #define Int int alpar@1: #define ID "%d" alpar@1: #define Int_MAX INT_MAX alpar@1: alpar@1: #define SIZE_T_MAX ((size_t)(-1)) alpar@1: alpar@1: #define EMPTY (-1) alpar@1: #define FLIP(i) (-(i)-2) alpar@1: #define UNFLIP(i) ((i < EMPTY) ? FLIP (i) : (i)) alpar@1: alpar@1: #define MAX(a,b) (((a) > (b)) ? (a) : (b)) alpar@1: #define MIN(a,b) (((a) < (b)) ? (a) : (b)) alpar@1: alpar@1: #define IMPLIES(p, q) (!(p) || (q)) alpar@1: alpar@1: #define GLOBAL alpar@1: alpar@1: #define AMD_order amd_order alpar@1: #define AMD_defaults amd_defaults alpar@1: #define AMD_control amd_control alpar@1: #define AMD_info amd_info alpar@1: #define AMD_1 amd_1 alpar@1: #define AMD_2 amd_2 alpar@1: #define AMD_valid amd_valid alpar@1: #define AMD_aat amd_aat alpar@1: #define AMD_postorder amd_postorder alpar@1: #define AMD_post_tree amd_post_tree alpar@1: #define AMD_dump amd_dump alpar@1: #define AMD_debug amd_debug alpar@1: #define AMD_debug_init amd_debug_init alpar@1: #define AMD_preprocess amd_preprocess alpar@1: alpar@1: #define amd_malloc xmalloc alpar@1: #if 0 /* 24/V-2009 */ alpar@1: #define amd_free xfree alpar@1: #else alpar@1: #define amd_free(ptr) { if ((ptr) != NULL) xfree(ptr); } alpar@1: #endif alpar@1: #define amd_printf xprintf alpar@1: alpar@1: #define PRINTF(params) { amd_printf params; } alpar@1: alpar@1: #ifndef NDEBUG alpar@1: #define ASSERT(expr) xassert(expr) alpar@1: #define AMD_DEBUG0(params) { PRINTF(params); } alpar@1: #define AMD_DEBUG1(params) { if (AMD_debug >= 1) PRINTF(params); } alpar@1: #define AMD_DEBUG2(params) { if (AMD_debug >= 2) PRINTF(params); } alpar@1: #define AMD_DEBUG3(params) { if (AMD_debug >= 3) PRINTF(params); } alpar@1: #define AMD_DEBUG4(params) { if (AMD_debug >= 4) PRINTF(params); } alpar@1: #else alpar@1: #define ASSERT(expression) alpar@1: #define AMD_DEBUG0(params) alpar@1: #define AMD_DEBUG1(params) alpar@1: #define AMD_DEBUG2(params) alpar@1: #define AMD_DEBUG3(params) alpar@1: #define AMD_DEBUG4(params) alpar@1: #endif alpar@1: alpar@1: #define amd_aat _glp_amd_aat alpar@1: size_t AMD_aat(Int n, const Int Ap[], const Int Ai[], Int Len[], alpar@1: Int Tp[], double Info[]); alpar@1: alpar@1: #define amd_1 _glp_amd_1 alpar@1: void AMD_1(Int n, const Int Ap[], const Int Ai[], Int P[], Int Pinv[], alpar@1: Int Len[], Int slen, Int S[], double Control[], double Info[]); alpar@1: alpar@1: #define amd_postorder _glp_amd_postorder alpar@1: void AMD_postorder(Int nn, Int Parent[], Int Npiv[], Int Fsize[], alpar@1: Int Order[], Int Child[], Int Sibling[], Int Stack[]); alpar@1: alpar@1: #define amd_post_tree _glp_amd_post_tree alpar@1: #ifndef NDEBUG alpar@1: Int AMD_post_tree(Int root, Int k, Int Child[], const Int Sibling[], alpar@1: Int Order[], Int Stack[], Int nn); alpar@1: #else alpar@1: Int AMD_post_tree(Int root, Int k, Int Child[], const Int Sibling[], alpar@1: Int Order[], Int Stack[]); alpar@1: #endif alpar@1: alpar@1: #define amd_preprocess _glp_amd_preprocess alpar@1: void AMD_preprocess(Int n, const Int Ap[], const Int Ai[], Int Rp[], alpar@1: Int Ri[], Int W[], Int Flag[]); alpar@1: alpar@1: #define amd_debug _glp_amd_debug alpar@1: extern Int AMD_debug; alpar@1: alpar@1: #define amd_debug_init _glp_amd_debug_init alpar@1: void AMD_debug_init(char *s); alpar@1: alpar@1: #define amd_dump _glp_amd_dump alpar@1: void AMD_dump(Int n, Int Pe[], Int Iw[], Int Len[], Int iwlen, alpar@1: Int pfree, Int Nv[], Int Next[], Int Last[], Int Head[], alpar@1: Int Elen[], Int Degree[], Int W[], Int nel); alpar@1: alpar@1: #endif alpar@1: alpar@1: /* eof */