LADEL main
Sparse LDL factorization package with rank 1 and rowadd/rowdel updates
ladel_ldl_symbolic.c
Go to the documentation of this file.
1#include "ladel_types.h"
2#include "ladel_constants.h"
3#include "ladel_global.h"
4#include "ladel_permutation.h"
5#include "ladel_etree.h"
6#include "ladel_postorder.h"
7#include "ladel_col_counts.h"
8#include "ladel_debug_print.h"
9
10#ifdef LADEL_USE_AMD
11#include "amd.h"
12#endif /*LADEL_USE_AMD*/
13
15{
16 if (!M || !sym || !Mpp || !work) return FAIL;
17
18 ladel_sparse_matrix *Mwork = M;
19 if (ordering_method == AMD)
20 {
21 #ifdef LADEL_USE_AMD
22 ladel_int status;
23 double Info [AMD_INFO];
24
25 #ifdef LADEL_64BIT_INDICES
26 status = amd_l_order(M->ncol, M->p, M->i, sym->p, NULL, Info);
27 #else /*LADEL_64BIT_INDICES*/
28 status = amd_order(M->ncol, M->p, M->i, sym->p, NULL, Info);
29 #endif
30 if (status != AMD_OK) return FAIL;
31
32 #else /*LADEL_USE_AMD*/
33 sym->p = ladel_free(sym->p);
34 #endif
35 } else if (ordering_method == GIVEN_ORDERING)
36 {
37 /*do nothing, sym->p already contains the permutation*/
38 } else if (ordering_method == NO_ORDERING)
39 {
40 sym->p = ladel_free(sym->p);
41 }
42
43 if (sym->p)
44 {
45 ladel_permute_symmetric_matrix(M, sym->p, Mpp, work);
46 Mwork = Mpp;
48 }
49
50 #ifdef LADEL_SIMPLE_COL_COUNTS
51 ladel_etree_and_col_counts(Mwork, sym, work);
52 #else
53 ladel_etree(Mwork, sym, work);
54 ladel_postorder(Mwork, sym, work);
55 ladel_col_counts(Mwork, sym, work);
56 #endif /* LADEL_SIMPLE_COL_COUNTS */
57
58 return SUCCESS;
59}
#define NO_ORDERING
No ordering is performed during the symbolic part of the factorization.
#define AMD
Ordering method during the symbolic part of the factorization.
#define GIVEN_ORDERING
The ordering was computed previously and is already stored in sym->p.
#define SUCCESS
For status returns.
#define FAIL
For status returns.
Computes the col counts needed for the symbolic factorization (after etree and postorder).
ladel_int ladel_col_counts(ladel_sparse_matrix *M, ladel_symbolics *sym, ladel_work *work)
Computes the column counts of the factor.
Constants and macros used in LADEL.
Routines to print out matrices and vectors.
Routines to compute the elimination tree of a matrix.
ladel_int ladel_etree_and_col_counts(ladel_sparse_matrix *M, ladel_symbolics *sym, ladel_work *work)
Computes the elimination tree and column counts of a matrix.
Definition: ladel_etree.c:38
ladel_int ladel_etree(ladel_sparse_matrix *M, ladel_symbolics *sym, ladel_work *work)
Computes the elimination tree of a matrix.
Definition: ladel_etree.c:6
Memory allocation routines.
void * ladel_free(void *p)
Version of free (for mex or for regular C).
Definition: ladel_global.c:60
ladel_int ladel_ldl_symbolic(ladel_sparse_matrix *M, ladel_symbolics *sym, ladel_int ordering_method, ladel_sparse_matrix *Mpp, ladel_work *work)
Symbolic part of the factorization.
Routines to permute vectors and matrices.
void ladel_permute_symmetric_matrix(ladel_sparse_matrix *M, ladel_int *p, ladel_sparse_matrix *Mpp, ladel_work *work)
Compute .
void ladel_invert_permutation_vector(ladel_int *p, ladel_int *pinv, ladel_int size)
Invert a permutation vector, such that .
Routine to compute the postordering of the elimination tree.
ladel_int ladel_postorder(ladel_sparse_matrix *M, ladel_symbolics *sym, ladel_work *work)
Compute the postordering of the elimination tree.
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 * p
column pointers (size ncol+1)
Definition: ladel_types.h:40
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 * pinv
inverse permutation vector
Definition: ladel_types.h:60
ladel_int * p
fill-reducing ordering (possibly AMD)
Definition: ladel_types.h:59
Workspace required for various routines in LADEL.
Definition: ladel_types.h:109