-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathslu_ddefs.h
283 lines (254 loc) · 12.1 KB
/
slu_ddefs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
/*! \file
Copyright (c) 2003, The Regents of the University of California, through
Lawrence Berkeley National Laboratory (subject to receipt of any required
approvals from U.S. Dept. of Energy)
All rights reserved.
The source code is distributed under BSD license, see the file License.txt
at the top-level directory.
*/
/*! @file slu_ddefs.h
* \brief Header file for real operations
*
* <pre>
* -- SuperLU routine (version 7.0.0) --
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
* and Lawrence Berkeley National Lab.
* November, 2010
* August 2024
*
* Global data structures used in LU factorization -
*
* nsuper: \#supernodes = nsuper + 1, numbered [0, nsuper].
* (xsup,supno): supno[i] is the supernode no to which i belongs;
* xsup(s) points to the beginning of the s-th supernode.
* e.g. supno 0 1 2 2 3 3 3 4 4 4 4 4 (n=12)
* xsup 0 1 2 4 7 12
* Note: dfs will be performed on supernode rep. relative to the new
* row pivoting ordering
*
* (xlsub,lsub): lsub[*] contains the compressed subscript of
* rectangular supernodes; xlsub[j] points to the starting
* location of the j-th column in lsub[*]. Note that xlsub
* is indexed by column.
* Storage: original row subscripts
*
* During the course of sparse LU factorization, we also use
* (xlsub,lsub) for the purpose of symmetric pruning. For each
* supernode {s,s+1,...,t=s+r} with first column s and last
* column t, the subscript set
* lsub[j], j=xlsub[s], .., xlsub[s+1]-1
* is the structure of column s (i.e. structure of this supernode).
* It is used for the storage of numerical values.
* Furthermore,
* lsub[j], j=xlsub[t], .., xlsub[t+1]-1
* is the structure of the last column t of this supernode.
* It is for the purpose of symmetric pruning. Therefore, the
* structural subscripts can be rearranged without making physical
* interchanges among the numerical values.
*
* However, if the supernode has only one column, then we
* only keep one set of subscripts. For any subscript interchange
* performed, similar interchange must be done on the numerical
* values.
*
* The last column structures (for pruning) will be removed
* after the numerical LU factorization phase.
*
* (xlusup,lusup): lusup[*] contains the numerical values of the
* rectangular supernodes; xlusup[j] points to the starting
* location of the j-th column in storage vector lusup[*]
* Note: xlusup is indexed by column.
* Each rectangular supernode is stored by column-major
* scheme, consistent with Fortran 2-dim array storage.
*
* (xusub,ucol,usub): ucol[*] stores the numerical values of
* U-columns outside the rectangular supernodes. The row
* subscript of nonzero ucol[k] is stored in usub[k].
* xusub[i] points to the starting location of column i in ucol.
* Storage: new row subscripts; that is subscripts of PA.
* </pre>
*/
#ifndef __SUPERLU_dSP_DEFS /* allow multiple inclusions */
#define __SUPERLU_dSP_DEFS
/*
* File name: dsp_defs.h
* Purpose: Sparse matrix types and function prototypes
* History:
*/
#ifdef _CRAY
#include <fortran.h>
#endif
#include <math.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "slu_Cnames.h"
#include "superlu_config.h"
#include "supermatrix.h"
#include "slu_util.h"
/* -------- Prototypes -------- */
#ifdef __cplusplus
extern "C" {
#endif
/*! \brief Driver routines */
extern void
dgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int_t *info);
extern void
dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
char *, double *, double *, SuperMatrix *, SuperMatrix *,
void *, int_t lwork, SuperMatrix *, SuperMatrix *,
double *, double *, double *, double *,
GlobalLU_t *, mem_usage_t *, SuperLUStat_t *, int_t *info);
/* ILU */
extern void
dgsisv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
extern void
dgsisx(superlu_options_t *options, SuperMatrix *A, int *perm_c, int *perm_r,
int *etree, char *equed, double *R, double *C,
SuperMatrix *L, SuperMatrix *U, void *work, int_t lwork,
SuperMatrix *B, SuperMatrix *X, double *recip_pivot_growth, double *rcond,
GlobalLU_t *Glu, mem_usage_t *mem_usage, SuperLUStat_t *stat, int_t *info);
/*! \brief Supernodal LU factor related */
extern void
dCreate_CompCol_Matrix(SuperMatrix *, int, int, int_t, double *,
int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
extern void
dCreate_CompRow_Matrix(SuperMatrix *, int, int, int_t, double *,
int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
extern void dCompRow_to_CompCol(int, int, int_t, double*, int_t*, int_t*,
double **, int_t **, int_t **);
extern void
dCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
extern void
dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int,
Stype_t, Dtype_t, Mtype_t);
extern void
dCreate_SuperNode_Matrix(SuperMatrix *, int, int, int_t, double *,
int_t *, int_t *, int_t *, int *, int *,
Stype_t, Dtype_t, Mtype_t);
extern void
dCopy_Dense_Matrix(int, int, double *, int, double *, int);
extern void dallocateA (int, int_t, double **, int_t **, int_t **);
extern void dgstrf (superlu_options_t*, SuperMatrix*,
int, int, int*, void *, int_t, int *, int *,
SuperMatrix *, SuperMatrix *, GlobalLU_t *,
SuperLUStat_t*, int_t *info);
extern int_t dsnode_dfs (const int, const int, const int_t *, const int_t *,
const int_t *, int_t *, int *, GlobalLU_t *);
extern int dsnode_bmod (const int, const int, const int, double *,
double *, GlobalLU_t *, SuperLUStat_t*);
extern void dpanel_dfs (const int, const int, const int, SuperMatrix *,
int *, int *, double *, int *, int *, int *,
int_t *, int *, int *, int_t *, GlobalLU_t *);
extern void dpanel_bmod (const int, const int, const int, const int,
double *, double *, int *, int *,
GlobalLU_t *, SuperLUStat_t*);
extern int dcolumn_dfs (const int, const int, int *, int *, int *, int *,
int *, int_t *, int *, int *, int_t *, GlobalLU_t *);
extern int dcolumn_bmod (const int, const int, double *,
double *, int *, int *, int,
GlobalLU_t *, SuperLUStat_t*);
extern int dcopy_to_ucol (int, int, int *, int *, int *,
double *, GlobalLU_t *);
extern int dpivotL (const int, const double, int *, int *,
int *, int *, int *, GlobalLU_t *, SuperLUStat_t*);
extern void dpruneL (const int, const int *, const int, const int,
const int *, const int *, int_t *, GlobalLU_t *);
extern void dreadmt (int *, int *, int_t *, double **, int_t **, int_t **);
extern void dGenXtrue (int, int, double *, int);
extern void dFillRHS (trans_t, int, double *, int, SuperMatrix *,
SuperMatrix *);
extern void dgstrs (trans_t, SuperMatrix *, SuperMatrix *, const int *, const int *,
SuperMatrix *, SuperLUStat_t*, int *);
/* ILU */
extern void dgsitrf (superlu_options_t*, SuperMatrix*, int, int, int*,
void *, int_t, int *, int *, SuperMatrix *, SuperMatrix *,
GlobalLU_t *, SuperLUStat_t*, int_t *info);
extern int dldperm(int, int, int_t, int_t [], int_t [], double [],
int [], double [], double []);
extern int ilu_dsnode_dfs (const int, const int, const int_t *, const int_t *,
const int_t *, int *, GlobalLU_t *);
extern void ilu_dpanel_dfs (const int, const int, const int, SuperMatrix *,
int *, int *, double *, double *, int *, int *,
int *, int *, int *, int_t *, GlobalLU_t *);
extern int ilu_dcolumn_dfs (const int, const int, int *, int *, int *,
int *, int *, int *, int *, int_t *, GlobalLU_t *);
extern int ilu_dcopy_to_ucol (int, int, int *, int *, int *,
double *, int, milu_t, double, int,
double *, int *, GlobalLU_t *, double *);
extern int ilu_dpivotL (const int, const double, int *, int *, int, int *,
int *, int *, int *, double, milu_t,
double, GlobalLU_t *, SuperLUStat_t*);
extern int ilu_ddrop_row (superlu_options_t *, int, int, double,
int, int *, double *, GlobalLU_t *,
double *, double *, int);
/*! \brief Driver related */
extern void dgsequ (SuperMatrix *, double *, double *, double *,
double *, double *, int *);
extern void dlaqgs (SuperMatrix *, double *, double *, double,
double, double, char *);
extern void dgscon (char *, SuperMatrix *, SuperMatrix *,
double, double *, SuperLUStat_t*, int *);
extern double dPivotGrowth(int, SuperMatrix *, int *,
SuperMatrix *, SuperMatrix *);
extern void dgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
SuperMatrix *, int *, int *, char *, double *,
double *, SuperMatrix *, SuperMatrix *,
double *, double *, SuperLUStat_t*, int *);
extern int sp_dtrsv (char *, char *, char *, SuperMatrix *,
SuperMatrix *, double *, SuperLUStat_t*, int *);
extern int sp_dgemv (char *, double, SuperMatrix *, double *,
int, double, double *, int);
extern int sp_dgemm (char *, char *, int, int, int, double,
SuperMatrix *, double *, int, double,
double *, int);
extern double dmach(char *); /* from C99 standard, in float.h */
/*! \brief Memory-related */
extern int_t dLUMemInit (fact_t, void *, int_t, int, int, int_t, int,
double, SuperMatrix *, SuperMatrix *,
GlobalLU_t *, int **, double **);
extern void dSetRWork (int, int, double *, double **, double **);
extern void dLUWorkFree (int *, double *, GlobalLU_t *);
extern int_t dLUMemXpand (int, int_t, MemType, int_t *, GlobalLU_t *);
extern double *doubleMalloc(size_t);
extern double *doubleCalloc(size_t);
extern int_t dmemory_usage(const int_t, const int_t, const int_t, const int);
extern int dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
extern int ilu_dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
/*! \brief Auxiliary routines */
extern void dreadhb(FILE *, int *, int *, int_t *, double **, int_t **, int_t **);
extern void dreadrb(int *, int *, int_t *, double **, int_t **, int_t **);
extern void dreadtriple(int *, int *, int_t *, double **, int_t **, int_t **);
extern void dreadtriple_noheader(int *, int *, int_t *, double **, int_t **, int_t **);
extern void dreadMM(FILE *, int *, int *, int_t *, double **, int_t **, int_t **);
extern void dfill (double *, int, double);
extern void dinf_norm_error (int, SuperMatrix *, double *);
extern double dqselect(int, double *, int);
/*! \brief Routines for debugging */
extern void dPrint_CompCol_Matrix(char *, SuperMatrix *);
extern void dPrint_SuperNode_Matrix(char *, SuperMatrix *);
extern void dPrint_Dense_Matrix(char *, SuperMatrix *);
extern void dprint_lu_col(char *, int, int, int_t *, GlobalLU_t *);
extern int print_double_vec(const char *, int, const double *);
extern void dcheck_tempv(int, double *);
/*! \brief BLAS */
extern int dgemm_(const char*, const char*, const int*, const int*, const int*,
const double*, const double*, const int*, const double*,
const int*, const double*, double*, const int*);
extern int dtrsv_(char*, char*, char*, int*, double*, int*,
double*, int*);
extern int dtrsm_(char*, char*, char*, char*, int*, int*,
double*, double*, int*, double*, int*);
extern int dgemv_(char *, int *, int *, double *, double *a, int *,
double *, int *, double *, double *, int *);
extern void dusolve(int, int, double*, double*);
extern void dlsolve(int, int, double*, double*);
extern void dmatvec(int, int, int, double*, double*, double*);
#ifdef __cplusplus
}
#endif
#endif /* __SUPERLU_dSP_DEFS */