3 /* Written by Andrew Makhorin <mao@gnu.org>. */
8 /* AMD will be exceedingly slow when running in debug mode. */
19 #define Int_MAX INT_MAX
21 #define SIZE_T_MAX ((size_t)(-1))
24 #define FLIP(i) (-(i)-2)
25 #define UNFLIP(i) ((i < EMPTY) ? FLIP (i) : (i))
27 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
28 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
30 #define IMPLIES(p, q) (!(p) || (q))
34 #define AMD_order amd_order
35 #define AMD_defaults amd_defaults
36 #define AMD_control amd_control
37 #define AMD_info amd_info
40 #define AMD_valid amd_valid
41 #define AMD_aat amd_aat
42 #define AMD_postorder amd_postorder
43 #define AMD_post_tree amd_post_tree
44 #define AMD_dump amd_dump
45 #define AMD_debug amd_debug
46 #define AMD_debug_init amd_debug_init
47 #define AMD_preprocess amd_preprocess
49 #define amd_malloc xmalloc
51 #define amd_free xfree
53 #define amd_free(ptr) { if ((ptr) != NULL) xfree(ptr); }
55 #define amd_printf xprintf
57 #define PRINTF(params) { amd_printf params; }
60 #define ASSERT(expr) xassert(expr)
61 #define AMD_DEBUG0(params) { PRINTF(params); }
62 #define AMD_DEBUG1(params) { if (AMD_debug >= 1) PRINTF(params); }
63 #define AMD_DEBUG2(params) { if (AMD_debug >= 2) PRINTF(params); }
64 #define AMD_DEBUG3(params) { if (AMD_debug >= 3) PRINTF(params); }
65 #define AMD_DEBUG4(params) { if (AMD_debug >= 4) PRINTF(params); }
67 #define ASSERT(expression)
68 #define AMD_DEBUG0(params)
69 #define AMD_DEBUG1(params)
70 #define AMD_DEBUG2(params)
71 #define AMD_DEBUG3(params)
72 #define AMD_DEBUG4(params)
75 #define amd_aat _glp_amd_aat
76 size_t AMD_aat(Int n, const Int Ap[], const Int Ai[], Int Len[],
77 Int Tp[], double Info[]);
79 #define amd_1 _glp_amd_1
80 void AMD_1(Int n, const Int Ap[], const Int Ai[], Int P[], Int Pinv[],
81 Int Len[], Int slen, Int S[], double Control[], double Info[]);
83 #define amd_postorder _glp_amd_postorder
84 void AMD_postorder(Int nn, Int Parent[], Int Npiv[], Int Fsize[],
85 Int Order[], Int Child[], Int Sibling[], Int Stack[]);
87 #define amd_post_tree _glp_amd_post_tree
89 Int AMD_post_tree(Int root, Int k, Int Child[], const Int Sibling[],
90 Int Order[], Int Stack[], Int nn);
92 Int AMD_post_tree(Int root, Int k, Int Child[], const Int Sibling[],
93 Int Order[], Int Stack[]);
96 #define amd_preprocess _glp_amd_preprocess
97 void AMD_preprocess(Int n, const Int Ap[], const Int Ai[], Int Rp[],
98 Int Ri[], Int W[], Int Flag[]);
100 #define amd_debug _glp_amd_debug
101 extern Int AMD_debug;
103 #define amd_debug_init _glp_amd_debug_init
104 void AMD_debug_init(char *s);
106 #define amd_dump _glp_amd_dump
107 void AMD_dump(Int n, Int Pe[], Int Iw[], Int Len[], Int iwlen,
108 Int pfree, Int Nv[], Int Next[], Int Last[], Int Head[],
109 Int Elen[], Int Degree[], Int W[], Int nel);