TBCI Numerical high perf. C++ Library  2.8.0
zsp_defs.h
Go to the documentation of this file.
1 
6 /* $Id: zsp_defs.h,v 1.3.2.2 2019/05/28 11:13:02 garloff Exp $ */
7 
8 /*
9  * -- SuperLU routine (version 1.1) --
10  * Univ. of California Berkeley, Xerox Palo Alto Research Center,
11  * and Lawrence Berkeley National Lab.
12  * November 15, 1997
13  *
14  */
15 #ifndef __SUPERLU_zSP_DEFS /* allow multiple inclusions */
16 #define __SUPERLU_zSP_DEFS
17 
18 /*
19  * File name: zsp_defs.h
20  * Purpose: Sparse matrix types and function prototypes
21  * History:
22  */
23 #ifdef _CRAY
24 #include <fortran.h>
25 #include <string.h>
26 #endif
27 #include "tbci/superlu/Cnames.h"
28 #include "tbci/superlu/supermatrix.h"
29 #include "tbci/superlu/dcomplex.h"
30 
31 
32 /* No of marker arrays used in the symbolic factorization,
33  each of size n */
34 #define NO_MARKER 3
35 #define NUM_TEMPV(m,w,t,b) ( MAX(m, (t + b)*w) )
36 
37 typedef enum {LUSUP, UCOL, LSUB, USUB} MemType;
38 typedef enum {HEAD, TAIL} stack_end_t;
39 typedef enum {SYSTEM, USER} LU_space_t;
40 
41 /*
42  * Global data structures used in LU factorization -
43  *
44  * nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
45  * (xsup,supno): supno[i] is the supernode no to which i belongs;
46  * xsup(s) points to the beginning of the s-th supernode.
47  * e.g. supno 0 1 2 2 3 3 3 4 4 4 4 4 (n=12)
48  * xsup 0 1 2 4 7 12
49  * Note: dfs will be performed on supernode rep. relative to the new
50  * row pivoting ordering
51  *
52  * (xlsub,lsub): lsub[*] contains the compressed subscript of
53  * rectangular supernodes; xlsub[j] points to the starting
54  * location of the j-th column in lsub[*]. Note that xlsub
55  * is indexed by column.
56  * Storage: original row subscripts
57  *
58  * During the course of sparse LU factorization, we also use
59  * (xlsub,lsub) for the purpose of symmetric pruning. For each
60  * supernode {s,s+1,...,t=s+r} with first column s and last
61  * column t, the subscript set
62  * lsub[j], j=xlsub[s], .., xlsub[s+1]-1
63  * is the structure of column s (i.e. structure of this supernode).
64  * It is used for the storage of numerical values.
65  * Furthermore,
66  * lsub[j], j=xlsub[t], .., xlsub[t+1]-1
67  * is the structure of the last column t of this supernode.
68  * It is for the purpose of symmetric pruning. Therefore, the
69  * structural subscripts can be rearranged without making physical
70  * interchanges among the numerical values.
71  *
72  * However, if the supernode has only one column, then we
73  * only keep one set of subscripts. For any subscript interchange
74  * performed, similar interchange must be done on the numerical
75  * values.
76  *
77  * The last column structures (for pruning) will be removed
78  * after the numercial LU factorization phase.
79  *
80  * (xlusup,lusup): lusup[*] contains the numerical values of the
81  * rectangular supernodes; xlusup[j] points to the starting
82  * location of the j-th column in storage vector lusup[*]
83  * Note: xlusup is indexed by column.
84  * Each rectangular supernode is stored by column-major
85  * scheme, consistent with Fortran 2-dim array storage.
86  *
87  * (xusub,ucol,usub): ucol[*] stores the numerical values of
88  * U-columns outside the rectangular supernodes. The row
89  * subscript of nonzero ucol[k] is stored in usub[k].
90  * xusub[i] points to the starting location of column i in ucol.
91  * Storage: new row subscripts; that is subscripts of PA.
92  */
93 typedef struct {
94  int *xsup; /* supernode and column mapping */
95  int *supno;
96  int *lsub; /* compressed L subscripts */
97  int *xlsub;
98  doublecomplex *lusup; /* L supernodes */
99  int *xlusup;
100  doublecomplex *ucol; /* U columns */
101  int *usub;
102  int *xusub;
103  int nzlmax; /* current max size of lsub */
104  int nzumax; /* " " " ucol */
105  int nzlumax; /* " " " lusup */
106  int n; /* number of columns in the matrix */
107  LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
108 } GlobalLU_t;
109 
110 typedef struct {
111  int panel_size;
112  int relax;
113  double diag_pivot_thresh;
114  double drop_tol;
116 
117 typedef struct {
118  float for_lu;
119  float total_needed;
120  int expansions;
121 } mem_usage_t;
122 
123 #ifdef __cplusplus
124 extern "C" {
125 #endif
126 
127 /* Driver routines */
128 extern void
129 zgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *,
130  SuperMatrix *, int *);
131 extern void
132 zgssvx(char *, char *, char *, SuperMatrix *, factor_param_t *,
133  int *, int *, int *, char *, double *, double *,
134  SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *,
135  SuperMatrix *, double *, double *, double *,
136  double *, mem_usage_t *, int *);
137 
138 /* Supernodal LU factor related */
139 extern void
141  int *, int *, Stype_t, Dtype_t, Mtype_t);
142 extern void
144 extern void
147 extern void
149  int *, int *, int *, int *, int *,
151 extern void
152 zCopy_Dense_Matrix(int, int, doublecomplex *, int, doublecomplex *, int);
153 
155 extern void Destroy_CompCol_Matrix(SuperMatrix *);
158 extern void Destroy_Dense_Matrix(SuperMatrix *);
159 
160 extern void zallocateA (int, int, doublecomplex **, int **, int **);
161 extern void StatInit (int, int);
162 extern void StatFree ();
163 extern void get_perm_c(int, SuperMatrix *, int *);
164 extern void sp_preorder (char*, SuperMatrix*, int*, int*, SuperMatrix*);
165 extern int sp_coletree (int *, int *, int *, int, int, int *);
166 extern void zgstrf (char*, SuperMatrix*, double, double, int, int, int*,
167  void *, int, int *, int *,
168  SuperMatrix *, SuperMatrix *, int *);
169 extern void relax_snode (int, int *, int, int *, int *);
170 extern int zsnode_dfs (const int, const int, const int *, const int *,
171  const int *, int *, int *, GlobalLU_t *);
172 extern int zsnode_bmod (const int, const int, const int, doublecomplex *,
174 extern void zpanel_dfs (const int, const int, const int, SuperMatrix *,
175  int *, int *, doublecomplex *, int *, int *, int *,
176  int *, int *, int *, int *, GlobalLU_t *);
177 extern void zpanel_bmod (const int, const int, const int, const int,
178  doublecomplex *, doublecomplex *, int *, int *,
179  GlobalLU_t *);
180 extern int zcolumn_dfs (const int, const int, int *, int *, int *, int *,
181  int *, int *, int *, int *, int *, GlobalLU_t *);
182 extern int zcolumn_bmod (const int, const int, doublecomplex *,
183  doublecomplex *, int *, int *, int, GlobalLU_t *);
184 extern int zcopy_to_ucol (int, int, int *, int *, int *,
186 extern int zpivotL (const int, const double, int *, int *,
187  int *, int *, int *, GlobalLU_t *);
188 extern void zpruneL (const int, const int *, const int, const int,
189  const int *, const int *, int *, GlobalLU_t *);
190 extern void resetrep_col (const int, const int *, int *);
191 extern void countnz (const int, int *, int *, int *, GlobalLU_t *);
192 extern void fixupL (const int, const int *, GlobalLU_t *);
193 extern int spcoletree (int *, int *, int *, int, int, int *);
194 extern int *TreePostorder (int, int *);
195 extern void zreadmt (int *, int *, int *, doublecomplex **, int **, int **);
196 extern void zGenXtrue (int, int, doublecomplex *, int);
197 extern void zFillRHS (char *, int, doublecomplex *, int, SuperMatrix *,
198  SuperMatrix *);
199 extern void zgstrs (char *, SuperMatrix *, SuperMatrix *, int *, int *,
200  SuperMatrix *, int *);
201 
202 
203 /* Driver related */
204 
205 extern void zgsequ (SuperMatrix *, double *, double *, double *,
206  double *, double *, int *);
207 extern void zlaqgs (SuperMatrix *, double *, double *, double,
208  double, double, char *);
209 extern void zgscon (char *, SuperMatrix *, SuperMatrix *,
210  double, double *, int *);
211 extern double zPivotGrowth(int, SuperMatrix *, int *,
212  SuperMatrix *, SuperMatrix *);
213 extern void zgsrfs (char *, SuperMatrix *, SuperMatrix *,
214  SuperMatrix *, int *, int *, char *, double *,
215  double *, SuperMatrix *, SuperMatrix *,
216  double *, double *, int *);
217 
218 extern int sp_ztrsv (char *, char *, char *, SuperMatrix *,
219  SuperMatrix *, doublecomplex *, int *);
220 extern int sp_zgemv (char *, doublecomplex, SuperMatrix *, doublecomplex *,
221  int, doublecomplex, doublecomplex *, int);
222 
223 extern int sp_zgemm (char *, char *, int, int, int, doublecomplex,
225  doublecomplex *, int);
226 
227 /* Memory-related */
228 extern void superlu_abort_and_exit(char*);
229 extern void *superlu_malloc (int);
230 extern void superlu_free (void*);
231 extern int zLUMemInit (char *, void *, int, int, int, int, int,
233  GlobalLU_t *, int **, doublecomplex **);
234 extern void SetIWork (int, int, int, int *, int **, int **, int **,
235  int **, int **, int **, int **);
236 extern void zSetRWork (int, int, doublecomplex *, doublecomplex **, doublecomplex **);
237 extern void zLUWorkFree (int *, doublecomplex *, GlobalLU_t *);
238 extern int zLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
239 
240 extern int *intMalloc (int);
241 extern int *intCalloc (int);
244 extern double *doubleMalloc(int);
245 extern double *doubleCalloc(int);
246 extern void *superlu_malloc(int);
247 extern int memory_usage();
248 extern int zQuerySpace (SuperMatrix *, SuperMatrix *, int,
249  mem_usage_t *);
250 
251 /* Auxiliary routines */
252 extern void zCompRow_to_CompCol(int, int, int, doublecomplex*, int*, int*,
253  doublecomplex **, int **, int **);
254 extern double SuperLU_timer_ ();
255 extern int sp_ienv (int);
256 extern int lsame_ (char *, char *);
257 extern int xerbla_ (char *, int *);
258 extern void ifill (int *, int, int);
259 extern void zfill (doublecomplex *, int, doublecomplex);
260 extern void inf_norm_error (int, SuperMatrix *, doublecomplex *);
261 extern void snode_profile (int, int *);
262 extern void super_stats (int, int *);
263 extern void PrintSumm (char *, int, int, int);
264 extern void PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
266 
267 /* Routines for debugging */
268 extern void zPrint_CompCol_Matrix(char *, SuperMatrix *);
269 extern void zPrint_SuperNode_Matrix(char *, SuperMatrix *);
270 extern void zPrint_Dense_Matrix(char *, SuperMatrix *);
271 extern void print_lu_col(char *, int, int, int *, GlobalLU_t *);
272 extern void print_panel_seg(int, int, int, int, int *, int *);
273 extern void check_tempv(int, doublecomplex *);
274 extern void check_repfnz(int, int, int, int *);
275 
276 #ifdef __cplusplus
277  }
278 #endif
279 
280 #endif /* __SUPERLU_zSP_DEFS */
281 
void super_stats(int, int *)
void Destroy_CompCol_Permuted(SuperMatrix *)
void zGenXtrue(int, int, doublecomplex *, int)
void Destroy_SuperMatrix_Store(SuperMatrix *)
void print_lu_col(char *, int, int, int *, GlobalLU_t *)
void zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int, Stype_t, Dtype_t, Mtype_t)
void zgsrfs(char *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *, int *, char *, double *, double *, SuperMatrix *, SuperMatrix *, double *, double *, int *)
int * intMalloc(int)
void StatInit(int, int)
void zgssvx(char *, char *, char *, SuperMatrix *, factor_param_t *, int *, int *, int *, char *, double *, double *, SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *, SuperMatrix *, double *, double *, double *, double *, mem_usage_t *, int *)
void zallocateA(int, int, doublecomplex **, int **, int **)
void zPrint_SuperNode_Matrix(char *, SuperMatrix *)
void sp_preorder(char *, SuperMatrix *, int *, int *, SuperMatrix *)
void SetIWork(int, int, int, int *, int **, int **, int **, int **, int **, int **, int **)
void zfill(doublecomplex *, int, doublecomplex)
int * TreePostorder(int, int *)
void check_repfnz(int, int, int, int *)
double zPivotGrowth(int, SuperMatrix *, int *, SuperMatrix *, SuperMatrix *)
doublecomplex * doublecomplexMalloc(int)
void Destroy_Dense_Matrix(SuperMatrix *)
void countnz(const int, int *, int *, int *, GlobalLU_t *)
void zgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *)
void zpanel_dfs(const int, const int, const int, SuperMatrix *, int *, int *, doublecomplex *, int *, int *, int *, int *, int *, int *, int *, GlobalLU_t *)
void zCompRow_to_CompCol(int, int, int, doublecomplex *, int *, int *, doublecomplex **, int **, int **)
Definition: csp_defs.h:38
int sp_zgemv(char *, doublecomplex, SuperMatrix *, doublecomplex *, int, doublecomplex, doublecomplex *, int)
void zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *, int *, int *, Stype_t, Dtype_t, Mtype_t)
int zsnode_bmod(const int, const int, const int, doublecomplex *, doublecomplex *, GlobalLU_t *)
Stype_t
Definition: supermatrix.h:13
Definition: csp_defs.h:38
int zLUMemInit(char *, void *, int, int, int, int, int, SuperMatrix *, SuperMatrix *, GlobalLU_t *, int **, doublecomplex **)
double SuperLU_timer_()
void check_tempv(int, complex *)
int spcoletree(int *, int *, int *, int, int, int *)
void PrintPerf(SuperMatrix *, SuperMatrix *, mem_usage_t *, complex, complex, complex *, complex *, char *)
LU_space_t
Definition: csp_defs.h:40
Definition: csp_defs.h:39
void zPrint_CompCol_Matrix(char *, SuperMatrix *)
void zgscon(char *, SuperMatrix *, SuperMatrix *, double, double *, int *)
void zSetRWork(int, int, doublecomplex *, doublecomplex **, doublecomplex **)
int zLUMemXpand(int, int, MemType, int *, GlobalLU_t *)
int memory_usage()
void Destroy_CompCol_Matrix(SuperMatrix *)
void zCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *)
void fixupL(const int, const int *, GlobalLU_t *)
int sp_coletree(int *, int *, int *, int, int, int *)
void * superlu_malloc(int)
int sp_ztrsv(char *, char *, char *, SuperMatrix *, SuperMatrix *, doublecomplex *, int *)
void PrintSumm(char *, int, int, int)
void get_perm_c(int, SuperMatrix *, int *)
void zCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, doublecomplex *, int *, int *, int *, int *, int *, Stype_t, Dtype_t, Mtype_t)
int * intCalloc(int)
void Destroy_SuperNode_Matrix(SuperMatrix *)
int sp_ienv(int)
void ifill(int *, int, int)
void zgstrs(char *, SuperMatrix *, SuperMatrix *, int *, int *, SuperMatrix *, int *)
void zLUWorkFree(int *, doublecomplex *, GlobalLU_t *)
void zpruneL(const int, const int *, const int, const int, const int *, const int *, int *, GlobalLU_t *)
void zreadmt(int *, int *, int *, doublecomplex **, int **, int **)
void relax_snode(int, int *, int, int *, int *)
stack_end_t
Definition: csp_defs.h:39
void zgstrf(char *, SuperMatrix *, double, double, int, int, int *, void *, int, int *, int *, SuperMatrix *, SuperMatrix *, int *)
void zCopy_Dense_Matrix(int, int, doublecomplex *, int, doublecomplex *, int)
int sp_zgemm(char *, char *, int, int, int, doublecomplex, SuperMatrix *, doublecomplex *, int, doublecomplex, doublecomplex *, int)
Mtype_t
Definition: supermatrix.h:31
void zlaqgs(SuperMatrix *, double *, double *, double, double, double, char *)
Definition: csp_defs.h:38
double * doubleCalloc(int)
int xerbla_(char *, int *)
void zpanel_bmod(const int, const int, const int, const int, doublecomplex *, doublecomplex *, int *, int *, GlobalLU_t *)
void snode_profile(int, int *)
void superlu_abort_and_exit(char *)
void print_panel_seg(int, int, int, int, int *, int *)
int zcolumn_dfs(const int, const int, int *, int *, int *, int *, int *, int *, int *, int *, int *, GlobalLU_t *)
void zPrint_Dense_Matrix(char *, SuperMatrix *)
int zQuerySpace(SuperMatrix *, SuperMatrix *, int, mem_usage_t *)
void zgsequ(SuperMatrix *, double *, double *, double *, double *, double *, int *)
Dtype_t
Definition: supermatrix.h:24
int zpivotL(const int, const double, int *, int *, int *, int *, int *, GlobalLU_t *)
void inf_norm_error(int, SuperMatrix *, complex *)
void superlu_free(void *)
int zsnode_dfs(const int, const int, const int *, const int *, const int *, int *, int *, GlobalLU_t *)
doublecomplex * ucol
Definition: zsp_defs.h:100
doublecomplex * doublecomplexCalloc(int)
Definition: csp_defs.h:39
Definition: csp_defs.h:40
MemType
Definition: csp_defs.h:38
int lsame_(char *, char *)
void zFillRHS(char *, int, doublecomplex *, int, SuperMatrix *, SuperMatrix *)
void StatFree()
double * doubleMalloc(int)
doublecomplex * lusup
Definition: zsp_defs.h:98
Definition: csp_defs.h:38
int zcopy_to_ucol(int, int, int *, int *, int *, doublecomplex *, GlobalLU_t *)
void resetrep_col(const int, const int *, int *)
int zcolumn_bmod(const int, const int, doublecomplex *, doublecomplex *, int *, int *, int, GlobalLU_t *)