4
* -- SuperLU routine (version 2.0) --
5
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
6
* and Lawrence Berkeley National Lab.
10
#ifndef __SUPERLU_zSP_DEFS /* allow multiple inclusions */
11
#define __SUPERLU_zSP_DEFS
14
* File name: zsp_defs.h
15
* Purpose: Sparse matrix types and function prototypes
23
#include "supermatrix.h"
27
/* No of marker arrays used in the symbolic factorization,
30
#define NUM_TEMPV(m,w,t,b) ( SUPERLU_MAX(m, (t + b)*w) )
32
typedef enum {LUSUP, UCOL, LSUB, USUB} MemType;
33
typedef enum {HEAD, TAIL} stack_end_t;
34
typedef enum {SYSTEM, USER} LU_space_t;
37
* Global data structures used in LU factorization -
39
* nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
40
* (xsup,supno): supno[i] is the supernode no to which i belongs;
41
* xsup(s) points to the beginning of the s-th supernode.
42
* e.g. supno 0 1 2 2 3 3 3 4 4 4 4 4 (n=12)
44
* Note: dfs will be performed on supernode rep. relative to the new
45
* row pivoting ordering
47
* (xlsub,lsub): lsub[*] contains the compressed subscript of
48
* rectangular supernodes; xlsub[j] points to the starting
49
* location of the j-th column in lsub[*]. Note that xlsub
50
* is indexed by column.
51
* Storage: original row subscripts
53
* During the course of sparse LU factorization, we also use
54
* (xlsub,lsub) for the purpose of symmetric pruning. For each
55
* supernode {s,s+1,...,t=s+r} with first column s and last
56
* column t, the subscript set
57
* lsub[j], j=xlsub[s], .., xlsub[s+1]-1
58
* is the structure of column s (i.e. structure of this supernode).
59
* It is used for the storage of numerical values.
61
* lsub[j], j=xlsub[t], .., xlsub[t+1]-1
62
* is the structure of the last column t of this supernode.
63
* It is for the purpose of symmetric pruning. Therefore, the
64
* structural subscripts can be rearranged without making physical
65
* interchanges among the numerical values.
67
* However, if the supernode has only one column, then we
68
* only keep one set of subscripts. For any subscript interchange
69
* performed, similar interchange must be done on the numerical
72
* The last column structures (for pruning) will be removed
73
* after the numercial LU factorization phase.
75
* (xlusup,lusup): lusup[*] contains the numerical values of the
76
* rectangular supernodes; xlusup[j] points to the starting
77
* location of the j-th column in storage vector lusup[*]
78
* Note: xlusup is indexed by column.
79
* Each rectangular supernode is stored by column-major
80
* scheme, consistent with Fortran 2-dim array storage.
82
* (xusub,ucol,usub): ucol[*] stores the numerical values of
83
* U-columns outside the rectangular supernodes. The row
84
* subscript of nonzero ucol[k] is stored in usub[k].
85
* xusub[i] points to the starting location of column i in ucol.
86
* Storage: new row subscripts; that is subscripts of PA.
89
int *xsup; /* supernode and column mapping */
91
int *lsub; /* compressed L subscripts */
93
doublecomplex *lusup; /* L supernodes */
95
doublecomplex *ucol; /* U columns */
98
int nzlmax; /* current max size of lsub */
99
int nzumax; /* " " " ucol */
100
int nzlumax; /* " " " lusup */
101
int n; /* number of columns in the matrix */
102
LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
108
double diag_pivot_thresh;
122
/* Driver routines */
124
zgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *,
125
SuperMatrix *, int *);
127
zgssvx(char *, char *, char *, SuperMatrix *, factor_param_t *,
128
int *, int *, int *, char *, double *, double *,
129
SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *,
130
SuperMatrix *, double *, double *, double *,
131
double *, mem_usage_t *, int *);
133
/* Supernodal LU factor related */
135
zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *,
136
int *, int *, Stype_t, Dtype_t, Mtype_t);
138
zCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
140
zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int,
141
Stype_t, Dtype_t, Mtype_t);
143
zCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, doublecomplex *,
144
int *, int *, int *, int *, int *,
145
Stype_t, Dtype_t, Mtype_t);
147
zCopy_Dense_Matrix(int, int, doublecomplex *, int, doublecomplex *, int);
149
extern void Destroy_SuperMatrix_Store(SuperMatrix *);
150
extern void Destroy_CompCol_Matrix(SuperMatrix *);
151
extern void Destroy_SuperNode_Matrix(SuperMatrix *);
152
extern void Destroy_CompCol_Permuted(SuperMatrix *);
153
extern void Destroy_Dense_Matrix(SuperMatrix *);
154
extern void get_perm_c(int, SuperMatrix *, int *);
155
extern void sp_preorder (char*, SuperMatrix*, int*, int*, SuperMatrix*);
156
extern void countnz (const int, int *, int *, int *, GlobalLU_t *);
157
extern void fixupL (const int, const int *, GlobalLU_t *);
159
extern void zallocateA (int, int, doublecomplex **, int **, int **);
160
extern void zgstrf (char*, SuperMatrix*, double, double, int, int, int*,
161
void *, int, int *, int *,
162
SuperMatrix *, SuperMatrix *, int *);
163
extern int zsnode_dfs (const int, const int, const int *, const int *,
164
const int *, int *, int *, GlobalLU_t *);
165
extern int zsnode_bmod (const int, const int, const int, doublecomplex *,
166
doublecomplex *, GlobalLU_t *);
167
extern void zpanel_dfs (const int, const int, const int, SuperMatrix *,
168
int *, int *, doublecomplex *, int *, int *, int *,
169
int *, int *, int *, int *, GlobalLU_t *);
170
extern void zpanel_bmod (const int, const int, const int, const int,
171
doublecomplex *, doublecomplex *, int *, int *,
173
extern int zcolumn_dfs (const int, const int, int *, int *, int *, int *,
174
int *, int *, int *, int *, int *, GlobalLU_t *);
175
extern int zcolumn_bmod (const int, const int, doublecomplex *,
176
doublecomplex *, int *, int *, int, GlobalLU_t *);
177
extern int zcopy_to_ucol (int, int, int *, int *, int *,
178
doublecomplex *, GlobalLU_t *);
179
extern int zpivotL (const int, const double, int *, int *,
180
int *, int *, int *, GlobalLU_t *);
181
extern void zpruneL (const int, const int *, const int, const int,
182
const int *, const int *, int *, GlobalLU_t *);
183
extern void zreadmt (int *, int *, int *, doublecomplex **, int **, int **);
184
extern void zGenXtrue (int, int, doublecomplex *, int);
185
extern void zFillRHS (char *, int, doublecomplex *, int, SuperMatrix *,
187
extern void zgstrs (char *, SuperMatrix *, SuperMatrix *, int *, int *,
188
SuperMatrix *, int *);
193
extern void zgsequ (SuperMatrix *, double *, double *, double *,
194
double *, double *, int *);
195
extern void zlaqgs (SuperMatrix *, double *, double *, double,
196
double, double, char *);
197
extern void zgscon (char *, SuperMatrix *, SuperMatrix *,
198
double, double *, int *);
199
extern double zPivotGrowth(int, SuperMatrix *, int *,
200
SuperMatrix *, SuperMatrix *);
201
extern void zgsrfs (char *, SuperMatrix *, SuperMatrix *,
202
SuperMatrix *, int *, int *, char *, double *,
203
double *, SuperMatrix *, SuperMatrix *,
204
double *, double *, int *);
206
extern int sp_ztrsv (char *, char *, char *, SuperMatrix *,
207
SuperMatrix *, doublecomplex *, int *);
208
extern int sp_zgemv (char *, doublecomplex, SuperMatrix *, doublecomplex *,
209
int, doublecomplex, doublecomplex *, int);
211
extern int sp_zgemm (char *, char *, int, int, int, doublecomplex,
212
SuperMatrix *, doublecomplex *, int, doublecomplex,
213
doublecomplex *, int);
216
extern int zLUMemInit (char *, void *, int, int, int, int, int,
217
SuperMatrix *, SuperMatrix *,
218
GlobalLU_t *, int **, doublecomplex **);
219
extern void zSetRWork (int, int, doublecomplex *, doublecomplex **, doublecomplex **);
220
extern void zLUWorkFree (int *, doublecomplex *, GlobalLU_t *);
221
extern int zLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
223
extern doublecomplex *doublecomplexMalloc(int);
224
extern doublecomplex *doublecomplexCalloc(int);
225
extern double *doubleMalloc(int);
226
extern double *doubleCalloc(int);
227
extern int zmemory_usage(const int, const int, const int, const int);
228
extern int zQuerySpace (SuperMatrix *, SuperMatrix *, int,
231
/* Auxiliary routines */
232
extern void zreadhb(int *, int *, int *, doublecomplex **, int **, int **);
233
extern void zCompRow_to_CompCol(int, int, int, doublecomplex*, int*, int*,
234
doublecomplex **, int **, int **);
235
extern void zfill (doublecomplex *, int, doublecomplex);
236
extern void zinf_norm_error (int, SuperMatrix *, doublecomplex *);
237
extern void PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
238
doublecomplex, doublecomplex, doublecomplex *, doublecomplex *, char *);
240
/* Routines for debugging */
241
extern void zPrint_CompCol_Matrix(char *, SuperMatrix *);
242
extern void zPrint_SuperNode_Matrix(char *, SuperMatrix *);
243
extern void zPrint_Dense_Matrix(char *, SuperMatrix *);
244
extern void print_lu_col(char *, int, int, int *, GlobalLU_t *);
245
extern void check_tempv(int, doublecomplex *);
251
#endif /* __SUPERLU_zSP_DEFS */