1 2 /*! @file slu_ddefs.h 3 * \brief Header file for real operations 4 * 5 * <pre> 6 * -- SuperLU routine (version 4.1) -- 7 * Univ. of California Berkeley, Xerox Palo Alto Research Center, 8 * and Lawrence Berkeley National Lab. 9 * November, 2010 10 * 11 * Global data structures used in LU factorization - 12 * 13 * nsuper: #supernodes = nsuper + 1, numbered [0, nsuper]. 14 * (xsup,supno): supno[i] is the supernode no to which i belongs; 15 * xsup(s) points to the beginning of the s-th supernode. 16 * e.g. supno 0 1 2 2 3 3 3 4 4 4 4 4 (n=12) 17 * xsup 0 1 2 4 7 12 18 * Note: dfs will be performed on supernode rep. relative to the new 19 * row pivoting ordering 20 * 21 * (xlsub,lsub): lsub[*] contains the compressed subscript of 22 * rectangular supernodes; xlsub[j] points to the starting 23 * location of the j-th column in lsub[*]. Note that xlsub 24 * is indexed by column. 25 * Storage: original row subscripts 26 * 27 * During the course of sparse LU factorization, we also use 28 * (xlsub,lsub) for the purpose of symmetric pruning. For each 29 * supernode {s,s+1,...,t=s+r} with first column s and last 30 * column t, the subscript set 31 * lsub[j], j=xlsub[s], .., xlsub[s+1]-1 32 * is the structure of column s (i.e. structure of this supernode). 33 * It is used for the storage of numerical values. 34 * Furthermore, 35 * lsub[j], j=xlsub[t], .., xlsub[t+1]-1 36 * is the structure of the last column t of this supernode. 37 * It is for the purpose of symmetric pruning. Therefore, the 38 * structural subscripts can be rearranged without making physical 39 * interchanges among the numerical values. 40 * 41 * However, if the supernode has only one column, then we 42 * only keep one set of subscripts. For any subscript interchange 43 * performed, similar interchange must be done on the numerical 44 * values. 45 * 46 * The last column structures (for pruning) will be removed 47 * after the numercial LU factorization phase. 48 * 49 * (xlusup,lusup): lusup[*] contains the numerical values of the 50 * rectangular supernodes; xlusup[j] points to the starting 51 * location of the j-th column in storage vector lusup[*] 52 * Note: xlusup is indexed by column. 53 * Each rectangular supernode is stored by column-major 54 * scheme, consistent with Fortran 2-dim array storage. 55 * 56 * (xusub,ucol,usub): ucol[*] stores the numerical values of 57 * U-columns outside the rectangular supernodes. The row 58 * subscript of nonzero ucol[k] is stored in usub[k]. 59 * xusub[i] points to the starting location of column i in ucol. 60 * Storage: new row subscripts; that is subscripts of PA. 61 * </pre> 62 */ 63 #ifndef __SUPERLU_dSP_DEFS /* allow multiple inclusions */ 64 #define __SUPERLU_dSP_DEFS 65 66 /* 67 * File name: dsp_defs.h 68 * Purpose: Sparse matrix types and function prototypes 69 * History: 70 */ 71 72 #ifdef _CRAY 73 #include <fortran.h> 74 #include <string.h> 75 #endif 76 77 /* Define my integer type int_t */ 78 typedef int int_t; /* default */ 79 80 #include <math.h> 81 #include <limits.h> 82 #include "slu_Cnames.h" 83 #include "supermatrix.h" 84 #include "slu_util.h" 85 86 87 88 typedef struct { 89 int *xsup; /* supernode and column mapping */ 90 int *supno; 91 int *lsub; /* compressed L subscripts */ 92 int *xlsub; 93 double *lusup; /* L supernodes */ 94 int *xlusup; 95 double *ucol; /* U columns */ 96 int *usub; 97 int *xusub; 98 int nzlmax; /* current max size of lsub */ 99 int nzumax; /* " " " ucol */ 100 int nzlumax; /* " " " lusup */ 101 int n; /* number of columns in the matrix */ 102 LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */ 103 int num_expansions; 104 ExpHeader *expanders; /* Array of pointers to 4 types of memory */ 105 LU_stack_t stack; /* use user supplied memory */ 106 } GlobalLU_t; 107 108 109 /* -------- Prototypes -------- */ 110 111 #ifdef __cplusplus 112 extern "C" { 113 #endif 114 115 /*! \brief Driver routines */ 116 extern void 117 dgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *, 118 SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *); 119 extern void 120 dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, 121 char *, double *, double *, SuperMatrix *, SuperMatrix *, 122 void *, int, SuperMatrix *, SuperMatrix *, 123 double *, double *, double *, double *, 124 mem_usage_t *, SuperLUStat_t *, int *); 125 /* ILU */ 126 extern void 127 dgsisv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *, 128 SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *); 129 extern void 130 dgsisx(superlu_options_t *, SuperMatrix *, int *, int *, int *, 131 char *, double *, double *, SuperMatrix *, SuperMatrix *, 132 void *, int, SuperMatrix *, SuperMatrix *, double *, double *, 133 mem_usage_t *, SuperLUStat_t *, int *); 134 135 136 /*! \brief Supernodal LU factor related */ 137 extern void 138 dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *, 139 int *, int *, Stype_t, Dtype_t, Mtype_t); 140 extern void 141 dCreate_CompRow_Matrix(SuperMatrix *, int, int, int, double *, 142 int *, int *, Stype_t, Dtype_t, Mtype_t); 143 extern void 144 dCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *); 145 extern void 146 dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int, 147 Stype_t, Dtype_t, Mtype_t); 148 extern void 149 dCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, double *, 150 int *, int *, int *, int *, int *, 151 Stype_t, Dtype_t, Mtype_t); 152 extern void 153 dCopy_Dense_Matrix(int, int, double *, int, double *, int); 154 155 extern void countnz (const int, int *, int *, int *, GlobalLU_t *); 156 extern void ilu_countnz (const int, int *, int *, GlobalLU_t *); 157 extern void fixupL (const int, const int *, GlobalLU_t *); 158 159 extern void dallocateA (int, int, double **, int **, int **); 160 extern void dgstrf (superlu_options_t*, SuperMatrix*, 161 int, int, int*, void *, int, int *, int *, 162 SuperMatrix *, SuperMatrix *, SuperLUStat_t*, int *); 163 extern int dsnode_dfs (const int, const int, const int *, const int *, 164 const int *, int *, int *, GlobalLU_t *); 165 extern int dsnode_bmod (const int, const int, const int, double *, 166 double *, GlobalLU_t *, SuperLUStat_t*); 167 extern void dpanel_dfs (const int, const int, const int, SuperMatrix *, 168 int *, int *, double *, int *, int *, int *, 169 int *, int *, int *, int *, GlobalLU_t *); 170 extern void dpanel_bmod (const int, const int, const int, const int, 171 double *, double *, int *, int *, 172 GlobalLU_t *, SuperLUStat_t*); 173 extern int dcolumn_dfs (const int, const int, int *, int *, int *, int *, 174 int *, int *, int *, int *, int *, GlobalLU_t *); 175 extern int dcolumn_bmod (const int, const int, double *, 176 double *, int *, int *, int, 177 GlobalLU_t *, SuperLUStat_t*); 178 extern int dcopy_to_ucol (int, int, int *, int *, int *, 179 double *, GlobalLU_t *); 180 extern int dpivotL (const int, const double, int *, int *, 181 int *, int *, int *, GlobalLU_t *, SuperLUStat_t*); 182 extern void dpruneL (const int, const int *, const int, const int, 183 const int *, const int *, int *, GlobalLU_t *); 184 extern void dreadmt (int *, int *, int *, double **, int **, int **); 185 extern void dGenXtrue (int, int, double *, int); 186 extern void dFillRHS (trans_t, int, double *, int, SuperMatrix *, 187 SuperMatrix *); 188 extern void dgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *, 189 SuperMatrix *, SuperLUStat_t*, int *); 190 /* ILU */ 191 extern void dgsitrf (superlu_options_t*, SuperMatrix*, int, int, int*, 192 void *, int, int *, int *, SuperMatrix *, SuperMatrix *, 193 SuperLUStat_t*, int *); 194 extern int dldperm(int, int, int, int [], int [], double [], 195 int [], double [], double []); 196 extern int ilu_dsnode_dfs (const int, const int, const int *, const int *, 197 const int *, int *, GlobalLU_t *); 198 extern void ilu_dpanel_dfs (const int, const int, const int, SuperMatrix *, 199 int *, int *, double *, double *, int *, int *, 200 int *, int *, int *, int *, GlobalLU_t *); 201 extern int ilu_dcolumn_dfs (const int, const int, int *, int *, int *, 202 int *, int *, int *, int *, int *, 203 GlobalLU_t *); 204 extern int ilu_dcopy_to_ucol (int, int, int *, int *, int *, 205 double *, int, milu_t, double, int, 206 double *, int *, GlobalLU_t *, double *); 207 extern int ilu_dpivotL (const int, const double, int *, int *, int, int *, 208 int *, int *, int *, double, milu_t, 209 double, GlobalLU_t *, SuperLUStat_t*); 210 extern int ilu_ddrop_row (superlu_options_t *, int, int, double, 211 int, int *, double *, GlobalLU_t *, 212 double *, double *, int); 213 214 215 /*! \brief Driver related */ 216 217 extern void dgsequ (SuperMatrix *, double *, double *, double *, 218 double *, double *, int *); 219 extern void dlaqgs (SuperMatrix *, double *, double *, double, 220 double, double, char *); 221 extern void dgscon (char *, SuperMatrix *, SuperMatrix *, 222 double, double *, SuperLUStat_t*, int *); 223 extern double dPivotGrowth(int, SuperMatrix *, int *, 224 SuperMatrix *, SuperMatrix *); 225 extern void dgsrfs (trans_t, SuperMatrix *, SuperMatrix *, 226 SuperMatrix *, int *, int *, char *, double *, 227 double *, SuperMatrix *, SuperMatrix *, 228 double *, double *, SuperLUStat_t*, int *); 229 230 extern int sp_dtrsv (char *, char *, char *, SuperMatrix *, 231 SuperMatrix *, double *, SuperLUStat_t*, int *); 232 extern int sp_dgemv (char *, double, SuperMatrix *, double *, 233 int, double, double *, int); 234 235 extern int sp_dgemm (char *, char *, int, int, int, double, 236 SuperMatrix *, double *, int, double, 237 double *, int); 238 extern double dlamch_(char *); 239 240 241 /*! \brief Memory-related */ 242 extern int dLUMemInit (fact_t, void *, int, int, int, int, int, 243 double, SuperMatrix *, SuperMatrix *, 244 GlobalLU_t *, int **, double **); 245 extern void dSetRWork (int, int, double *, double **, double **); 246 extern void dLUWorkFree (int *, double *, GlobalLU_t *); 247 extern int dLUMemXpand (int, int, MemType, int *, GlobalLU_t *); 248 249 extern double *doubleMalloc(int); 250 extern double *doubleCalloc(int); 251 extern int dmemory_usage(const int, const int, const int, const int); 252 extern int dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); 253 extern int ilu_dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); 254 255 /*! \brief Auxiliary routines */ 256 extern void dreadhb(int *, int *, int *, double **, int **, int **); 257 extern void dreadrb(int *, int *, int *, double **, int **, int **); 258 extern void dreadtriple(int *, int *, int *, double **, int **, int **); 259 extern void dCompRow_to_CompCol(int, int, int, double*, int*, int*, 260 double **, int **, int **); 261 extern void dfill (double *, int, double); 262 extern void dinf_norm_error (int, SuperMatrix *, double *); 263 extern void PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *, 264 double, double, double *, double *, char *); 265 extern double dqselect(int, double *, int); 266 267 268 /*! \brief Routines for debugging */ 269 extern void dPrint_CompCol_Matrix(char *, SuperMatrix *); 270 extern void dPrint_SuperNode_Matrix(char *, SuperMatrix *); 271 extern void dPrint_Dense_Matrix(char *, SuperMatrix *); 272 extern void dprint_lu_col(char *, int, int, int *, GlobalLU_t *); 273 extern int print_double_vec(char *, int, double *); 274 extern void check_tempv(int, double *); 275 276 #ifdef __cplusplus 277 } 278 #endif 279 280 #endif /* __SUPERLU_dSP_DEFS */ 281 282