LADEL main
Sparse LDL factorization package with rank 1 and rowadd/rowdel updates
ladel.h
Go to the documentation of this file.
1/**
2 * @file ladel.h
3 * @author Ben Hermans
4 * @brief LADEL main include file.
5 * @details The user can include this file in his projects to call any LADEL routine.
6 * This file contains the declaration of the factorization, backsolve and factorization
7 * update routines provided by LADEL.
8 * @note The implementation of the rank1_update and row_add/del routines are respectively
9 * in ladel_rank1_mod.c and ladel_row_mod.c instead of in ladel.c.
10 */
11
12#ifndef LADEL_H
13#define LADEL_H
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19#include "ladel_col_counts.h"
20#include "ladel_constants.h"
21#include "ladel_copy.h"
22#include "ladel_debug_print.h"
23#include "ladel_etree.h"
24#include "ladel_global.h"
25#include "ladel_ldl_numeric.h"
26#include "ladel_ldl_symbolic.h"
27#include "ladel_matvec.h"
28#include "ladel_matmat.h"
29#include "ladel_pattern.h"
30#include "ladel_permutation.h"
31#include "ladel_postorder.h"
32#include "ladel_rank1_mod.h"
33#include "ladel_row_mod.h"
34#include "ladel_scale.h"
35#include "ladel_transpose.h"
36#include "ladel_types.h"
37#include "ladel_upper_diag.h"
38#include "ladel_add.h"
39#include "ladel_submatrix.h"
40
41/**
42 * @defgroup grp-solver Solver
43 * @brief Main solver API.
44 * @see @ref ladel.h
45 * @{
46 */
47
48/**
49 * Computes the @f$LDL^T@f$ factorization of @f$M@f$.
50 *
51 * @param M Matrix to be factorized
52 * @param sym Symbolics of the factorization
53 * @param ordering_method Indicator to choose the ordering method: @a AMD, @a NO_ORDERING or @a GIVEN_ORDERING
54 * @param LD Output struct containing the @f$LDL^T@f$ factors
55 * @param work LADEL workspace
56 * @return Status
57 */
59 ladel_symbolics *sym,
60 ladel_int ordering_method,
61 ladel_factor **LD,
62 ladel_work *work);
63
64/**
65 * Computes the @f$LDL^T@f$ factorization of @f$M + \alpha \begin{bmatrix}I_{n} & \\ & 0\end{bmatrix}@f$.
66 *
67 * @param M Matrix to be factorized
68 * @param d Diagonal parameters @f$\alpha@f$ and @f$n@f$
69 * @param sym Symbolics of the factorization
70 * @param ordering_method Indicator to choose the ordering method: @a AMD, @a NO_ORDERING or @a GIVEN_ORDERING
71 * @param LD Output struct containing the @f$LDL^T@f$ factors
72 * @param work LADEL workspace
73 * @return Status
74 */
76 ladel_diag d,
77 ladel_symbolics *sym,
78 ladel_int ordering_method,
79 ladel_factor **LD,
80 ladel_work *work);
81
82/**
83 * Computes the @f$LDL^T@f$ factorization of @f$M,@f$ but allocates based on @a Mbasis.
84 *
85 * This routine is used for subsequent update routines. LADEL assumes the user knows in advance
86 * the possible updates (at least the pattern), so that it can allocate the factor once. Dynamic
87 * reallocation during update routines is currently not supported.
88 *
89 * @param M Matrix to be factorized
90 * @param sym Symbolics of the factorization
91 * @param ordering_method Indicator to choose the ordering method: @a AMD, @a NO_ORDERING or @a GIVEN_ORDERING
92 * @param LD Output struct containing the @f$LDL^T@f$ factors
93 * @param Mbasis Matrix that is used in the symbolic part of the factorization to allocate LD
94 * @param work LADEL workspace
95 * @return Status
96 */
98 ladel_symbolics *sym,
99 ladel_int ordering_method,
100 ladel_factor **LD,
101 ladel_sparse_matrix *Mbasis,
102 ladel_work *work);
103
104/**
105 * Computes the @f$LDL^T@f$ factorization of @f$M+ \alpha \begin{bmatrix}I_{n} & \\ & 0\end{bmatrix},@f$ but allocates based on @a Mbasis.
106 *
107 * This routine is used for subsequent update routines. LADEL assumes the user knows in advance
108 * the possible updates (at least the pattern), so that it can allocate the factor once. Dynamic
109 * reallocation during update routines is currently not supported.
110 *
111 * @param M Matrix to be factorized
112 * @param d Diagonal parameters @f$\alpha@f$ and @f$n@f$
113 * @param sym Symbolics of the factorization
114 * @param ordering_method Indicator to choose the ordering method: @a AMD, @a NO_ORDERING or @a GIVEN_ORDERING
115 * @param LD Output struct containing the @f$LDL^T@f$ factors
116 * @param Mbasis Matrix that is used in the symbolic part of the factorization to allocate LD
117 * @param work LADEL workspace
118 * @return Status
119 */
121 ladel_diag d,
122 ladel_symbolics *sym,
123 ladel_int ordering_method,
124 ladel_factor **LD,
125 ladel_sparse_matrix *Mbasis,
126 ladel_work *work);
127
128/**
129 * Computes the @f$LDL^T@f$ factorization of @f$M,@f$ provided @a LD was allocated before.
130 *
131 * @param M Matrix to be factorized
132 * @param sym Symbolics of the factorization
133 * @param LD Output struct containing the @f$LDL^T@f$ factors
134 * @param work LADEL workspace
135 * @return Status
136 */
138 ladel_symbolics *sym,
139 ladel_factor *LD,
140 ladel_work *work);
141
142/**
143 * Computes the @f$LDL^T@f$ factorization of @f$M+ \alpha \begin{bmatrix}I_{n} & \\ & 0\end{bmatrix},@f$
144 * provided @a LD was allocated before.
145 *
146 * @param M Matrix to be factorized
147 * @param d Diagonal parameters @f$\alpha@f$ and @f$n@f$
148 * @param sym Symbolics of the factorization
149 * @param LD Output struct containing the @f$LDL^T@f$ factors
150 * @param work LADEL workspace
151 * @return Status
152 */
154 ladel_diag d,
155 ladel_symbolics *sym,
156 ladel_factor *LD,
157 ladel_work *work);
158
159/**
160 * Computes @f$y = LDL^T \backslash rhs@f$.
161 *
162 * @param LD Factors of an @f$LDL^T@f$ factorization
163 * @param rhs Dense right-hand side
164 * @param y Output vector
165 * @param work LADEL workspace
166 * @return Status
167 */
169 const ladel_double *rhs,
170 ladel_double *y,
171 ladel_work *work);
172
173/**
174 * Updates an @f$LDL^T@f$ factorization.
175 *
176 * If LD contains the factors of @f$M@f$ on input, LD will contain the factors of @f$M + up\_or\_down*factor^2*ww^T,@f$
177 * where @f$w = W(:, col\_in\_W).@f$
178 *
179 * @param LD Factors of an @f$LDL^T@f$ factorization
180 * @param sym Associated symbolic information
181 * @param W Sparse matrix containing the vector for the update
182 * @param col_in_W Column of W that is used for the update
183 * @param factor Scaling factor for the update vector
184 * @param up_or_down Flag indicating @a UPDATE or @a DOWNDATE
185 * @param work LADEL workspace
186 * @return Status
187 */
189 ladel_symbolics *sym,
191 ladel_int col_in_W,
192 ladel_double factor,
193 ladel_int up_or_down,
194 ladel_work *work);
195
196/**
197 * Updates an @f$LDL^T@f$ factorization.
198 *
199 * If LD contains the factors of
200 * @f$M = \begin{bmatrix}
201 * M_{11} & 0 & M_{13} \\
202 * 0 & 1 & 0 \\
203 * M_{13}^T & 0 & M_{33}
204 * \end{bmatrix} @f$ on input, LD will contain the factors of
205 * @f$\begin{bmatrix}
206 * M_{11} & m_{12} & M_{13} \\
207 * m_{12}^T & m_{22} & m_{32}^T \\
208 * M_{13}^T & m_{32} & M_{33}
209 * \end{bmatrix} @f$ on output, where @f$m = W(:, col\_in\_ W),@f$ and
210 * @f$row\_in\_L = n + 1@f$ with @f$[n,n] = size(M_{11}).@f$
211 *
212 * @param LD Factors of an @f$LDL^T@f$ factorization
213 * @param sym Associated symbolic information
214 * @param row_in_L Position of the added row/column
215 * @param W Sparse matrix containing the vector for the update
216 * @param col_in_W Column of W that is used for the update
217 * @param diag Diagonal element @f$m_{22}@f$
218 * @param work LADEL workspace
219 * @return Status
220 */
222 ladel_symbolics *sym,
223 ladel_int row_in_L,
225 ladel_int col_in_W,
226 ladel_double diag,
227 ladel_work *work);
228
229/**
230 * Updates an @f$LDL^T@f$ factorization.
231 *
232 * If LD contains the factors of
233 * @f$\begin{bmatrix}
234 * M_{11} & m_{12} & M_{13} \\
235 * m_{12}^T & m_{22} & m_{32}^T \\
236 * M_{13}^T & m_{32} & M_{33}
237 * \end{bmatrix} @f$ on input, LD will contain the factors of
238 * @f$M = \begin{bmatrix}
239 * M_{11} & 0 & M_{13} \\
240 * 0 & 1 & 0 \\
241 * M_{13}^T & 0 & M_{33}
242 * \end{bmatrix} @f$ on output, where
243 * @f$row\_in\_L = n + 1@f$ with @f$[n,n] = size(M_{11}).@f$
244 *
245 * @param LD Factors of an @f$LDL^T@f$ factorization
246 * @param sym Associated symbolic information
247 * @param row_in_L Position of the deleted row/column
248 * @param work LADEL workspace
249 * @return Status
250 */
252 ladel_symbolics *sym,
253 ladel_int row_in_L,
254 ladel_work *work);
255
256/**
257 * @}
258 */
259
260#ifdef __cplusplus
261}
262#endif
263
264#endif /*LADEL_H*/
ladel_int ladel_dense_solve(const ladel_factor *LD, const ladel_double *rhs, ladel_double *y, ladel_work *work)
Computes .
Definition: ladel.c:120
ladel_int ladel_row_add(ladel_factor *LD, ladel_symbolics *sym, ladel_int row_in_L, ladel_sparse_matrix *W, ladel_int col_in_W, ladel_double diag, ladel_work *work)
Updates an factorization.
Definition: ladel_row_mod.c:12
ladel_int ladel_factorize_with_diag(ladel_sparse_matrix *M, ladel_diag d, ladel_symbolics *sym, ladel_int ordering_method, ladel_factor **LD, ladel_work *work)
Computes the factorization of .
Definition: ladel.c:18
ladel_int ladel_row_del(ladel_factor *LD, ladel_symbolics *sym, ladel_int row_in_L, ladel_work *work)
Updates an factorization.
ladel_int ladel_factorize(ladel_sparse_matrix *M, ladel_symbolics *sym, ladel_int ordering_method, ladel_factor **LD, ladel_work *work)
Computes the factorization of .
Definition: ladel.c:11
ladel_int ladel_rank1_update(ladel_factor *LD, ladel_symbolics *sym, ladel_sparse_matrix *W, ladel_int col_in_W, ladel_double factor, ladel_int up_or_down, ladel_work *work)
Updates an factorization.
ladel_int ladel_factorize_with_prior_basis(ladel_sparse_matrix *M, ladel_symbolics *sym, ladel_factor *LD, ladel_work *work)
Computes the factorization of provided LD was allocated before.
Definition: ladel.c:90
ladel_int ladel_factorize_with_prior_basis_with_diag(ladel_sparse_matrix *M, ladel_diag d, ladel_symbolics *sym, ladel_factor *LD, ladel_work *work)
Computes the factorization of provided LD was allocated before.
Definition: ladel.c:97
ladel_int ladel_factorize_advanced(ladel_sparse_matrix *M, ladel_symbolics *sym, ladel_int ordering_method, ladel_factor **LD, ladel_sparse_matrix *Mbasis, ladel_work *work)
Computes the factorization of but allocates based on Mbasis.
Definition: ladel.c:46
ladel_int ladel_factorize_advanced_with_diag(ladel_sparse_matrix *M, ladel_diag d, ladel_symbolics *sym, ladel_int ordering_method, ladel_factor **LD, ladel_sparse_matrix *Mbasis, ladel_work *work)
Computes the factorization of but allocates based on Mbasis.
Definition: ladel.c:53
Routines to add matrices.
Computes the col counts needed for the symbolic factorization (after etree and postorder).
Constants and macros used in LADEL.
Routines to copy matrices and vectors.
Routines to print out matrices and vectors.
Routines to compute the elimination tree of a matrix.
Memory allocation routines.
The numerical part of the factorization.
The symbolic part of the factorization.
Routines to compute matrix matrix products. For now only and , with a diagonal matrix,...
Routines to compute matrix vector products.
Routines to compute the pattern of the result of a backsolve.
Routines to permute vectors and matrices.
Routine to compute the postordering of the elimination tree.
Helper routines for the rank1_update function.
Routines for the row add/delete updates to a factorization are defined in ladel_row_mod....
Routines to scale the columns and rows of a matrix, or the whole matrix itself.
Routines to produce submatrices from a given submatrix. For now, only a selection of columns is suppo...
Routine to compute the transpose of a matrix.
Structures and types used in LADEL routines.
int64_t ladel_int
Type for integer numbers (default: int64_t)
Definition: ladel_types.h:24
double ladel_double
Type for floating point numbers (default: double)
Definition: ladel_types.h:20
Routine to keep only the upper diagonal elements of a (symmetric) matrix.
Sparse matrix in compressed column storage.
Definition: ladel_types.h:35
Structure representing a multiple of the identity matrix.
Definition: ladel_types.h:100
Factors of an factorization.
Definition: ladel_types.h:69
Structure capturing symbolic information used for and during the factorization.
Definition: ladel_types.h:54
Workspace required for various routines in LADEL.
Definition: ladel_types.h:109