TBCI Numerical high perf. C++ Library  2.8.0
ssp_defs.h
Go to the documentation of this file.
1 
6 /* $Id: ssp_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_sSP_DEFS /* allow multiple inclusions */
16 #define __SUPERLU_sSP_DEFS
17 
18 /*
19  * File name: ssp_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 
30 
31 /* No of marker arrays used in the symbolic factorization,
32  each of size n */
33 #define NO_MARKER 3
34 #define NUM_TEMPV(m,w,t,b) ( MAX(m, (t + b)*w) )
35 
36 typedef enum {LUSUP, UCOL, LSUB, USUB} MemType;
37 typedef enum {HEAD, TAIL} stack_end_t;
38 typedef enum {SYSTEM, USER} LU_space_t;
39 
40 /*
41  * Global data structures used in LU factorization -
42  *
43  * nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
44  * (xsup,supno): supno[i] is the supernode no to which i belongs;
45  * xsup(s) points to the beginning of the s-th supernode.
46  * e.g. supno 0 1 2 2 3 3 3 4 4 4 4 4 (n=12)
47  * xsup 0 1 2 4 7 12
48  * Note: dfs will be performed on supernode rep. relative to the new
49  * row pivoting ordering
50  *
51  * (xlsub,lsub): lsub[*] contains the compressed subscript of
52  * rectangular supernodes; xlsub[j] points to the starting
53  * location of the j-th column in lsub[*]. Note that xlsub
54  * is indexed by column.
55  * Storage: original row subscripts
56  *
57  * During the course of sparse LU factorization, we also use
58  * (xlsub,lsub) for the purpose of symmetric pruning. For each
59  * supernode {s,s+1,...,t=s+r} with first column s and last
60  * column t, the subscript set
61  * lsub[j], j=xlsub[s], .., xlsub[s+1]-1
62  * is the structure of column s (i.e. structure of this supernode).
63  * It is used for the storage of numerical values.
64  * Furthermore,
65  * lsub[j], j=xlsub[t], .., xlsub[t+1]-1
66  * is the structure of the last column t of this supernode.
67  * It is for the purpose of symmetric pruning. Therefore, the
68  * structural subscripts can be rearranged without making physical
69  * interchanges among the numerical values.
70  *
71  * However, if the supernode has only one column, then we
72  * only keep one set of subscripts. For any subscript interchange
73  * performed, similar interchange must be done on the numerical
74  * values.
75  *
76  * The last column structures (for pruning) will be removed
77  * after the numercial LU factorization phase.
78  *
79  * (xlusup,lusup): lusup[*] contains the numerical values of the
80  * rectangular supernodes; xlusup[j] points to the starting
81  * location of the j-th column in storage vector lusup[*]
82  * Note: xlusup is indexed by column.
83  * Each rectangular supernode is stored by column-major
84  * scheme, consistent with Fortran 2-dim array storage.
85  *
86  * (xusub,ucol,usub): ucol[*] stores the numerical values of
87  * U-columns outside the rectangular supernodes. The row
88  * subscript of nonzero ucol[k] is stored in usub[k].
89  * xusub[i] points to the starting location of column i in ucol.
90  * Storage: new row subscripts; that is subscripts of PA.
91  */
92 typedef struct {
93  int *xsup; /* supernode and column mapping */
94  int *supno;
95  int *lsub; /* compressed L subscripts */
96  int *xlsub;
97  float *lusup; /* L supernodes */
98  int *xlusup;
99  float *ucol; /* U columns */
100  int *usub;
101  int *xusub;
102  int nzlmax; /* current max size of lsub */
103  int nzumax; /* " " " ucol */
104  int nzlumax; /* " " " lusup */
105  int n; /* number of columns in the matrix */
106  LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
107 } GlobalLU_t;
108 
109 typedef struct {
110  int panel_size;
111  int relax;
112  float diag_pivot_thresh;
113  float drop_tol;
115 
116 typedef struct {
117  float for_lu;
118  float total_needed;
119  int expansions;
120 } mem_usage_t;
121 
122 #ifdef __cplusplus
123 extern "C" {
124 #endif
125 
126 /* Driver routines */
127 extern void
128 sgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *,
129  SuperMatrix *, int *);
130 extern void
131 sgssvx(char *, char *, char *, SuperMatrix *, factor_param_t *,
132  int *, int *, int *, char *, float *, float *,
133  SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *,
134  SuperMatrix *, float *, float *, float *,
135  float *, mem_usage_t *, int *);
136 
137 /* Supernodal LU factor related */
138 extern void
139 sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *,
140  int *, int *, Stype_t, Dtype_t, Mtype_t);
141 extern void
143 extern void
144 sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int,
146 extern void
147 sCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, float *,
148  int *, int *, int *, int *, int *,
150 extern void
151 sCopy_Dense_Matrix(int, int, float *, int, float *, int);
152 
154 extern void Destroy_CompCol_Matrix(SuperMatrix *);
157 extern void Destroy_Dense_Matrix(SuperMatrix *);
158 
159 extern void sallocateA (int, int, float **, int **, int **);
160 extern void StatInit (int, int);
161 extern void StatFree ();
162 extern void get_perm_c(int, SuperMatrix *, int *);
163 extern void sp_preorder (char*, SuperMatrix*, int*, int*, SuperMatrix*);
164 extern int sp_coletree (int *, int *, int *, int, int, int *);
165 extern void sgstrf (char*, SuperMatrix*, float, float, int, int, int*,
166  void *, int, int *, int *,
167  SuperMatrix *, SuperMatrix *, int *);
168 extern void relax_snode (int, int *, int, int *, int *);
169 extern int ssnode_dfs (const int, const int, const int *, const int *,
170  const int *, int *, int *, GlobalLU_t *);
171 extern int ssnode_bmod (const int, const int, const int, float *,
172  float *, GlobalLU_t *);
173 extern void spanel_dfs (const int, const int, const int, SuperMatrix *,
174  int *, int *, float *, int *, int *, int *,
175  int *, int *, int *, int *, GlobalLU_t *);
176 extern void spanel_bmod (const int, const int, const int, const int,
177  float *, float *, int *, int *,
178  GlobalLU_t *);
179 extern int scolumn_dfs (const int, const int, int *, int *, int *, int *,
180  int *, int *, int *, int *, int *, GlobalLU_t *);
181 extern int scolumn_bmod (const int, const int, float *,
182  float *, int *, int *, int, GlobalLU_t *);
183 extern int scopy_to_ucol (int, int, int *, int *, int *,
184  float *, GlobalLU_t *);
185 extern int spivotL (const int, const float, int *, int *,
186  int *, int *, int *, GlobalLU_t *);
187 extern void spruneL (const int, const int *, const int, const int,
188  const int *, const int *, int *, GlobalLU_t *);
189 extern void resetrep_col (const int, const int *, int *);
190 extern void countnz (const int, int *, int *, int *, GlobalLU_t *);
191 extern void fixupL (const int, const int *, GlobalLU_t *);
192 extern int spcoletree (int *, int *, int *, int, int, int *);
193 extern int *TreePostorder (int, int *);
194 extern void sreadmt (int *, int *, int *, float **, int **, int **);
195 extern void sGenXtrue (int, int, float *, int);
196 extern void sFillRHS (char *, int, float *, int, SuperMatrix *,
197  SuperMatrix *);
198 extern void sgstrs (char *, SuperMatrix *, SuperMatrix *, int *, int *,
199  SuperMatrix *, int *);
200 
201 
202 /* Driver related */
203 
204 extern void sgsequ (SuperMatrix *, float *, float *, float *,
205  float *, float *, int *);
206 extern void slaqgs (SuperMatrix *, float *, float *, float,
207  float, float, char *);
208 extern void sgscon (char *, SuperMatrix *, SuperMatrix *,
209  float, float *, int *);
210 extern float sPivotGrowth(int, SuperMatrix *, int *,
211  SuperMatrix *, SuperMatrix *);
212 extern void sgsrfs (char *, SuperMatrix *, SuperMatrix *,
213  SuperMatrix *, int *, int *, char *, float *,
214  float *, SuperMatrix *, SuperMatrix *, float *,
215  float *, int *);
216 
217 extern int sp_strsv (char *, char *, char *, SuperMatrix *,
218  SuperMatrix *, float *, int *);
219 extern int sp_sgemv (char *, float, SuperMatrix *, float *,
220  int, float, float *, int);
221 
222 extern int sp_sgemm (char *, char *, int, int, int, float,
223  SuperMatrix *, float *, int, float,
224  float *, int);
225 
226 /* Memory-related */
227 extern void superlu_abort_and_exit(char*);
228 extern void *superlu_malloc (int);
229 extern void superlu_free (void*);
230 extern int sLUMemInit (char *, void *, int, int, int, int, int,
232  GlobalLU_t *, int **, float **);
233 extern void SetIWork (int, int, int, int *, int **, int **, int **,
234  int **, int **, int **, int **);
235 extern void sSetRWork (int, int, float *, float **, float **);
236 extern void sLUWorkFree (int *, float *, GlobalLU_t *);
237 extern int sLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
238 
239 extern int *intMalloc (int);
240 extern int *intCalloc (int);
241 extern float *floatMalloc(int);
242 extern float *floatCalloc(int);
243 extern void *superlu_malloc(int);
244 extern int memory_usage();
245 extern int sQuerySpace (SuperMatrix *, SuperMatrix *, int,
246  mem_usage_t *);
247 
248 /* Auxiliary routines */
249 extern void sCompRow_to_CompCol(int, int, int, float*, int*, int*,
250  float **, int **, int **);
251 extern double SuperLU_timer_ ();
252 extern int sp_ienv (int);
253 extern int lsame_ (char *, char *);
254 extern int xerbla_ (char *, int *);
255 extern void ifill (int *, int, int);
256 extern void sfill (float *, int, float);
257 extern void inf_norm_error (int, SuperMatrix *, float *);
258 extern void snode_profile (int, int *);
259 extern void super_stats (int, int *);
260 extern void PrintSumm (char *, int, int, int);
261 extern void PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
262  float, float, float *, float *, char *);
263 
264 /* Routines for debugging */
265 extern void sPrint_CompCol_Matrix(char *, SuperMatrix *);
266 extern void sPrint_SuperNode_Matrix(char *, SuperMatrix *);
267 extern void sPrint_Dense_Matrix(char *, SuperMatrix *);
268 extern void print_lu_col(char *, int, int, int *, GlobalLU_t *);
269 extern void print_panel_seg(int, int, int, int, int *, int *);
270 extern void check_tempv(int, float *);
271 extern void check_repfnz(int, int, int, int *);
272 
273 #ifdef __cplusplus
274  }
275 #endif
276 
277 #endif /* __SUPERLU_sSP_DEFS */
278 
float * floatMalloc(int)
void sgsrfs(char *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *, int *, char *, float *, float *, SuperMatrix *, SuperMatrix *, float *, float *, int *)
void sSetRWork(int, int, float *, float **, float **)
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 sp_sgemm(char *, char *, int, int, int, float, SuperMatrix *, float *, int, float, float *, int)
int * intMalloc(int)
void StatInit(int, int)
void sp_preorder(char *, SuperMatrix *, int *, int *, SuperMatrix *)
void SetIWork(int, int, int, int *, int **, int **, int **, int **, int **, int **, int **)
void sPrint_Dense_Matrix(char *, SuperMatrix *)
void sgstrs(char *, SuperMatrix *, SuperMatrix *, int *, int *, SuperMatrix *, int *)
int sQuerySpace(SuperMatrix *, SuperMatrix *, int, mem_usage_t *)
int * TreePostorder(int, int *)
void check_repfnz(int, int, int, int *)
int spivotL(const int, const float, int *, int *, int *, int *, int *, GlobalLU_t *)
float * floatCalloc(int)
void Destroy_Dense_Matrix(SuperMatrix *)
void countnz(const int, int *, int *, int *, GlobalLU_t *)
void sgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *)
Definition: csp_defs.h:38
void sgscon(char *, SuperMatrix *, SuperMatrix *, float, float *, int *)
void sgsequ(SuperMatrix *, float *, float *, float *, float *, float *, int *)
void sGenXtrue(int, int, float *, int)
Stype_t
Definition: supermatrix.h:13
void sgstrf(char *, SuperMatrix *, float, float, int, int, int *, void *, int, int *, int *, SuperMatrix *, SuperMatrix *, 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 *)
int scolumn_bmod(const int, const int, float *, float *, int *, int *, int, GlobalLU_t *)
LU_space_t
Definition: csp_defs.h:40
void sallocateA(int, int, float **, int **, int **)
Definition: csp_defs.h:39
void sPrint_CompCol_Matrix(char *, SuperMatrix *)
int memory_usage()
void spanel_dfs(const int, const int, const int, SuperMatrix *, int *, int *, float *, int *, int *, int *, int *, int *, int *, int *, GlobalLU_t *)
void slaqgs(SuperMatrix *, float *, float *, float, float, float, char *)
void Destroy_CompCol_Matrix(SuperMatrix *)
void fixupL(const int, const int *, GlobalLU_t *)
int sp_coletree(int *, int *, int *, int, int, int *)
void * superlu_malloc(int)
void sCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, float *, int *, int *, int *, int *, int *, Stype_t, Dtype_t, Mtype_t)
void sgssvx(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 *)
void PrintSumm(char *, int, int, int)
void get_perm_c(int, SuperMatrix *, int *)
int sp_strsv(char *, char *, char *, SuperMatrix *, SuperMatrix *, float *, int *)
int * intCalloc(int)
void Destroy_SuperNode_Matrix(SuperMatrix *)
int sp_ienv(int)
void ifill(int *, int, int)
void sCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *)
int sp_sgemv(char *, float, SuperMatrix *, float *, int, float, float *, int)
void spruneL(const int, const int *, const int, const int, const int *, const int *, int *, GlobalLU_t *)
void spanel_bmod(const int, const int, const int, const int, float *, float *, int *, int *, GlobalLU_t *)
int sLUMemXpand(int, int, MemType, int *, GlobalLU_t *)
void relax_snode(int, int *, int, int *, int *)
int scolumn_dfs(const int, const int, int *, int *, int *, int *, int *, int *, int *, int *, int *, GlobalLU_t *)
float * lusup
Definition: ssp_defs.h:97
float * ucol
Definition: ssp_defs.h:99
stack_end_t
Definition: csp_defs.h:39
void sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *, int *, int *, Stype_t, Dtype_t, Mtype_t)
Mtype_t
Definition: supermatrix.h:31
void sreadmt(int *, int *, int *, float **, int **, int **)
Definition: csp_defs.h:38
int xerbla_(char *, int *)
void snode_profile(int, int *)
int ssnode_dfs(const int, const int, const int *, const int *, const int *, int *, int *, GlobalLU_t *)
float sPivotGrowth(int, SuperMatrix *, int *, SuperMatrix *, SuperMatrix *)
int scopy_to_ucol(int, int, int *, int *, int *, float *, GlobalLU_t *)
void superlu_abort_and_exit(char *)
void sCompRow_to_CompCol(int, int, int, float *, int *, int *, float **, int **, int **)
int sLUMemInit(char *, void *, int, int, int, int, int, SuperMatrix *, SuperMatrix *, GlobalLU_t *, int **, float **)
void print_panel_seg(int, int, int, int, int *, int *)
int ssnode_bmod(const int, const int, const int, float *, float *, GlobalLU_t *)
Dtype_t
Definition: supermatrix.h:24
void inf_norm_error(int, SuperMatrix *, complex *)
void sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int, Stype_t, Dtype_t, Mtype_t)
void superlu_free(void *)
Definition: csp_defs.h:39
void sCopy_Dense_Matrix(int, int, float *, int, float *, int)
Definition: csp_defs.h:40
void sLUWorkFree(int *, float *, GlobalLU_t *)
MemType
Definition: csp_defs.h:38
int lsame_(char *, char *)
void sFillRHS(char *, int, float *, int, SuperMatrix *, SuperMatrix *)
void sfill(float *, int, float)
void StatFree()
Definition: csp_defs.h:38
void sPrint_SuperNode_Matrix(char *, SuperMatrix *)
void resetrep_col(const int, const int *, int *)