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