src/amd/amd_internal.h
author Alpar Juttner <alpar@cs.elte.hu>
Sun, 05 Dec 2010 17:35:23 +0100
changeset 2 4c8956a7bdf4
permissions -rw-r--r--
Set up CMAKE build environment
     1 /* amd_internal.h */
     2 
     3 /* Written by Andrew Makhorin <mao@gnu.org>. */
     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 #define SIZE_T_MAX ((size_t)(-1))
    22 
    23 #define EMPTY (-1)
    24 #define FLIP(i) (-(i)-2)
    25 #define UNFLIP(i) ((i < EMPTY) ? FLIP (i) : (i))
    26 
    27 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
    28 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
    29 
    30 #define IMPLIES(p, q) (!(p) || (q))
    31 
    32 #define GLOBAL
    33 
    34 #define AMD_order amd_order
    35 #define AMD_defaults amd_defaults
    36 #define AMD_control amd_control
    37 #define AMD_info amd_info
    38 #define AMD_1 amd_1
    39 #define AMD_2 amd_2
    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
    48 
    49 #define amd_malloc xmalloc
    50 #if 0 /* 24/V-2009 */
    51 #define amd_free xfree
    52 #else
    53 #define amd_free(ptr) { if ((ptr) != NULL) xfree(ptr); } 
    54 #endif
    55 #define amd_printf xprintf
    56 
    57 #define PRINTF(params) { amd_printf params; }
    58 
    59 #ifndef NDEBUG
    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); }
    66 #else
    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)
    73 #endif
    74 
    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[]);
    78 
    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[]);
    82 
    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[]);
    86 
    87 #define amd_post_tree _glp_amd_post_tree
    88 #ifndef NDEBUG
    89 Int AMD_post_tree(Int root, Int k, Int Child[], const Int Sibling[],
    90       Int Order[], Int Stack[], Int nn);
    91 #else
    92 Int AMD_post_tree(Int root, Int k, Int Child[], const Int Sibling[],
    93       Int Order[], Int Stack[]);
    94 #endif
    95 
    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[]);
    99 
   100 #define amd_debug _glp_amd_debug
   101 extern Int AMD_debug;
   102 
   103 #define amd_debug_init _glp_amd_debug_init
   104 void AMD_debug_init(char *s);
   105 
   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);
   110 
   111 #endif
   112 
   113 /* eof */