TBCI Numerical high perf. C++ Library  2.8.0
csp_defs.h
Go to the documentation of this file.
1 
6 /* $Id: csp_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 
16 #ifndef __SUPERLU_cSP_DEFS /* allow multiple inclusions */
17 #define __SUPERLU_cSP_DEFS
18 
19 /*
20  * File name: csp_defs.h
21  * Purpose: Sparse matrix types and function prototypes
22  * History:
23  */
24 #ifdef _CRAY
25 #include <fortran.h>
26 #include <string.h>
27 #endif
28 #include "tbci/superlu/Cnames.h"
29 #include "tbci/superlu/supermatrix.h"
30 #include "tbci/superlu/scomplex.h"
31 
32 
33 /* No of marker arrays used in the symbolic factorization,
34  each of size n */
35 #define NO_MARKER 3
36 #define NUM_TEMPV(m,w,t,b) ( MAX(m, (t + b)*w) )
37 
38 typedef enum {LUSUP, UCOL, LSUB, USUB} MemType;
39 typedef enum {HEAD, TAIL} stack_end_t;
40 typedef enum {SYSTEM, USER} LU_space_t;
41 
42 /*
43  * Global data structures used in LU factorization -
44  *
45  * nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
46  * (xsup,supno): supno[i] is the supernode no to which i belongs;
47  * xsup(s) points to the beginning of the s-th supernode.
48 /bin/bash: s: command not found
49  * xsup 0 1 2 4 7 12
50  * Note: dfs will be performed on supernode rep. relative to the new
51  * row pivoting ordering
52  *
53  * (xlsub,lsub): lsub[*] contains the compressed subscript of
54  * rectangular supernodes; xlsub[j] points to the starting
55  * location of the j-th column in lsub[*]. Note that xlsub
56  * is indexed by column.
57  * Storage: original row subscripts
58  *
59  * During the course of sparse LU factorization, we also use
60  * (xlsub,lsub) for the purpose of symmetric pruning. For each
61  * supernode {s,s+1,...,t=s+r} with first column s and last
62  * column t, the subscript set
63  * lsub[j], j=xlsub[s], .., xlsub[s+1]-1
64  * is the structure of column s (i.e. structure of this supernode).
65  * It is used for the storage of numerical values.
66  * Furthermore,
67  * lsub[j], j=xlsub[t], .., xlsub[t+1]-1
68  * is the structure of the last column t of this supernode.
69  * It is for the purpose of symmetric pruning. Therefore, the
70  * structural subscripts can be rearranged without making physical
71  * interchanges among the numerical values.
72  *
73  * However, if the supernode has only one column, then we
74  * only keep one set of subscripts. For any subscript interchange
75  * performed, similar interchange must be done on the numerical
76  * values.
77  *
78  * The last column structures (for pruning) will be removed
79  * after the numercial LU factorization phase.
80  *
81  * (xlusup,lusup): lusup[*] contains the numerical values of the
82  * rectangular supernodes; xlusup[j] points to the starting
83  * location of the j-th column in storage vector lusup[*]
84  * Note: xlusup is indexed by column.
85  * Each rectangular supernode is stored by column-major
86  * scheme, consistent with Fortran 2-dim array storage.
87  *
88  * (xusub,ucol,usub): ucol[*] stores the numerical values of
89  * U-columns outside the rectangular supernodes. The row
90  * subscript of nonzero ucol[k] is stored in usub[k].
91  * xusub[i] points to the starting location of column i in ucol.
92  * Storage: new row subscripts; that is subscripts of PA.
93  */
94 typedef struct {
95  int *xsup; /* supernode and column mapping */
96  int *supno;
97  int *lsub; /* compressed L subscripts */
98  int *xlsub;
99  complex *lusup; /* L supernodes */
100  int *xlusup;
101  complex *ucol; /* U columns */
102  int *usub;
103  int *xusub;
104  int nzlmax; /* current max size of lsub */
105  int nzumax; /* " " " ucol */
106  int nzlumax; /* " " " lusup */
107  int n; /* number of columns in the matrix */
108  LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
109 } GlobalLU_t;
110 
111 typedef struct {
113  int relax;
115  float drop_tol;
117 
118 typedef struct {
119  float for_lu;
122 } mem_usage_t;
123 
124 #ifdef __cplusplus
125 extern "C" {
126 #endif
127 
128 /* Driver routines */
129 extern void
130 cgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *,
131  SuperMatrix *, int *);
132 extern void
133 cgssvx(char *, char *, char *, SuperMatrix *, factor_param_t *,
134  int *, int *, int *, char *, float *, float *,
135  SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *,
136  SuperMatrix *, float *, float *, float *,
137  float *, mem_usage_t *, int *);
138 
139 /* Supernodal LU factor related */
140 extern void
141 cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, complex *,
142  int *, int *, Stype_t, Dtype_t, Mtype_t);
143 extern void
145 extern void
146 cCreate_Dense_Matrix(SuperMatrix *, int, int, complex *, int,
148 extern void
149 cCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, complex *,
150  int *, int *, int *, int *, int *,
152 extern void
153 cCopy_Dense_Matrix(int, int, complex *, int, complex *, int);
154 
156 extern void Destroy_CompCol_Matrix(SuperMatrix *);
159 extern void Destroy_Dense_Matrix(SuperMatrix *);
160 
161 extern void callocateA (int, int, complex **, int **, int **);
162 extern void StatInit (int, int);
163 extern void StatFree ();
164 extern void get_perm_c(int, SuperMatrix *, int *);
165 extern void sp_preorder (char*, SuperMatrix*, int*, int*, SuperMatrix*);
166 extern int sp_coletree (int *, int *, int *, int, int, int *);
167 extern void cgstrf (char*, SuperMatrix*, float, float, int, int, int*,
168  void *, int, int *, int *,
169  SuperMatrix *, SuperMatrix *, int *);
170 extern void relax_snode (int, int *, int, int *, int *);
171 extern int csnode_dfs (const int, const int, const int *, const int *,
172  const int *, int *, int *, GlobalLU_t *);
173 extern int csnode_bmod (const int, const int, const int, complex *,
174  complex *, GlobalLU_t *);
175 extern void cpanel_dfs (const int, const int, const int, SuperMatrix *,
176  int *, int *, complex *, int *, int *, int *,
177  int *, int *, int *, int *, GlobalLU_t *);
178 extern void cpanel_bmod (const int, const int, const int, const int,
179  complex *, complex *, int *, int *,
180  GlobalLU_t *);
181 extern int ccolumn_dfs (const int, const int, int *, int *, int *, int *,
182  int *, int *, int *, int *, int *, GlobalLU_t *);
183 extern int ccolumn_bmod (const int, const int, complex *,
184  complex *, int *, int *, int, GlobalLU_t *);
185 extern int ccopy_to_ucol (int, int, int *, int *, int *,
186  complex *, GlobalLU_t *);
187 extern int cpivotL (const int, const float, int *, int *,
188  int *, int *, int *, GlobalLU_t *);
189 extern void cpruneL (const int, const int *, const int, const int,
190  const int *, const int *, int *, GlobalLU_t *);
191 extern void resetrep_col (const int, const int *, int *);
192 extern void countnz (const int, int *, int *, int *, GlobalLU_t *);
193 extern void fixupL (const int, const int *, GlobalLU_t *);
194 extern int spcoletree (int *, int *, int *, int, int, int *);
195 extern int *TreePostorder (int, int *);
196 extern void creadmt (int *, int *, int *, complex **, int **, int **);
197 extern void cGenXtrue (int, int, complex *, int);
198 extern void cFillRHS (char *, int, complex *, int, SuperMatrix *,
199  SuperMatrix *);
200 extern void cgstrs (char *, SuperMatrix *, SuperMatrix *, int *, int *,
201  SuperMatrix *, int *);
202 
203 
204 /* Driver related */
205 
206 extern void cgsequ (SuperMatrix *, float *, float *, float *,
207  float *, float *, int *);
208 extern void claqgs (SuperMatrix *, float *, float *, float,
209  float, float, char *);
210 extern void cgscon (char *, SuperMatrix *, SuperMatrix *,
211  float, float *, int *);
212 extern float cPivotGrowth(int, SuperMatrix *, int *,
213  SuperMatrix *, SuperMatrix *);
214 extern void cgsrfs (char *, SuperMatrix *, SuperMatrix *,
215  SuperMatrix *, int *, int *, char *, float *,
216  float *, SuperMatrix *, SuperMatrix *, float *,
217  float *, int *);
218 
219 extern int sp_ctrsv (char *, char *, char *, SuperMatrix *,
220  SuperMatrix *, complex *, int *);
221 extern int sp_cgemv (char *, complex, SuperMatrix *, complex *,
222  int, complex, complex *, int);
223 
224 extern int sp_cgemm (char *, char *, int, int, int, complex,
225  SuperMatrix *, complex *, int, complex,
226  complex *, int);
227 
228 /* Memory-related */
229 extern void superlu_abort_and_exit(char*);
230 extern void *superlu_malloc (int);
231 extern void superlu_free (void*);
232 extern int cLUMemInit (char *, void *, int, int, int, int, int,
234  GlobalLU_t *, int **, complex **);
235 extern void SetIWork (int, int, int, int *, int **, int **, int **,
236  int **, int **, int **, int **);
237 extern void cSetRWork (int, int, complex *, complex **, complex **);
238 extern void cLUWorkFree (int *, complex *, GlobalLU_t *);
239 extern int cLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
240 
241 extern int *intMalloc (int);
242 extern int *intCalloc (int);
243 extern complex *complexMalloc(int);
244 extern complex *complexCalloc(int);
245 extern float *floatMalloc(int);
246 extern float *floatCalloc(int);
247 extern void *superlu_malloc(int);
248 extern int memory_usage();
249 extern int cQuerySpace (SuperMatrix *, SuperMatrix *, int,
250  mem_usage_t *);
251 
252 /* Auxiliary routines */
253 extern void cCompRow_to_CompCol(int, int, int, complex*, int*, int*,
254  complex **, int **, int **);
255 extern double SuperLU_timer_ ();
256 extern int sp_ienv (int);
257 extern int lsame_ (char *, char *);
258 extern int xerbla_ (char *, int *);
259 extern void ifill (int *, int, int);
260 extern void cfill (complex *, int, complex);
261 extern void inf_norm_error (int, SuperMatrix *, complex *);
262 extern void snode_profile (int, int *);
263 extern void super_stats (int, int *);
264 extern void PrintSumm (char *, int, int, int);
265 extern void PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
266  complex, complex, complex *, complex *, char *);
267 
268 /* Routines for debugging */
269 extern void cPrint_CompCol_Matrix(char *, SuperMatrix *);
270 extern void cPrint_SuperNode_Matrix(char *, SuperMatrix *);
271 extern void cPrint_Dense_Matrix(char *, SuperMatrix *);
272 extern void print_lu_col(char *, int, int, int *, GlobalLU_t *);
273 extern void print_panel_seg(int, int, int, int, int *, int *);
274 extern void check_tempv(int, complex *);
275 extern void check_repfnz(int, int, int, int *);
276 
277 #ifdef __cplusplus
278  }
279 #endif
280 
281 #endif /* __SUPERLU_cSP_DEFS */
282 
float * floatMalloc(int)
void super_stats(int, int *)
void Destroy_CompCol_Permuted(SuperMatrix *)
void Destroy_SuperMatrix_Store(SuperMatrix *)
void print_lu_col(char *, int, int, int *, GlobalLU_t *)
int * xlsub
Definition: csp_defs.h:98
void cgstrf(char *, SuperMatrix *, float, float, int, int, int *, void *, int, int *, int *, SuperMatrix *, SuperMatrix *, int *)
int * supno
Definition: csp_defs.h:96
int * intMalloc(int)
void StatInit(int, int)
void cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, complex *, int *, int *, Stype_t, Dtype_t, Mtype_t)
void sp_preorder(char *, SuperMatrix *, int *, int *, SuperMatrix *)
void SetIWork(int, int, int, int *, int **, int **, int **, int **, int **, int **, int **)
complex * lusup
Definition: csp_defs.h:99
int nzumax
Definition: csp_defs.h:105
void cgssvx(char *, char *, char *, SuperMatrix *, factor_param_t *, int *, int *, int *, char *, float *, float *, SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *, SuperMatrix *, float *, float *, float *, float *, mem_usage_t *, int *)
int cpivotL(const int, const float, int *, int *, int *, int *, int *, GlobalLU_t *)
void creadmt(int *, int *, int *, complex **, int **, int **)
int * TreePostorder(int, int *)
void check_repfnz(int, int, int, int *)
float * floatCalloc(int)
void Destroy_Dense_Matrix(SuperMatrix *)
void countnz(const int, int *, int *, int *, GlobalLU_t *)
float for_lu
Definition: csp_defs.h:119
void cpanel_bmod(const int, const int, const int, const int, complex *, complex *, int *, int *, GlobalLU_t *)
int ccopy_to_ucol(int, int, int *, int *, int *, complex *, GlobalLU_t *)
int sp_ctrsv(char *, char *, char *, SuperMatrix *, SuperMatrix *, complex *, int *)
int ccolumn_bmod(const int, const int, complex *, complex *, int *, int *, int, GlobalLU_t *)
Definition: csp_defs.h:38
int sp_cgemv(char *, complex, SuperMatrix *, complex *, int, complex, complex *, int)
int sp_cgemm(char *, char *, int, int, int, complex, SuperMatrix *, complex *, int, complex, complex *, int)
void cSetRWork(int, int, complex *, complex **, complex **)
Stype_t
Definition: supermatrix.h:13
void cCreate_Dense_Matrix(SuperMatrix *, int, int, complex *, int, Stype_t, Dtype_t, Mtype_t)
int * xsup
Definition: csp_defs.h:95
complex * complexMalloc(int)
Definition: csp_defs.h:38
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
int cLUMemInit(char *, void *, int, int, int, int, int, SuperMatrix *, SuperMatrix *, GlobalLU_t *, int **, complex **)
Definition: csp_defs.h:39
void cpanel_dfs(const int, const int, const int, SuperMatrix *, int *, int *, complex *, int *, int *, int *, int *, int *, int *, int *, GlobalLU_t *)
int cLUMemXpand(int, int, MemType, int *, GlobalLU_t *)
int memory_usage()
float total_needed
Definition: csp_defs.h:120
int nzlumax
Definition: csp_defs.h:106
void Destroy_CompCol_Matrix(SuperMatrix *)
void cpruneL(const int, const int *, const int, const int, const int *, const int *, int *, GlobalLU_t *)
void fixupL(const int, const int *, GlobalLU_t *)
void cgstrs(char *, SuperMatrix *, SuperMatrix *, int *, int *, SuperMatrix *, int *)
int sp_coletree(int *, int *, int *, int, int, int *)
void * superlu_malloc(int)
complex * ucol
Definition: csp_defs.h:101
void PrintSumm(char *, int, int, int)
void get_perm_c(int, SuperMatrix *, int *)
void cPrint_CompCol_Matrix(char *, SuperMatrix *)
void claqgs(SuperMatrix *, float *, float *, float, float, float, char *)
void cPrint_SuperNode_Matrix(char *, SuperMatrix *)
int * intCalloc(int)
void Destroy_SuperNode_Matrix(SuperMatrix *)
int sp_ienv(int)
int * xlusup
Definition: csp_defs.h:100
void ifill(int *, int, int)
int cQuerySpace(SuperMatrix *, SuperMatrix *, int, mem_usage_t *)
void callocateA(int, int, complex **, int **, int **)
int expansions
Definition: csp_defs.h:121
void relax_snode(int, int *, int, int *, int *)
void cgsequ(SuperMatrix *, float *, float *, float *, float *, float *, int *)
stack_end_t
Definition: csp_defs.h:39
int csnode_dfs(const int, const int, const int *, const int *, const int *, int *, int *, GlobalLU_t *)
void cgsrfs(char *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *, int *, char *, float *, float *, SuperMatrix *, SuperMatrix *, float *, float *, int *)
Mtype_t
Definition: supermatrix.h:31
float cPivotGrowth(int, SuperMatrix *, int *, SuperMatrix *, SuperMatrix *)
int * lsub
Definition: csp_defs.h:97
Definition: csp_defs.h:38
void cPrint_Dense_Matrix(char *, SuperMatrix *)
void cgscon(char *, SuperMatrix *, SuperMatrix *, float, float *, int *)
void cLUWorkFree(int *, complex *, GlobalLU_t *)
float drop_tol
Definition: csp_defs.h:115
int xerbla_(char *, int *)
void cgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *)
int ccolumn_dfs(const int, const int, int *, int *, int *, int *, int *, int *, int *, int *, int *, GlobalLU_t *)
void cCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *)
void snode_profile(int, int *)
void superlu_abort_and_exit(char *)
LU_space_t MemModel
Definition: csp_defs.h:108
float diag_pivot_thresh
Definition: csp_defs.h:114
void print_panel_seg(int, int, int, int, int *, int *)
void cCompRow_to_CompCol(int, int, int, complex *, int *, int *, complex **, int **, int **)
Definition: f2c.h:33
Dtype_t
Definition: supermatrix.h:24
void cfill(complex *, int, complex)
void inf_norm_error(int, SuperMatrix *, complex *)
void superlu_free(void *)
int * xusub
Definition: csp_defs.h:103
int * usub
Definition: csp_defs.h:102
int nzlmax
Definition: csp_defs.h:104
Definition: csp_defs.h:39
void cCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, complex *, int *, int *, int *, int *, int *, Stype_t, Dtype_t, Mtype_t)
Definition: csp_defs.h:40
MemType
Definition: csp_defs.h:38
int lsame_(char *, char *)
void StatFree()
complex * complexCalloc(int)
Definition: csp_defs.h:38
int csnode_bmod(const int, const int, const int, complex *, complex *, GlobalLU_t *)
void cGenXtrue(int, int, complex *, int)
void resetrep_col(const int, const int *, int *)
void cCopy_Dense_Matrix(int, int, complex *, int, complex *, int)
void cFillRHS(char *, int, complex *, int, SuperMatrix *, SuperMatrix *)