amd_internal.h 3.0 KB

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