LADEL main
Sparse LDL factorization package with rank 1 and rowadd/rowdel updates
ladel_pattern.c
Go to the documentation of this file.
1#include "ladel_types.h"
2#include "ladel_constants.h"
3#include "ladel_global.h"
4
7 ladel_int row)
8{
9 ladel_int start = M->ncol, index, next_node, nb_marked_nodes;
10 ladel_int *etree = sym->etree, *pattern = sym->pattern, *nodes = sym->nodes;
11 MARK(nodes,row);
12 LADEL_FOR(index, M, row)
13 {
14 next_node = M->i[index];
15 nb_marked_nodes = 0;
16 /* mark all the nodes found by traversing the etree */
17 while (!IS_MARKED(nodes, next_node))
18 {
19 MARK(nodes, next_node);
20 pattern[nb_marked_nodes] = next_node;
21 nb_marked_nodes++;
22 next_node = etree[next_node];
23 }
24 /*append the newly marked nodes to pattern (which goes from ncol-1 to 0)*/
25 while (nb_marked_nodes > 0)
26 {
27 start--;
28 nb_marked_nodes--;
29 pattern[start] = pattern[nb_marked_nodes];
30 }
31 }
32 /* unmark all the nodes to prepare for finding the pattern of the next row */
33 for (index = start; index < M->ncol; index++) UNMARK(nodes, pattern[index]);
34 UNMARK(nodes, row);
35
36 return start;
37}
38
39
41 ladel_symbolics *sym,
42 ladel_int col_in_W,
43 ladel_int maximum_row)
44{
45 ladel_int start = sym->ncol, index, next_node, nb_marked_nodes;
46 ladel_int *etree = sym->etree, *pattern = sym->pattern, *nodes = sym->nodes;
47
48 LADEL_FOR(index, W, col_in_W)
49 {
50 next_node = W->i[index];
51 if (next_node >= maximum_row) break;
52 nb_marked_nodes = 0;
53 /* mark all the nodes found by traversing the etree */
54 while (next_node != NONE && !IS_MARKED(nodes, next_node) && next_node < maximum_row)
55 {
56 MARK(nodes, next_node);
57 pattern[nb_marked_nodes] = next_node;
58 nb_marked_nodes++;
59 next_node = etree[next_node];
60 }
61 /*append the newly marked nodes to pattern (which goes from ncol-1 to 0)*/
62 while (nb_marked_nodes > 0)
63 {
64 start--;
65 nb_marked_nodes--;
66 pattern[start] = pattern[nb_marked_nodes];
67 }
68 }
69 /* unmark all the nodes to prepare for finding the pattern of the next row */
70 for (index = start; index < sym->ncol; index++) UNMARK(nodes, pattern[index]);
71 UNMARK(nodes, col_in_W);
72
73 return start;
74}
75
#define NONE
Indicates a root (a node without parent), or an untouched node.
#define LADEL_FOR(index, M, col)
Loop through a column of a sparse matrix.
#define UNMARK(nodes, k)
Unmark the k-th node.
#define MARK(nodes, k)
Mark the k-th node.
#define IS_MARKED(nodes, k)
Check whether the k-th node is marked.
Constants and macros used in LADEL.
Memory allocation routines.
ladel_int ladel_nonzero_pattern_of_row_in_L(ladel_sparse_matrix *M, ladel_symbolics *sym, ladel_int row)
Computes the pattern of the (next) row in L.
Definition: ladel_pattern.c:5
ladel_int ladel_etree_dfs(ladel_sparse_matrix *W, ladel_symbolics *sym, ladel_int col_in_W, ladel_int maximum_row)
Computes a depth-first search of the given pattern through the elimination tree.
Definition: ladel_pattern.c:40
Structures and types used in LADEL routines.
int64_t ladel_int
Type for integer numbers (default: int64_t)
Definition: ladel_types.h:24
Sparse matrix in compressed column storage.
Definition: ladel_types.h:35
ladel_int ncol
number of columns
Definition: ladel_types.h:38
ladel_int * i
row pointers (size nzmax)
Definition: ladel_types.h:41
Structure capturing symbolic information used for and during the factorization.
Definition: ladel_types.h:54
ladel_int * nodes
keeps track of which nodes have been marked
Definition: ladel_types.h:62
ladel_int ncol
number of columns in the analyzed matrix
Definition: ladel_types.h:55
ladel_int * pattern
stores the nonzero pattern of a row of L
Definition: ladel_types.h:61
ladel_int * etree
eliminations tree
Definition: ladel_types.h:56