Debian Codegraph @

external/glpk/amd_internal.h

raw
1 /* amd_internal.h */
2
3 /* Written by Andrew Makhorin <[email protected]>. */
4
5 #ifndef AMD_INTERNAL_H
6 #define AMD_INTERNAL_H
7
8 /* AMD will be exceedingly slow when running in debug mode. */
9 #if 1
10 #define NDEBUG
11 #endif
12
13 #include "amd.h"
14 #define _GLPSTD_STDIO
15 #include "glpenv.h"
16
17 #define Int int
18 #define ID "%d"
19 #define Int_MAX INT_MAX
20
21 #if !defined (SIZE_T_MAX)
22 #define SIZE_T_MAX ((size_t)(-1)) // ifndef'ed by ppgb
23 #endif
24
25 #define EMPTY (-1)
26 #define FLIP(i) (-(i)-2)
27 #define UNFLIP(i) ((i < EMPTY) ? FLIP (i) : (i))
28
29 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
30 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
31
32 #define IMPLIES(p, q) (!(p) || (q))
33
34 #define GLOBAL
35
36 #define AMD_order amd_order
37 #define AMD_defaults amd_defaults
38 #define AMD_control amd_control
39 #define AMD_info amd_info
40 #define AMD_1 amd_1
41 #define AMD_2 amd_2
42 #define AMD_valid amd_valid
43 #define AMD_aat amd_aat
44 #define AMD_postorder amd_postorder
45 #define AMD_post_tree amd_post_tree
46 #define AMD_dump amd_dump
47 #define AMD_debug amd_debug
48 #define AMD_debug_init amd_debug_init
49 #define AMD_preprocess amd_preprocess
50
51 #define amd_malloc xmalloc
52 #if 0 /* 24/V-2009 */
53 #define amd_free xfree
54 #else
55 #define amd_free(ptr) { if ((ptr) != NULL) xfree(ptr); }
56 #endif
57 #define amd_printf xprintf
58
59 #define PRINTF(params) { amd_printf params; }
60
61 #ifndef NDEBUG
62 #define ASSERT(expr) xassert(expr)
63 #define AMD_DEBUG0(params) { PRINTF(params); }
64 #define AMD_DEBUG1(params) { if (AMD_debug >= 1) PRINTF(params); }
65 #define AMD_DEBUG2(params) { if (AMD_debug >= 2) PRINTF(params); }
66 #define AMD_DEBUG3(params) { if (AMD_debug >= 3) PRINTF(params); }
67 #define AMD_DEBUG4(params) { if (AMD_debug >= 4) PRINTF(params); }
68 #else
69 #define ASSERT(expression)
70 #define AMD_DEBUG0(params)
71 #define AMD_DEBUG1(params)
72 #define AMD_DEBUG2(params)
73 #define AMD_DEBUG3(params)
74 #define AMD_DEBUG4(params)
75 #endif
76
77 #define amd_aat _glp_amd_aat
78 size_t AMD_aat(Int n, const Int Ap[], const Int Ai[], Int Len[],
79 Int Tp[], double Info[]);
80
81 #define amd_1 _glp_amd_1
82 void AMD_1(Int n, const Int Ap[], const Int Ai[], Int P[], Int Pinv[],
83 Int Len[], Int slen, Int S[], double Control[], double Info[]);
84
85 #define amd_postorder _glp_amd_postorder
86 void AMD_postorder(Int nn, Int Parent[], Int Npiv[], Int Fsize[],
87 Int Order[], Int Child[], Int Sibling[], Int Stack[]);
88
89 #define amd_post_tree _glp_amd_post_tree
90 #ifndef NDEBUG
91 Int AMD_post_tree(Int root, Int k, Int Child[], const Int Sibling[],
92 Int Order[], Int Stack[], Int nn);
93 #else
94 Int AMD_post_tree(Int root, Int k, Int Child[], const Int Sibling[],
95 Int Order[], Int Stack[]);
96 #endif
97
98 #define amd_preprocess _glp_amd_preprocess
99 void AMD_preprocess(Int n, const Int Ap[], const Int Ai[], Int Rp[],
100 Int Ri[], Int W[], Int Flag[]);
101
102 #define amd_debug _glp_amd_debug
103 extern Int AMD_debug;
104
105 #define amd_debug_init _glp_amd_debug_init
106 void AMD_debug_init(char *s);
107
108 #define amd_dump _glp_amd_dump
109 void AMD_dump(Int n, Int Pe[], Int Iw[], Int Len[], Int iwlen,
110 Int pfree, Int Nv[], Int Next[], Int Last[], Int Head[],
111 Int Elen[], Int Degree[], Int W[], Int nel);
112
113 #endif
114
115 /* eof */