LADEL main
Sparse LDL factorization package with rank 1 and rowadd/rowdel updates
ladel_constants.h
Go to the documentation of this file.
1/**
2 * @file ladel_constants.h
3 * @author Ben Hermans
4 * @brief Constants and macros used in LADEL.
5 */
6
7#ifndef LADEL_CONSTANTS_H
8#define LADEL_CONSTANTS_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14/**
15 * @defgroup grp-constants Constants
16 * @brief Constants that can be passed to functions.
17 * @{
18 */
19
20
21#define TRUE 1 /**< For booleans */
22#define FALSE 0 /**< For booleans */
23
24#define SUCCESS 1 /**< For status returns */
25#define FAIL -1 /**< For status returns */
26
27#define NONE -1 /**< Indicates a root (a node without parent), or an untouched node */
28
29#define UNSYMMETRIC 0 /**< No symmetry is assumed in the matrix */
30#define UPPER 1 /**< Use only upper part of matrix */
31#define LOWER -1 /**< Use only lower part of matrix */
32
33#define AMD 1 /**< Ordering method during the symbolic part of the factorization */
34#define NO_ORDERING 0 /**< No ordering is performed during the symbolic part of the factorization */
35#define GIVEN_ORDERING 2 /**< The ordering was computed previously and is already stored in sym->p */
36
37#define MARKED 1 /**< Indicate whether a node is marked */
38#define UNMARKED 0 /**< Indicate whether a node is not marked */
39
40#define SET_HAS_CHANGED TRUE /**< Possible return value of ladel_set_union indicating the set has changed */
41#define SET_HAS_NOT_CHANGED FALSE /**< Possible return value of ladel_set_union indicating the set has not changed */
42#define MAX_SET_SIZE_EXCEEDED NONE /**< Possible return value of ladel_set_union indicating the set has grown beyond the maximum size */
43
44#define UPDATE TRUE /**< Flag in rank1_update to perform an update */
45#define DOWNDATE FALSE /**< Flag in rank1_update to perform a downdate */
46
47/**
48 * @}
49 */
50
51/**
52 * @defgroup grp-macros Macros
53 * @brief Utility macros.
54 * @{
55 */
56
57#define LADEL_MAX(a, b) ((a) > (b) ? (a) : (b)) /**< Return the maximum of two numbers */
58#define LADEL_MIN(a, b) ((a) > (b) ? (b) : (a)) /**< Return the minimum of two numbers */
59#define LADEL_ABS(a) ((a) < 0 ? -(a) : (a)) /**< Return the absolute value a number */
60
61#define LADEL_FOR(index, M, col) for(index = (M)->p[(col)]; index < (((M)->nz) ? (M)->p[(col)] + (M)->nz[(col)] : (M)->p[(col)+1]); index++) /**< Loop through a column of a sparse matrix */
62
63#define IS_ROOT(col, etree) ((etree)[(col)] == NONE) /**< Check whether a node is a root (i.e. has no parent) */
64
65#define MARK(nodes, k) (nodes[(k)] = MARKED) /**< Mark the k-th node */
66#define UNMARK(nodes, k) (nodes[(k)] = UNMARKED) /**< Unmark the k-th node */
67#define IS_MARKED(nodes, k) (nodes[(k)] == MARKED) /**< Check whether the k-th node is marked */
68
69/**
70 * @}
71 */
72
73#ifdef __cplusplus
74}
75#endif
76
77#endif /*LADEL_CONSTANTS_H*/