1
#ifndef __SUPERLU_UTIL /* allow multiple inclusions */
14
/***********************************************************************
16
***********************************************************************/
17
#define FIRSTCOL_OF_SNODE(i) (xsup[i])
18
/* No of marker arrays used in the symbolic factorization,
21
#define NUM_TEMPV(m,w,t,b) ( SUPERLU_MAX(m, (t + b)*w) )
24
#define USER_ABORT(msg) superlu_abort_and_exit(msg)
27
#define ABORT(err_msg) \
29
sprintf(msg,"%s at line %d in file %s\n",err_msg,__LINE__, __FILE__);\
35
#define USER_MALLOC(size) superlu_malloc(size)
37
/* The following may check out some uninitialized data */
38
#define USER_MALLOC(size) memset (superlu_malloc(size), '\x0F', size)
42
#define SUPERLU_MALLOC(size) USER_MALLOC(size)
45
#define USER_FREE(addr) superlu_free(addr)
48
#define SUPERLU_FREE(addr) USER_FREE(addr)
50
#define CHECK_MALLOC(where) { \
51
extern int superlu_malloc_total; \
52
printf("%s: malloc_total %d Bytes\n", \
53
where, superlu_malloc_total); \
56
#define SUPERLU_MAX(x, y) ( (x) > (y) ? (x) : (y) )
57
#define SUPERLU_MIN(x, y) ( (x) < (y) ? (x) : (y) )
59
/***********************************************************************
61
***********************************************************************/
67
/***********************************************************************
69
***********************************************************************/
70
typedef enum {NO, YES} yes_no_t;
71
typedef enum {DOFACT, SamePattern, SamePattern_SameRowPerm, FACTORED} fact_t;
72
typedef enum {NOROWPERM, LargeDiag, MY_PERMR} rowperm_t;
73
typedef enum {NATURAL, MMD_ATA, MMD_AT_PLUS_A, COLAMD, MY_PERMC}colperm_t;
74
typedef enum {NOTRANS, TRANS, CONJ} trans_t;
75
typedef enum {NOEQUIL, ROW, COL, BOTH} DiagScale_t;
76
typedef enum {NOREFINE, SINGLE=1, SLU_DOUBLE, EXTRA} IterRefine_t;
77
typedef enum {LUSUP, UCOL, LSUB, USUB} MemType;
78
typedef enum {HEAD, TAIL} stack_end_t;
79
typedef enum {SYSTEM, USER} LU_space_t;
82
* The following enumerate type is used by the statistics variable
83
* to keep track of flop count and time spent at various stages.
85
* Note that not all of the fields are disjoint.
88
COLPERM, /* find a column ordering that minimizes fills */
89
RELAX, /* find artificial supernodes */
90
ETREE, /* compute column etree */
91
EQUIL, /* equilibrate the original matrix */
92
FACT, /* perform LU factorization */
93
RCOND, /* estimate reciprocal condition number */
94
SOLVE, /* forward and back solves */
95
REFINE, /* perform iterative refinement */
96
SLU_FLOAT, /* time spent in floating-point operations */
97
TRSV, /* fraction of FACT spent in xTRSV */
98
GEMV, /* fraction of FACT spent in xGEMV */
99
FERR, /* estimate error bounds after iterative refinement */
100
NPHASES /* total number of phases */
104
/***********************************************************************
106
***********************************************************************/
107
typedef float flops_t;
108
typedef unsigned char Logical;
111
*-- This contains the options used to control the solve process.
114
* Specifies whether or not the factored form of the matrix
115
* A is supplied on entry, and if not, how the matrix A should
117
* = DOFACT: The matrix A will be factorized from scratch, and the
118
* factors will be stored in L and U.
119
* = SamePattern: The matrix A will be factorized assuming
120
* that a factorization of a matrix with the same sparsity
121
* pattern was performed prior to this one. Therefore, this
122
* factorization will reuse column permutation vector
123
* ScalePermstruct->perm_c and the column elimination tree
125
* = SamePattern_SameRowPerm: The matrix A will be factorized
126
* assuming that a factorization of a matrix with the same
127
* sparsity pattern and similar numerical values was performed
128
* prior to this one. Therefore, this factorization will reuse
129
* both row and column scaling factors R and C, and the
130
* both row and column permutation vectors perm_r and perm_c,
131
* distributed data structure set up from the previous symbolic
133
* = FACTORED: On entry, L, U, perm_r and perm_c contain the
134
* factored form of A. If DiagScale is not NOEQUIL, the matrix
135
* A has been equilibrated with scaling factors R and C.
138
* Specifies whether to equilibrate the system (scale A's row and
139
* columns to have unit norm).
141
* ColPerm (colperm_t)
142
* Specifies what type of column permutation to use to reduce fill.
143
* = NATURAL: use the natural ordering
144
* = MMD_ATA: use minimum degree ordering on structure of A'*A
145
* = MMD_AT_PLUS_A: use minimum degree ordering on structure of A'+A
146
* = COLAMD: use approximate minimum degree column ordering
147
* = MY_PERMC: use the ordering specified in ScalePermstruct->perm_c[]
150
* Specifies the form of the system of equations:
151
* = NOTRANS: A * X = B (No transpose)
152
* = TRANS: A**T * X = B (Transpose)
153
* = CONJ: A**H * X = B (Transpose)
155
* IterRefine (IterRefine_t)
156
* Specifies whether to perform iterative refinement.
157
* = NO: no iterative refinement
158
* = WorkingPrec: perform iterative refinement in working precision
159
* = ExtraPrec: perform iterative refinement in extra precision
161
* PrintStat (yes_no_t)
162
* Specifies whether to print the solver's statistics.
164
* DiagPivotThresh (double, in [0.0, 1.0]) (only for sequential SuperLU)
165
* Specifies the threshold used for a diagonal entry to be an
168
* PivotGrowth (yes_no_t)
169
* Specifies whether to compute the reciprocal pivot growth.
171
* ConditionNumber (ues_no_t)
172
* Specifies whether to compute the reciprocal condition number.
174
* RowPerm (rowperm_t) (only for SuperLU_DIST)
175
* Specifies whether to permute rows of the original matrix.
176
* = NO: not to permute the rows
177
* = LargeDiag: make the diagonal large relative to the off-diagonal
178
* = MY_PERMR: use the permutation given in ScalePermstruct->perm_r[]
180
* ReplaceTinyPivot (yes_no_t) (only for SuperLU_DIST)
181
* Specifies whether to replace the tiny diagonals by
182
* sqrt(epsilon)*||A|| during LU factorization.
184
* SolveInitialized (yes_no_t) (only for SuperLU_DIST)
185
* Specifies whether the initialization has been performed to the
188
* RefineInitialized (yes_no_t) (only for SuperLU_DIST)
189
* Specifies whether the initialization has been performed to the
190
* sparse matrix-vector multiplication routine needed in iterative
198
IterRefine_t IterRefine;
200
yes_no_t SymmetricMode;
201
double DiagPivotThresh;
202
yes_no_t PivotGrowth;
203
yes_no_t ConditionNumber;
205
yes_no_t ReplaceTinyPivot;
206
yes_no_t SolveInitialized;
207
yes_no_t RefineInitialized;
211
int *panel_histo; /* histogram of panel size distribution */
212
double *utime; /* running time at various phases */
213
flops_t *ops; /* operation count at various phases */
214
int TinyPivots; /* number of tiny pivots */
215
int RefineSteps; /* number of iterative refinement steps */
219
/***********************************************************************
221
***********************************************************************/
226
extern void Destroy_SuperMatrix_Store(SuperMatrix *);
227
extern void Destroy_CompCol_Matrix(SuperMatrix *);
228
extern void Destroy_CompRow_Matrix(SuperMatrix *);
229
extern void Destroy_SuperNode_Matrix(SuperMatrix *);
230
extern void Destroy_CompCol_Permuted(SuperMatrix *);
231
extern void Destroy_Dense_Matrix(SuperMatrix *);
232
extern void get_perm_c(int, SuperMatrix *, int *);
233
extern void set_default_options(superlu_options_t *options);
234
extern void sp_preorder (superlu_options_t *, SuperMatrix*, int*, int*,
236
extern void superlu_abort_and_exit(char*);
237
extern void *superlu_malloc (size_t);
238
extern int *intMalloc (int);
239
extern int *intCalloc (int);
240
extern void superlu_free (void*);
241
extern void SetIWork (int, int, int, int *, int **, int **, int **,
242
int **, int **, int **, int **);
243
extern int sp_coletree (int *, int *, int *, int, int, int *);
244
extern void relax_snode (const int, int *, const int, int *, int *);
245
extern void heap_relax_snode (const int, int *, const int, int *, int *);
246
extern void resetrep_col (const int, const int *, int *);
247
extern int spcoletree (int *, int *, int *, int, int, int *);
248
extern int *TreePostorder (int, int *);
249
extern double SuperLU_timer_ ();
250
extern int sp_ienv (int);
251
extern int lsame_ (char *, char *);
252
extern int xerbla_ (char *, int *);
253
extern void ifill (int *, int, int);
254
extern void snode_profile (int, int *);
255
extern void super_stats (int, int *);
256
extern void PrintSumm (char *, int, int, int);
257
extern void StatInit(SuperLUStat_t *);
258
extern void StatPrint (SuperLUStat_t *);
259
extern void StatFree(SuperLUStat_t *);
260
extern void print_panel_seg(int, int, int, int, int *, int *);
261
extern void check_repfnz(int, int, int, int *);
267
#endif /* __SUPERLU_UTIL */