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