LADEL main
Sparse LDL factorization package with rank 1 and rowadd/rowdel updates
ladel_types.h
Go to the documentation of this file.
1/**
2 * @file ladel_types.h
3 * @author Ben Hermans
4 * @brief Structures and types used in LADEL routines
5 */
6
7#ifndef LADEL_TYPES_H
8#define LADEL_TYPES_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include <stdint.h>
15#include <inttypes.h>
16
17#ifdef LADEL_SINGLE_PRECISION
18 typedef float ladel_double; /**< Type for floating point numbers (default: double) */
19#else
20 typedef double ladel_double; /**< Type for floating point numbers (default: double) */
21#endif
22
23#ifdef LADEL_64BIT_INDICES
24 typedef int64_t ladel_int; /**< Type for integer numbers (default: int64_t) */
25# define LADEL_PRIi PRId64
26#else
27 typedef int32_t ladel_int; /**< Type for integer numbers (default: int64_t) */
28# define LADEL_PRIi PRId32
29#endif
30
31/**
32 * @brief Sparse matrix in compressed column storage.
33 */
35{
36 ladel_int nzmax; /**< number of nonzeros */
37 ladel_int nrow; /**< number of rows */
38 ladel_int ncol; /**< number of columns */
39
40 ladel_int *p; /**< column pointers (size ncol+1) */
41 ladel_int *i; /**< row pointers (size nzmax) */
42 ladel_double *x; /**< numerical values (size nzmax) */
43 ladel_int *nz; /**< (optional) number of elements in each column (size ncol) */
44
45 ladel_int values; /**< has numerical values */
46 ladel_int symmetry; /**< type of symmetry (@a UNSYMMETRIC, @a UPPER or @a LOWER) */
47
49
50/**
51 * @brief Structure capturing symbolic information used for and during the factorization.
52 */
54{
55 ladel_int ncol; /**< number of columns in the analyzed matrix */
56 ladel_int *etree; /**< eliminations tree*/
57 ladel_int *postorder; /**< postordiring of the elimination tree */
58 ladel_int *col_counts; /**< column counts, stored as column pointers */
59 ladel_int *p; /**< fill-reducing ordering (possibly AMD) */
60 ladel_int *pinv; /**< inverse permutation vector */
61 ladel_int *pattern; /**< stores the nonzero pattern of a row of L */
62 ladel_int *nodes; /**< keeps track of which nodes have been marked */
64
65/**
66 * @brief Factors of an @f$LDL^T@f$ factorization.
67 */
68typedef struct ldl_factors
69{
70 ladel_int ncol; /**< number of columns in the analyzed matrix */
71 ladel_sparse_matrix *L; /**< L in LDL' factorization */
72 ladel_double *D; /**< D in LDL' factorization (stored as vector), not used but is useful for returning */
73 ladel_double *Dinv; /**< D^-1 in LDL' factorization (stored as vector) */
74 ladel_int *p; /**< permutation vector */
75 ladel_int *pinv; /**< inverse permutation vector */
77
78/**
79 * @brief Set of integers
80 */
81typedef struct ladel_set_struct {
82 ladel_int *set; /**< List of integers representing the set */
83 ladel_int size_set; /**< Size of the list */
84 ladel_int max_size_set; /**< Maximum (allocated) size of the list */
86
87/**
88 * @brief Column of a sparse matrix
89 */
90typedef struct ladel_col_struct {
91 ladel_int *i; /**< List of row indices */
92 ladel_double *x; /**< List of values */
93 ladel_int nz; /**< Number of elements in the column */
94 ladel_int nzmax; /**< Maximum number of elements in the column (allocated space) */
96
97/**
98 * @brief Structure representing a multiple of the identity matrix
99 */
100typedef struct ladel_diag_struct {
101 ladel_double diag_elem; /**< Scalar */
102 ladel_int diag_size; /**< Size of the matrix */
104
105/**
106 * @brief Workspace required for various routines in LADEL
107 */
108typedef struct workspace
109{
110 ladel_set *set_preallocated1; /**< A preallocated set structure */
111 ladel_set *set_preallocated2; /**< A preallocated set structure */
112 ladel_set *set_preallocated3; /**< A preallocated set structure */
113 ladel_set *set_unallocated_values1; /**< An unallocated set structure */
114 ladel_set *set_unallocated_values2; /**< An unallocated set structure */
115 ladel_set *set_unallocated_values3; /**< An unallocated set structure */
116 ladel_int *array_int_ncol1; /**< An array of @a ncol integers */
117 ladel_int *array_int_ncol2; /**< An array of @a ncol integers */
118 ladel_int *array_int_ncol3; /**< An array of @a ncol integers */
119 ladel_int *array_int_ncol4; /**< An array of @a ncol integers */
120 ladel_int *array_int_ncol_flag; /**< An array of @a ncol integers, assumed to be < @a flag */
121 ladel_int flag; /**< Flag used to mark nodes, used in conjunction with @a array_int_ncol_flag */
122 ladel_double *array_double_all_zeros_ncol1; /**< An array of @a ncol doubles, on input and output this should be all zeros */
123 ladel_double *array_double_ncol1; /**< An array of @a ncol doubles */
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif /*LADEL_TYPES_H*/
int64_t ladel_int
Type for integer numbers (default: int64_t)
Definition: ladel_types.h:24
struct ldl_factors ladel_factor
Factors of an factorization.
struct compressed_column_sparse_matrix ladel_sparse_matrix
Sparse matrix in compressed column storage.
struct ladel_set_struct ladel_set
Set of integers.
struct workspace ladel_work
Workspace required for various routines in LADEL.
struct ladel_col_struct ladel_col
Column of a sparse matrix.
double ladel_double
Type for floating point numbers (default: double)
Definition: ladel_types.h:20
struct ladel_diag_struct ladel_diag
Structure representing a multiple of the identity matrix.
struct symbolic_cholesky_information ladel_symbolics
Structure capturing symbolic information used for and during the factorization.
Sparse matrix in compressed column storage.
Definition: ladel_types.h:35
ladel_int symmetry
type of symmetry (UNSYMMETRIC, UPPER or LOWER)
Definition: ladel_types.h:46
ladel_int ncol
number of columns
Definition: ladel_types.h:38
ladel_double * x
numerical values (size nzmax)
Definition: ladel_types.h:42
ladel_int nzmax
number of nonzeros
Definition: ladel_types.h:36
ladel_int * p
column pointers (size ncol+1)
Definition: ladel_types.h:40
ladel_int * nz
(optional) number of elements in each column (size ncol)
Definition: ladel_types.h:43
ladel_int values
has numerical values
Definition: ladel_types.h:45
ladel_int nrow
number of rows
Definition: ladel_types.h:37
ladel_int * i
row pointers (size nzmax)
Definition: ladel_types.h:41
Column of a sparse matrix.
Definition: ladel_types.h:90
ladel_int nz
Number of elements in the column.
Definition: ladel_types.h:93
ladel_double * x
List of values.
Definition: ladel_types.h:92
ladel_int * i
List of row indices.
Definition: ladel_types.h:91
ladel_int nzmax
Maximum number of elements in the column (allocated space)
Definition: ladel_types.h:94
Structure representing a multiple of the identity matrix.
Definition: ladel_types.h:100
ladel_double diag_elem
Scalar.
Definition: ladel_types.h:101
ladel_int diag_size
Size of the matrix.
Definition: ladel_types.h:102
Set of integers.
Definition: ladel_types.h:81
ladel_int max_size_set
Maximum (allocated) size of the list.
Definition: ladel_types.h:84
ladel_int * set
List of integers representing the set.
Definition: ladel_types.h:82
ladel_int size_set
Size of the list.
Definition: ladel_types.h:83
Factors of an factorization.
Definition: ladel_types.h:69
ladel_int ncol
number of columns in the analyzed matrix
Definition: ladel_types.h:70
ladel_int * p
permutation vector
Definition: ladel_types.h:74
ladel_sparse_matrix * L
L in LDL' factorization.
Definition: ladel_types.h:71
ladel_double * Dinv
D^-1 in LDL' factorization (stored as vector)
Definition: ladel_types.h:73
ladel_double * D
D in LDL' factorization (stored as vector), not used but is useful for returning.
Definition: ladel_types.h:72
ladel_int * pinv
inverse permutation vector
Definition: ladel_types.h:75
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 * pinv
inverse permutation vector
Definition: ladel_types.h:60
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
ladel_int * p
fill-reducing ordering (possibly AMD)
Definition: ladel_types.h:59
ladel_int * postorder
postordiring of the elimination tree
Definition: ladel_types.h:57
ladel_int * col_counts
column counts, stored as column pointers
Definition: ladel_types.h:58
Workspace required for various routines in LADEL.
Definition: ladel_types.h:109
ladel_int * array_int_ncol2
An array of ncol integers.
Definition: ladel_types.h:117
ladel_set * set_unallocated_values3
An unallocated set structure.
Definition: ladel_types.h:115
ladel_set * set_preallocated2
A preallocated set structure.
Definition: ladel_types.h:111
ladel_int flag
Flag used to mark nodes, used in conjunction with array_int_ncol_flag.
Definition: ladel_types.h:121
ladel_int * array_int_ncol1
An array of ncol integers.
Definition: ladel_types.h:116
ladel_int * array_int_ncol_flag
An array of ncol integers, assumed to be < flag.
Definition: ladel_types.h:120
ladel_int * array_int_ncol3
An array of ncol integers.
Definition: ladel_types.h:118
ladel_int * array_int_ncol4
An array of ncol integers.
Definition: ladel_types.h:119
ladel_set * set_unallocated_values2
An unallocated set structure.
Definition: ladel_types.h:114
ladel_double * array_double_all_zeros_ncol1
An array of ncol doubles, on input and output this should be all zeros.
Definition: ladel_types.h:122
ladel_set * set_preallocated1
A preallocated set structure.
Definition: ladel_types.h:110
ladel_double * array_double_ncol1
An array of ncol doubles.
Definition: ladel_types.h:123
ladel_set * set_preallocated3
A preallocated set structure.
Definition: ladel_types.h:112
ladel_set * set_unallocated_values1
An unallocated set structure.
Definition: ladel_types.h:113