PaStiX Handbook  6.3.2
elimintree.h
Go to the documentation of this file.
1 /**
2  *
3  * @file elimintree.h
4  *
5  * PaStiX analyse elimin tree and graph header
6  *
7  * @copyright 1998-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8  * Univ. Bordeaux. All rights reserved.
9  *
10  * @version 6.3.2
11  * @author Pascal Henon
12  * @author Mathieu Faverge
13  * @date 2023-07-21
14  *
15  * @addtogroup blend_dev_elim
16  * @{
17  *
18  **/
19 #ifndef _elimintree_h_
20 #define _elimintree_h_
21 
22 /**
23  * @brief Node of the elimination tree.
24  */
25 typedef struct etree_node_s {
26  double ndecost; /**< Cost of the tree node only (compute + send) */
27  double ndepath; /**< Critical path of the tree node only */
28  double subcost; /**< Cost of the subtree (including node) */
29  double subpath; /**< Critical path of the subtree (including node) */
30  int ndlevel; /**< Node depth in the elimination tree */
31  int sonsnbr; /**< Number of sons */
32  pastix_int_t fathnum; /**< index of the father node */
33  pastix_int_t fsonnum; /**< index of first son */
35 
36 /**
37  * @brief Elimination tree.
38  */
39 typedef struct etree_s {
40  pastix_int_t baseval; /**< Base value for numberings */
41  pastix_int_t nodenbr; /**< Number of nodes */
42  eTreeNode_t * nodetab; /**< Array of node [+1,based] */
43  pastix_int_t * sonstab; /**< Sons index of nodes */
45 
47 void eTreeExit ( EliminTree *);
48 void eTreeGenDot (const EliminTree *, FILE *);
49 void eTreePrint (const EliminTree *, FILE *, pastix_int_t );
50 void eTreeSetSons ( EliminTree *);
55 
58 
59 /**
60  *******************************************************************************
61  *
62  * @brief Return the father of a given node.
63  *
64  *******************************************************************************
65  *
66  * @param[in] etree
67  * Pointer to the elimination tree structure.
68  *
69  * @param[in] node
70  * The node of interest.
71  *
72  *******************************************************************************
73  *
74  * @return The father of the node.
75  *
76  *******************************************************************************/
77 static inline eTreeNode_t *
78 eTreeFather( const EliminTree *etree, pastix_int_t node )
79 {
80  return etree->nodetab + etree->nodetab[node].fathnum;
81 }
82 
83 /**
84  *******************************************************************************
85  *
86  * @brief Return the i^{th} son of a given node.
87  *
88  *******************************************************************************
89  *
90  * @param[in] etree
91  * Pointer to the elimination tree structure.
92  *
93  * @param[in] node
94  * The node of interest.
95  *
96  * @param[in] i
97  * The index of the son wanted.
98  *
99  *******************************************************************************
100  *
101  * @return The index of the i^{th} son of the node.
102  *
103  *******************************************************************************/
104 static inline pastix_int_t
106 {
107  return etree->sonstab[ etree->nodetab[node].fsonnum + i ];
108 }
109 
110 /**
111  *******************************************************************************
112  *
113  * @brief Return the root of the elimination tree.
114  *
115  *******************************************************************************
116  *
117  * @param[in] etree
118  * Pointer to the elimination tree structure.
119  *
120  *******************************************************************************
121  *
122  * @return The index of the root in the elimination tree.
123  *
124  *******************************************************************************/
125 static inline pastix_int_t
126 eTreeRoot( const EliminTree *etree )
127 {
128  (void)etree;
129  return -1;
130 }
131 
132 #endif /* _elimintree_h_ */
133 
134 /**
135  *@}
136  */
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
double subpath
Definition: elimintree.h:29
double subcost
Definition: elimintree.h:28
double ndepath
Definition: elimintree.h:27
double ndecost
Definition: elimintree.h:26
pastix_int_t fsonnum
Definition: elimintree.h:33
pastix_int_t * sonstab
Definition: elimintree.h:43
pastix_int_t nodenbr
Definition: elimintree.h:41
pastix_int_t baseval
Definition: elimintree.h:40
eTreeNode_t * nodetab
Definition: elimintree.h:42
pastix_int_t fathnum
Definition: elimintree.h:32
static eTreeNode_t * eTreeFather(const EliminTree *etree, pastix_int_t node)
Return the father of a given node.
Definition: elimintree.h:78
static pastix_int_t eTreeRoot(const EliminTree *etree)
Return the root of the elimination tree.
Definition: elimintree.h:126
static pastix_int_t eTreeSonI(const EliminTree *etree, pastix_int_t node, pastix_int_t i)
Return the i^{th} son of a given node.
Definition: elimintree.h:105
void eTreeSetSons(EliminTree *)
Set the fsonnum fields base on the initialized sonsnbr.
Definition: elimintree.c:142
void eTreeGenDot(const EliminTree *, FILE *)
Print the elimination tree in a dot file.
Definition: elimintree.c:323
EliminTree * eTreeInit(pastix_int_t)
Initialize the elimination tree structure.
Definition: elimintree.c:43
struct etree_s EliminTree
Elimination tree.
pastix_int_t eTreeLeavesNbr(const EliminTree *)
Compute the number of leaves.
Definition: elimintree.c:179
EliminTree * eTreeBuild(const symbol_matrix_t *)
Build the elimination tree.
Definition: elimintree.c:478
pastix_int_t eTreeGetLevelMinIdx(const EliminTree *, pastix_int_t, pastix_int_t, pastix_int_t)
Return the smallest index of the nodes belonging to the level lvl in the elimination tree.
Definition: elimintree.c:429
void eTreePrint(const EliminTree *, FILE *, pastix_int_t)
Print the elimination tree in a human readable format.
Definition: elimintree.c:378
pastix_int_t eTreeComputeLevels(EliminTree *, pastix_int_t, pastix_int_t)
Compute the number of level existing below a given node.
Definition: elimintree.c:250
struct etree_node_s eTreeNode_t
Node of the elimination tree.
pastix_int_t eTreeNodeLevel(const EliminTree *, pastix_int_t)
Compute the number of level existing below a given node.
Definition: elimintree.c:289
pastix_int_t eTreeLevel(const EliminTree *)
Compute the height of the elimination tree.
Definition: elimintree.c:209
void eTreeExit(EliminTree *)
Free the elimination tree structure.
Definition: elimintree.c:89
Node of the elimination tree.
Definition: elimintree.h:25
Elimination tree.
Definition: elimintree.h:39
Symbol matrix structure.
Definition: symbol.h:77