TBCI Numerical high perf. C++ Library  2.8.0
dsp_defs.h
Go to the documentation of this file.
1 
6 /* $Id: dsp_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_dSP_DEFS /* allow multiple inclusions */
16 #define __SUPERLU_dSP_DEFS
17 
18 /*
19  * File name: dsp_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  double *lusup; /* L supernodes */
98  int *xlusup;
99  double *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;
113  double 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 dgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *,
129  SuperMatrix *, int *);
130 extern void
131 dgssvx(char *, char *, char *, SuperMatrix *, factor_param_t *,
132  int *, int *, int *, char *, double *, double *,
133  SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *,
134  SuperMatrix *, double *, double *, double *,
135  double *, mem_usage_t *, int *);
136 
137 /* Supernodal LU factor related */
138 extern void
139 dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *,
140  int *, int *, Stype_t, Dtype_t, Mtype_t);
141 extern void
143 extern void
144 dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int,
146 extern void
147 dCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, double *,
148  int *, int *, int *, int *, int *,
150 extern void
151 dCopy_Dense_Matrix(int, int, double *, int, double *, int);
152 
154 extern void Destroy_CompCol_Matrix(SuperMatrix *);
157 extern void Destroy_Dense_Matrix(SuperMatrix *);
158 
159 extern void dallocateA (int, int, double **, 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 dgstrf (char*, SuperMatrix*, double, double, 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 dsnode_dfs (const int, const int, const int *, const int *,
170  const int *, int *, int *, GlobalLU_t *);
171 extern int dsnode_bmod (const int, const int, const int, double *,
172  double *, GlobalLU_t *);
173 extern void dpanel_dfs (const int, const int, const int, SuperMatrix *,
174  int *, int *, double *, int *, int *, int *,
175  int *, int *, int *, int *, GlobalLU_t *);
176 extern void dpanel_bmod (const int, const int, const int, const int,
177  double *, double *, int *, int *,
178  GlobalLU_t *);
179 extern int dcolumn_dfs (const int, const int, int *, int *, int *, int *,
180  int *, int *, int *, int *, int *, GlobalLU_t *);
181 extern int dcolumn_bmod (const int, const int, double *,
182  double *, int *, int *, int, GlobalLU_t *);
183 extern int dcopy_to_ucol (int, int, int *, int *, int *,
184  double *, GlobalLU_t *);
185 extern int dpivotL (const int, const double, int *, int *,
186  int *, int *, int *, GlobalLU_t *);
187 extern void dpruneL (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 dreadmt (int *, int *, int *, double **, int **, int **);
195 extern void dGenXtrue (int, int, double *, int);
196 extern void dFillRHS (char *, int, double *, int, SuperMatrix *,
197  SuperMatrix *);
198 extern void dgstrs (char *, SuperMatrix *, SuperMatrix *, int *, int *,
199  SuperMatrix *, int *);
200 
201 
202 /* Driver related */
203 
204 extern void dgsequ (SuperMatrix *, double *, double *, double *,
205  double *, double *, int *);
206 extern void dlaqgs (SuperMatrix *, double *, double *, double,
207  double, double, char *);
208 extern void dgscon (char *, SuperMatrix *, SuperMatrix *,
209  double, double *, int *);
210 extern double dPivotGrowth(int, SuperMatrix *, int *,
211  SuperMatrix *, SuperMatrix *);
212 extern void dgsrfs (char *, SuperMatrix *, SuperMatrix *,
213  SuperMatrix *, int *, int *, char *, double *,
214  double *, SuperMatrix *, SuperMatrix *,
215  double *, double *, int *);
216 
217 extern int sp_dtrsv (char *, char *, char *, SuperMatrix *,
218  SuperMatrix *, double *, int *);
219 extern int sp_dgemv (char *, double, SuperMatrix *, double *,
220  int, double, double *, int);
221 
222 extern int sp_dgemm (char *, char *, int, int, int, double,
223  SuperMatrix *, double *, int, double,
224  double *, 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 dLUMemInit (char *, void *, int, int, int, int, int,
232  GlobalLU_t *, int **, double **);
233 extern void SetIWork (int, int, int, int *, int **, int **, int **,
234  int **, int **, int **, int **);
235 extern void dSetRWork (int, int, double *, double **, double **);
236 extern void dLUWorkFree (int *, double *, GlobalLU_t *);
237 extern int dLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
238 
239 extern int *intMalloc (int);
240 extern int *intCalloc (int);
241 extern double *doubleMalloc(int);
242 extern double *doubleCalloc(int);
243 extern void *superlu_malloc(int);
244 extern int memory_usage();
245 extern int dQuerySpace (SuperMatrix *, SuperMatrix *, int,
246  mem_usage_t *);
247 
248 /* Auxiliary routines */
249 extern void dCompRow_to_CompCol(int, int, int, double*, int*, int*,
250  double **, 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 dfill (double *, int, double);
257 extern void inf_norm_error (int, SuperMatrix *, double *);
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  double, double, double *, double *, char *);
263 
264 /* Routines for debugging */
265 extern void dPrint_CompCol_Matrix(char *, SuperMatrix *);
266 extern void dPrint_SuperNode_Matrix(char *, SuperMatrix *);
267 extern void dPrint_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, double *);
271 extern void check_repfnz(int, int, int, int *);
272 
273 #ifdef __cplusplus
274  }
275 #endif
276 
277 #endif /* __SUPERLU_dSP_DEFS */
278 
double * lusup
Definition: dsp_defs.h:97
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 * intMalloc(int)
void StatInit(int, int)
int sp_dgemm(char *, char *, int, int, int, double, SuperMatrix *, double *, int, double, double *, int)
void sp_preorder(char *, SuperMatrix *, int *, int *, SuperMatrix *)
void SetIWork(int, int, int, int *, int **, int **, int **, int **, int **, int **, int **)
void dFillRHS(char *, int, double *, int, SuperMatrix *, SuperMatrix *)
double * ucol
Definition: dsp_defs.h:99
int * TreePostorder(int, int *)
int sp_dgemv(char *, double, SuperMatrix *, double *, int, double, double *, int)
void check_repfnz(int, int, int, int *)
int dpivotL(const int, const double, int *, int *, int *, int *, int *, GlobalLU_t *)
void dCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *)
int dLUMemXpand(int, int, MemType, int *, GlobalLU_t *)
void Destroy_Dense_Matrix(SuperMatrix *)
void countnz(const int, int *, int *, int *, GlobalLU_t *)
void dgstrf(char *, SuperMatrix *, double, double, int, int, int *, void *, int, int *, int *, SuperMatrix *, SuperMatrix *, int *)
Definition: csp_defs.h:38
void dCopy_Dense_Matrix(int, int, double *, int, double *, int)
Stype_t
Definition: supermatrix.h:13
Definition: csp_defs.h:38
double SuperLU_timer_()
void check_tempv(int, complex *)
int dcolumn_dfs(const int, const int, int *, int *, int *, int *, int *, int *, int *, int *, int *, GlobalLU_t *)
int spcoletree(int *, int *, int *, int, int, int *)
void PrintPerf(SuperMatrix *, SuperMatrix *, mem_usage_t *, complex, complex, complex *, complex *, char *)
void dgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *)
LU_space_t
Definition: csp_defs.h:40
void dLUWorkFree(int *, double *, GlobalLU_t *)
void dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *, int *, int *, Stype_t, Dtype_t, Mtype_t)
void dCompRow_to_CompCol(int, int, int, double *, int *, int *, double **, int **, int **)
Definition: csp_defs.h:39
void dgscon(char *, SuperMatrix *, SuperMatrix *, double, double *, int *)
void dpruneL(const int, const int *, const int, const int, const int *, const int *, int *, GlobalLU_t *)
void dPrint_Dense_Matrix(char *, SuperMatrix *)
void dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int, Stype_t, Dtype_t, Mtype_t)
int memory_usage()
void dPrint_CompCol_Matrix(char *, SuperMatrix *)
void dallocateA(int, int, double **, int **, int **)
void dCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, double *, int *, int *, int *, int *, int *, Stype_t, Dtype_t, Mtype_t)
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)
double dPivotGrowth(int, SuperMatrix *, int *, SuperMatrix *, SuperMatrix *)
void PrintSumm(char *, int, int, int)
void get_perm_c(int, SuperMatrix *, int *)
void dfill(double *, int, double)
int * intCalloc(int)
void Destroy_SuperNode_Matrix(SuperMatrix *)
int sp_ienv(int)
int dLUMemInit(char *, void *, int, int, int, int, int, SuperMatrix *, SuperMatrix *, GlobalLU_t *, int **, double **)
void dreadmt(int *, int *, int *, double **, int **, int **)
void ifill(int *, int, int)
int dsnode_bmod(const int, const int, const int, double *, double *, GlobalLU_t *)
void relax_snode(int, int *, int, int *, int *)
int sp_dtrsv(char *, char *, char *, SuperMatrix *, SuperMatrix *, double *, int *)
void dGenXtrue(int, int, double *, int)
stack_end_t
Definition: csp_defs.h:39
int dQuerySpace(SuperMatrix *, SuperMatrix *, int, mem_usage_t *)
Mtype_t
Definition: supermatrix.h:31
Definition: csp_defs.h:38
int dcopy_to_ucol(int, int, int *, int *, int *, double *, GlobalLU_t *)
void dPrint_SuperNode_Matrix(char *, SuperMatrix *)
double drop_tol
Definition: dsp_defs.h:113
double * doubleCalloc(int)
int xerbla_(char *, int *)
void snode_profile(int, int *)
void superlu_abort_and_exit(char *)
int dsnode_dfs(const int, const int, const int *, const int *, const int *, int *, int *, GlobalLU_t *)
double diag_pivot_thresh
Definition: dsp_defs.h:112
void print_panel_seg(int, int, int, int, int *, int *)
void dlaqgs(SuperMatrix *, double *, double *, double, double, double, char *)
void dgsequ(SuperMatrix *, double *, double *, double *, double *, double *, int *)
Dtype_t
Definition: supermatrix.h:24
void inf_norm_error(int, SuperMatrix *, complex *)
void superlu_free(void *)
void dgsrfs(char *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *, int *, char *, double *, double *, SuperMatrix *, SuperMatrix *, double *, double *, int *)
void dpanel_bmod(const int, const int, const int, const int, double *, double *, int *, int *, GlobalLU_t *)
Definition: csp_defs.h:39
void dgssvx(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 *)
Definition: csp_defs.h:40
void dpanel_dfs(const int, const int, const int, SuperMatrix *, int *, int *, double *, int *, int *, int *, int *, int *, int *, int *, GlobalLU_t *)
MemType
Definition: csp_defs.h:38
int lsame_(char *, char *)
void StatFree()
void dgstrs(char *, SuperMatrix *, SuperMatrix *, int *, int *, SuperMatrix *, int *)
int dcolumn_bmod(const int, const int, double *, double *, int *, int *, int, GlobalLU_t *)
double * doubleMalloc(int)
Definition: csp_defs.h:38
void dSetRWork(int, int, double *, double **, double **)
void resetrep_col(const int, const int *, int *)