TBCI Numerical high perf. C++ Library 2.8.0
dsp_defs.h
Go to the documentation of this file.
1
5
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
36typedef enum {LUSUP, UCOL, LSUB, USUB} MemType;
37typedef enum {HEAD, TAIL} stack_end_t;
38typedef 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 */
92typedef 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
109typedef struct {
110 int panel_size;
111 int relax;
113 double drop_tol;
115
116typedef struct {
117 float for_lu;
118 float total_needed;
119 int expansions;
121
122#ifdef __cplusplus
123extern "C" {
124#endif
125
126/* Driver routines */
127extern void
129 SuperMatrix *, int *);
130extern void
131dgssvx(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 */
138extern void
139dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *,
140 int *, int *, Stype_t, Dtype_t, Mtype_t);
141extern void
143extern void
144dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int,
146extern void
147dCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, double *,
148 int *, int *, int *, int *, int *,
150extern void
151dCopy_Dense_Matrix(int, int, double *, int, double *, int);
152
158
159extern void dallocateA (int, int, double **, int **, int **);
160extern void StatInit (int, int);
161extern void StatFree ();
162extern void get_perm_c(int, SuperMatrix *, int *);
163extern void sp_preorder (char*, SuperMatrix*, int*, int*, SuperMatrix*);
164extern int sp_coletree (int *, int *, int *, int, int, int *);
165extern void dgstrf (char*, SuperMatrix*, double, double, int, int, int*,
166 void *, int, int *, int *,
167 SuperMatrix *, SuperMatrix *, int *);
168extern void relax_snode (int, int *, int, int *, int *);
169extern int dsnode_dfs (const int, const int, const int *, const int *,
170 const int *, int *, int *, GlobalLU_t *);
171extern int dsnode_bmod (const int, const int, const int, double *,
172 double *, GlobalLU_t *);
173extern void dpanel_dfs (const int, const int, const int, SuperMatrix *,
174 int *, int *, double *, int *, int *, int *,
175 int *, int *, int *, int *, GlobalLU_t *);
176extern void dpanel_bmod (const int, const int, const int, const int,
177 double *, double *, int *, int *,
178 GlobalLU_t *);
179extern int dcolumn_dfs (const int, const int, int *, int *, int *, int *,
180 int *, int *, int *, int *, int *, GlobalLU_t *);
181extern int dcolumn_bmod (const int, const int, double *,
182 double *, int *, int *, int, GlobalLU_t *);
183extern int dcopy_to_ucol (int, int, int *, int *, int *,
184 double *, GlobalLU_t *);
185extern int dpivotL (const int, const double, int *, int *,
186 int *, int *, int *, GlobalLU_t *);
187extern void dpruneL (const int, const int *, const int, const int,
188 const int *, const int *, int *, GlobalLU_t *);
189extern void resetrep_col (const int, const int *, int *);
190extern void countnz (const int, int *, int *, int *, GlobalLU_t *);
191extern void fixupL (const int, const int *, GlobalLU_t *);
192extern int spcoletree (int *, int *, int *, int, int, int *);
193extern int *TreePostorder (int, int *);
194extern void dreadmt (int *, int *, int *, double **, int **, int **);
195extern void dGenXtrue (int, int, double *, int);
196extern void dFillRHS (char *, int, double *, int, SuperMatrix *,
197 SuperMatrix *);
198extern void dgstrs (char *, SuperMatrix *, SuperMatrix *, int *, int *,
199 SuperMatrix *, int *);
200
201
202/* Driver related */
203
204extern void dgsequ (SuperMatrix *, double *, double *, double *,
205 double *, double *, int *);
206extern void dlaqgs (SuperMatrix *, double *, double *, double,
207 double, double, char *);
208extern void dgscon (char *, SuperMatrix *, SuperMatrix *,
209 double, double *, int *);
210extern double dPivotGrowth(int, SuperMatrix *, int *,
212extern void dgsrfs (char *, SuperMatrix *, SuperMatrix *,
213 SuperMatrix *, int *, int *, char *, double *,
214 double *, SuperMatrix *, SuperMatrix *,
215 double *, double *, int *);
216
217extern int sp_dtrsv (char *, char *, char *, SuperMatrix *,
218 SuperMatrix *, double *, int *);
219extern int sp_dgemv (char *, double, SuperMatrix *, double *,
220 int, double, double *, int);
221
222extern int sp_dgemm (char *, char *, int, int, int, double,
223 SuperMatrix *, double *, int, double,
224 double *, int);
225
226/* Memory-related */
227extern void superlu_abort_and_exit(char*);
228extern void *superlu_malloc (int);
229extern void superlu_free (void*);
230extern int dLUMemInit (char *, void *, int, int, int, int, int,
232 GlobalLU_t *, int **, double **);
233extern void SetIWork (int, int, int, int *, int **, int **, int **,
234 int **, int **, int **, int **);
235extern void dSetRWork (int, int, double *, double **, double **);
236extern void dLUWorkFree (int *, double *, GlobalLU_t *);
237extern int dLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
238
239extern int *intMalloc (int);
240extern int *intCalloc (int);
241extern double *doubleMalloc(int);
242extern double *doubleCalloc(int);
243extern void *superlu_malloc(int);
244extern int memory_usage();
245extern int dQuerySpace (SuperMatrix *, SuperMatrix *, int,
246 mem_usage_t *);
247
248/* Auxiliary routines */
249extern void dCompRow_to_CompCol(int, int, int, double*, int*, int*,
250 double **, int **, int **);
251extern double SuperLU_timer_ ();
252extern int sp_ienv (int);
253extern int lsame_ (char *, char *);
254extern int xerbla_ (char *, int *);
255extern void ifill (int *, int, int);
256extern void dfill (double *, int, double);
257extern void inf_norm_error (int, SuperMatrix *, double *);
258extern void snode_profile (int, int *);
259extern void super_stats (int, int *);
260extern void PrintSumm (char *, int, int, int);
262 double, double, double *, double *, char *);
263
264/* Routines for debugging */
265extern void dPrint_CompCol_Matrix(char *, SuperMatrix *);
267extern void dPrint_Dense_Matrix(char *, SuperMatrix *);
268extern void print_lu_col(char *, int, int, int *, GlobalLU_t *);
269extern void print_panel_seg(int, int, int, int, int *, int *);
270extern void check_tempv(int, double *);
271extern void check_repfnz(int, int, int, int *);
272
273#ifdef __cplusplus
274 }
275#endif
276
277#endif /* __SUPERLU_dSP_DEFS */
278
LU_space_t
Definition csp_defs.h:40
@ SYSTEM
Definition csp_defs.h:40
@ USER
Definition csp_defs.h:40
stack_end_t
Definition csp_defs.h:39
@ HEAD
Definition csp_defs.h:39
@ TAIL
Definition csp_defs.h:39
MemType
Definition csp_defs.h:38
@ LSUB
Definition csp_defs.h:38
@ UCOL
Definition csp_defs.h:38
@ LUSUP
Definition csp_defs.h:38
@ USUB
Definition csp_defs.h:38
void sp_preorder(char *, SuperMatrix *, int *, int *, SuperMatrix *)
void snode_profile(int, int *)
void PrintPerf(SuperMatrix *, SuperMatrix *, mem_usage_t *, double, double, double *, double *, char *)
void dgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *)
void dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int, Stype_t, Dtype_t, Mtype_t)
int * intCalloc(int)
int spcoletree(int *, int *, int *, int, int, int *)
double SuperLU_timer_()
int dsnode_bmod(const int, const int, const int, double *, double *, GlobalLU_t *)
int dcolumn_dfs(const int, const int, int *, int *, int *, int *, int *, int *, int *, int *, int *, GlobalLU_t *)
void dFillRHS(char *, int, double *, int, SuperMatrix *, SuperMatrix *)
void superlu_free(void *)
void dCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *)
double * doubleMalloc(int)
void get_perm_c(int, SuperMatrix *, int *)
void StatFree()
void relax_snode(int, int *, int, int *, int *)
double dPivotGrowth(int, SuperMatrix *, int *, SuperMatrix *, SuperMatrix *)
void Destroy_SuperMatrix_Store(SuperMatrix *)
void inf_norm_error(int, SuperMatrix *, double *)
void dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *, int *, int *, Stype_t, Dtype_t, Mtype_t)
void dallocateA(int, int, double **, int **, int **)
int dQuerySpace(SuperMatrix *, SuperMatrix *, int, mem_usage_t *)
void Destroy_CompCol_Matrix(SuperMatrix *)
void dgsrfs(char *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *, int *, char *, double *, double *, SuperMatrix *, SuperMatrix *, double *, double *, int *)
void PrintSumm(char *, int, int, int)
void print_panel_seg(int, int, int, int, int *, int *)
void dPrint_CompCol_Matrix(char *, SuperMatrix *)
int dLUMemXpand(int, int, MemType, int *, GlobalLU_t *)
int lsame_(char *, char *)
void Destroy_CompCol_Permuted(SuperMatrix *)
void print_lu_col(char *, int, int, int *, GlobalLU_t *)
int sp_dgemv(char *, double, SuperMatrix *, double *, int, double, double *, int)
double * doubleCalloc(int)
int dpivotL(const int, const double, int *, int *, int *, int *, int *, GlobalLU_t *)
void dSetRWork(int, int, double *, double **, double **)
void dCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, double *, int *, int *, int *, int *, int *, Stype_t, Dtype_t, Mtype_t)
void dpanel_bmod(const int, const int, const int, const int, double *, double *, int *, int *, GlobalLU_t *)
void fixupL(const int, const int *, GlobalLU_t *)
int sp_ienv(int)
int sp_dtrsv(char *, char *, char *, SuperMatrix *, SuperMatrix *, double *, int *)
void dlaqgs(SuperMatrix *, double *, double *, double, double, double, char *)
void countnz(const int, int *, int *, int *, GlobalLU_t *)
void * superlu_malloc(int)
int xerbla_(char *, int *)
void StatInit(int, int)
void dpruneL(const int, const int *, const int, const int, const int *, const int *, int *, GlobalLU_t *)
void dCopy_Dense_Matrix(int, int, double *, int, double *, int)
int dcopy_to_ucol(int, int, int *, int *, int *, double *, GlobalLU_t *)
void check_repfnz(int, int, int, int *)
void Destroy_Dense_Matrix(SuperMatrix *)
void dgstrs(char *, SuperMatrix *, SuperMatrix *, int *, int *, SuperMatrix *, int *)
void ifill(int *, int, int)
int dsnode_dfs(const int, const int, const int *, const int *, const int *, int *, int *, GlobalLU_t *)
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 *)
int dcolumn_bmod(const int, const int, double *, double *, int *, int *, int, GlobalLU_t *)
void dfill(double *, int, double)
void resetrep_col(const int, const int *, int *)
int sp_dgemm(char *, char *, int, int, int, double, SuperMatrix *, double *, int, double, double *, int)
int dLUMemInit(char *, void *, int, int, int, int, int, SuperMatrix *, SuperMatrix *, GlobalLU_t *, int **, double **)
void superlu_abort_and_exit(char *)
void check_tempv(int, double *)
void super_stats(int, int *)
void dpanel_dfs(const int, const int, const int, SuperMatrix *, int *, int *, double *, int *, int *, int *, int *, int *, int *, int *, GlobalLU_t *)
int memory_usage()
void dgscon(char *, SuperMatrix *, SuperMatrix *, double, double *, int *)
void dPrint_Dense_Matrix(char *, SuperMatrix *)
void dPrint_SuperNode_Matrix(char *, SuperMatrix *)
void dgstrf(char *, SuperMatrix *, double, double, int, int, int *, void *, int, int *, int *, SuperMatrix *, SuperMatrix *, int *)
void Destroy_SuperNode_Matrix(SuperMatrix *)
int * TreePostorder(int, int *)
void dLUWorkFree(int *, double *, GlobalLU_t *)
void SetIWork(int, int, int, int *, int **, int **, int **, int **, int **, int **, int **)
void dGenXtrue(int, int, double *, int)
void dreadmt(int *, int *, int *, double **, int **, int **)
int sp_coletree(int *, int *, int *, int, int, int *)
void dCompRow_to_CompCol(int, int, int, double *, int *, int *, double **, int **, int **)
int * intMalloc(int)
void dgsequ(SuperMatrix *, double *, double *, double *, double *, double *, int *)
int * xusub
Definition csp_defs.h:103
int * xlusup
Definition csp_defs.h:100
int * usub
Definition csp_defs.h:102
LU_space_t MemModel
Definition csp_defs.h:108
complex * lusup
Definition csp_defs.h:99
int nzlumax
Definition csp_defs.h:106
complex * ucol
Definition csp_defs.h:101
float diag_pivot_thresh
Definition csp_defs.h:114
Mtype_t
Definition supermatrix.h:31
Dtype_t
Definition supermatrix.h:24
Stype_t
Definition supermatrix.h:13
LU_space_t
Definition zsp_defs.h:39