2011-02-25 10:24:29 +00:00
|
|
|
/** \file opennl/superlu/ssp_defs.h
|
|
|
|
* \ingroup opennl
|
|
|
|
*/
|
2004-07-13 11:42:13 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* -- SuperLU routine (version 3.0) --
|
|
|
|
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
|
|
|
|
* and Lawrence Berkeley National Lab.
|
|
|
|
* October 15, 2003
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef __SUPERLU_sSP_DEFS /* allow multiple inclusions */
|
|
|
|
#define __SUPERLU_sSP_DEFS
|
|
|
|
|
|
|
|
/*
|
|
|
|
* File name: ssp_defs.h
|
|
|
|
* Purpose: Sparse matrix types and function prototypes
|
|
|
|
* History:
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef _CRAY
|
|
|
|
#include <fortran.h>
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Define my integer type int_t */
|
|
|
|
typedef int int_t; /* default */
|
|
|
|
|
|
|
|
#include "Cnames.h"
|
|
|
|
#include "supermatrix.h"
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Global data structures used in LU factorization -
|
|
|
|
*
|
|
|
|
* nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
|
|
|
|
* (xsup,supno): supno[i] is the supernode no to which i belongs;
|
|
|
|
* xsup(s) points to the beginning of the s-th supernode.
|
|
|
|
* e.g. supno 0 1 2 2 3 3 3 4 4 4 4 4 (n=12)
|
|
|
|
* xsup 0 1 2 4 7 12
|
|
|
|
* Note: dfs will be performed on supernode rep. relative to the new
|
|
|
|
* row pivoting ordering
|
|
|
|
*
|
|
|
|
* (xlsub,lsub): lsub[*] contains the compressed subscript of
|
|
|
|
* rectangular supernodes; xlsub[j] points to the starting
|
|
|
|
* location of the j-th column in lsub[*]. Note that xlsub
|
|
|
|
* is indexed by column.
|
|
|
|
* Storage: original row subscripts
|
|
|
|
*
|
|
|
|
* During the course of sparse LU factorization, we also use
|
|
|
|
* (xlsub,lsub) for the purpose of symmetric pruning. For each
|
|
|
|
* supernode {s,s+1,...,t=s+r} with first column s and last
|
|
|
|
* column t, the subscript set
|
|
|
|
* lsub[j], j=xlsub[s], .., xlsub[s+1]-1
|
|
|
|
* is the structure of column s (i.e. structure of this supernode).
|
|
|
|
* It is used for the storage of numerical values.
|
|
|
|
* Furthermore,
|
|
|
|
* lsub[j], j=xlsub[t], .., xlsub[t+1]-1
|
|
|
|
* is the structure of the last column t of this supernode.
|
|
|
|
* It is for the purpose of symmetric pruning. Therefore, the
|
|
|
|
* structural subscripts can be rearranged without making physical
|
|
|
|
* interchanges among the numerical values.
|
|
|
|
*
|
|
|
|
* However, if the supernode has only one column, then we
|
|
|
|
* only keep one set of subscripts. For any subscript interchange
|
|
|
|
* performed, similar interchange must be done on the numerical
|
|
|
|
* values.
|
|
|
|
*
|
|
|
|
* The last column structures (for pruning) will be removed
|
|
|
|
* after the numercial LU factorization phase.
|
|
|
|
*
|
|
|
|
* (xlusup,lusup): lusup[*] contains the numerical values of the
|
|
|
|
* rectangular supernodes; xlusup[j] points to the starting
|
|
|
|
* location of the j-th column in storage vector lusup[*]
|
|
|
|
* Note: xlusup is indexed by column.
|
|
|
|
* Each rectangular supernode is stored by column-major
|
|
|
|
* scheme, consistent with Fortran 2-dim array storage.
|
|
|
|
*
|
|
|
|
* (xusub,ucol,usub): ucol[*] stores the numerical values of
|
|
|
|
* U-columns outside the rectangular supernodes. The row
|
|
|
|
* subscript of nonzero ucol[k] is stored in usub[k].
|
|
|
|
* xusub[i] points to the starting location of column i in ucol.
|
|
|
|
* Storage: new row subscripts; that is subscripts of PA.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
int *xsup; /* supernode and column mapping */
|
|
|
|
int *supno;
|
|
|
|
int *lsub; /* compressed L subscripts */
|
|
|
|
int *xlsub;
|
2014-09-20 17:51:34 +00:00
|
|
|
double *lusup; /* L supernodes */
|
2004-07-13 11:42:13 +00:00
|
|
|
int *xlusup;
|
2014-09-20 17:51:34 +00:00
|
|
|
double *ucol; /* U columns */
|
2004-07-13 11:42:13 +00:00
|
|
|
int *usub;
|
|
|
|
int *xusub;
|
|
|
|
int nzlmax; /* current max size of lsub */
|
|
|
|
int nzumax; /* " " " ucol */
|
|
|
|
int nzlumax; /* " " " lusup */
|
|
|
|
int n; /* number of columns in the matrix */
|
|
|
|
LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
|
|
|
|
} GlobalLU_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2014-09-20 17:51:34 +00:00
|
|
|
double for_lu;
|
|
|
|
double total_needed;
|
2004-07-13 11:42:13 +00:00
|
|
|
int expansions;
|
|
|
|
} mem_usage_t;
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Driver routines */
|
|
|
|
extern void
|
|
|
|
sgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
|
|
|
|
SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
|
|
|
|
extern void
|
|
|
|
sgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
|
2014-09-20 17:51:34 +00:00
|
|
|
char *, double *, double *, SuperMatrix *, SuperMatrix *,
|
2004-07-13 11:42:13 +00:00
|
|
|
void *, int, SuperMatrix *, SuperMatrix *,
|
2014-09-20 17:51:34 +00:00
|
|
|
double *, double *, double *, double *,
|
2004-07-13 11:42:13 +00:00
|
|
|
mem_usage_t *, SuperLUStat_t *, int *);
|
|
|
|
|
|
|
|
/* Supernodal LU factor related */
|
|
|
|
extern void
|
2014-09-20 17:51:34 +00:00
|
|
|
sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *,
|
2004-07-13 11:42:13 +00:00
|
|
|
int *, int *, Stype_t, Dtype_t, Mtype_t);
|
|
|
|
extern void
|
2014-09-20 17:51:34 +00:00
|
|
|
sCreate_CompRow_Matrix(SuperMatrix *, int, int, int, double *,
|
2004-07-13 11:42:13 +00:00
|
|
|
int *, int *, Stype_t, Dtype_t, Mtype_t);
|
|
|
|
extern void
|
|
|
|
sCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
|
|
|
|
extern void
|
2014-09-20 17:51:34 +00:00
|
|
|
sCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int,
|
2004-07-13 11:42:13 +00:00
|
|
|
Stype_t, Dtype_t, Mtype_t);
|
|
|
|
extern void
|
2014-09-20 17:51:34 +00:00
|
|
|
sCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, double *,
|
2004-07-13 11:42:13 +00:00
|
|
|
int *, int *, int *, int *, int *,
|
|
|
|
Stype_t, Dtype_t, Mtype_t);
|
|
|
|
extern void
|
2014-09-20 17:51:34 +00:00
|
|
|
sCopy_Dense_Matrix(int, int, double *, int, double *, int);
|
2004-07-13 11:42:13 +00:00
|
|
|
|
|
|
|
extern void countnz (const int, int *, int *, int *, GlobalLU_t *);
|
|
|
|
extern void fixupL (const int, const int *, GlobalLU_t *);
|
|
|
|
|
2014-09-20 17:51:34 +00:00
|
|
|
extern void sallocateA (int, int, double **, int **, int **);
|
2004-07-13 11:42:13 +00:00
|
|
|
extern void sgstrf (superlu_options_t*, SuperMatrix*,
|
|
|
|
int, int, int*, void *, int, int *, int *,
|
|
|
|
SuperMatrix *, SuperMatrix *, SuperLUStat_t*, int *);
|
|
|
|
extern int ssnode_dfs (const int, const int, const int *, const int *,
|
|
|
|
const int *, int *, int *, GlobalLU_t *);
|
2014-09-20 17:51:34 +00:00
|
|
|
extern int ssnode_bmod (const int, const int, double *,
|
|
|
|
double *, GlobalLU_t *, SuperLUStat_t*);
|
2004-07-13 11:42:13 +00:00
|
|
|
extern void spanel_dfs (const int, const int, const int, SuperMatrix *,
|
2014-09-20 17:51:34 +00:00
|
|
|
int *, int *, double *, int *, int *, int *,
|
2004-07-13 11:42:13 +00:00
|
|
|
int *, int *, int *, int *, GlobalLU_t *);
|
|
|
|
extern void spanel_bmod (const int, const int, const int, const int,
|
2014-09-20 17:51:34 +00:00
|
|
|
double *, double *, int *, int *,
|
2004-07-13 11:42:13 +00:00
|
|
|
GlobalLU_t *, SuperLUStat_t*);
|
|
|
|
extern int scolumn_dfs (const int, const int, int *, int *, int *, int *,
|
|
|
|
int *, int *, int *, int *, int *, GlobalLU_t *);
|
2014-09-20 17:51:34 +00:00
|
|
|
extern int scolumn_bmod (const int, const int, double *,
|
|
|
|
double *, int *, int *, int,
|
2004-07-13 11:42:13 +00:00
|
|
|
GlobalLU_t *, SuperLUStat_t*);
|
|
|
|
extern int scopy_to_ucol (int, int, int *, int *, int *,
|
2014-09-20 17:51:34 +00:00
|
|
|
double *, GlobalLU_t *);
|
|
|
|
extern int spivotL (const int, const double, int *, int *,
|
2004-07-13 11:42:13 +00:00
|
|
|
int *, int *, int *, GlobalLU_t *, SuperLUStat_t*);
|
|
|
|
extern void spruneL (const int, const int *, const int, const int,
|
|
|
|
const int *, const int *, int *, GlobalLU_t *);
|
2014-09-20 17:51:34 +00:00
|
|
|
extern void sreadmt (int *, int *, int *, double **, int **, int **);
|
|
|
|
extern void sGenXtrue (int, int, double *, int);
|
|
|
|
extern void sFillRHS (trans_t, int, double *, int, SuperMatrix *,
|
2004-07-13 11:42:13 +00:00
|
|
|
SuperMatrix *);
|
|
|
|
extern void sgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *,
|
|
|
|
SuperMatrix *, SuperLUStat_t*, int *);
|
|
|
|
|
|
|
|
|
|
|
|
/* Driver related */
|
|
|
|
|
2014-09-20 17:51:34 +00:00
|
|
|
extern void sgsequ (SuperMatrix *, double *, double *, double *,
|
|
|
|
double *, double *, int *);
|
|
|
|
extern void slaqgs (SuperMatrix *, double *, double *, double,
|
|
|
|
double, double, char *);
|
2004-07-13 11:42:13 +00:00
|
|
|
extern void sgscon (char *, SuperMatrix *, SuperMatrix *,
|
2014-09-20 17:51:34 +00:00
|
|
|
double, double *, SuperLUStat_t*, int *);
|
|
|
|
extern double sPivotGrowth(int, SuperMatrix *, int *,
|
2004-07-13 11:42:13 +00:00
|
|
|
SuperMatrix *, SuperMatrix *);
|
|
|
|
extern void sgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
|
2014-09-20 17:51:34 +00:00
|
|
|
SuperMatrix *, int *, int *, char *, double *,
|
|
|
|
double *, SuperMatrix *, SuperMatrix *,
|
|
|
|
double *, double *, SuperLUStat_t*, int *);
|
2004-07-13 11:42:13 +00:00
|
|
|
|
|
|
|
extern int sp_strsv (char *, char *, char *, SuperMatrix *,
|
2014-09-20 17:51:34 +00:00
|
|
|
SuperMatrix *, double *, SuperLUStat_t*, int *);
|
|
|
|
extern int sp_sgemv (char *, double, SuperMatrix *, double *,
|
|
|
|
int, double, double *, int);
|
2004-07-13 11:42:13 +00:00
|
|
|
|
2014-09-20 17:51:34 +00:00
|
|
|
extern int sp_sgemm (char *, int, double,
|
|
|
|
SuperMatrix *, double *, int, double,
|
|
|
|
double *, int);
|
2004-07-13 11:42:13 +00:00
|
|
|
|
|
|
|
/* Memory-related */
|
|
|
|
extern int sLUMemInit (fact_t, void *, int, int, int, int, int,
|
|
|
|
SuperMatrix *, SuperMatrix *,
|
2014-09-20 17:51:34 +00:00
|
|
|
GlobalLU_t *, int **, double **);
|
|
|
|
extern void sSetRWork (int, int, double *, double **, double **);
|
|
|
|
extern void sLUWorkFree (int *, double *, GlobalLU_t *);
|
2004-07-13 11:42:13 +00:00
|
|
|
extern int sLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
|
|
|
|
|
2014-09-20 17:51:34 +00:00
|
|
|
extern double *doubleMalloc(int);
|
|
|
|
extern double *doubleCalloc(int);
|
2004-07-13 11:42:13 +00:00
|
|
|
extern int smemory_usage(const int, const int, const int, const int);
|
|
|
|
extern int sQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
|
|
|
|
|
|
|
|
/* Auxiliary routines */
|
2014-09-20 17:51:34 +00:00
|
|
|
extern void sreadhb(int *, int *, int *, double **, int **, int **);
|
|
|
|
extern void sCompRow_to_CompCol(int, int, int, double*, int*, int*,
|
|
|
|
double **, int **, int **);
|
|
|
|
extern void sfill (double *, int, double);
|
|
|
|
extern void sinf_norm_error (int, SuperMatrix *, double *);
|
2004-07-13 11:42:13 +00:00
|
|
|
extern void PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
|
2014-09-20 17:51:34 +00:00
|
|
|
double, double, double *, double *, char *);
|
2004-07-13 11:42:13 +00:00
|
|
|
|
|
|
|
/* Routines for debugging */
|
|
|
|
extern void sPrint_CompCol_Matrix(char *, SuperMatrix *);
|
|
|
|
extern void sPrint_SuperNode_Matrix(char *, SuperMatrix *);
|
|
|
|
extern void sPrint_Dense_Matrix(char *, SuperMatrix *);
|
|
|
|
extern void print_lu_col(char *, int, int, int *, GlobalLU_t *);
|
2014-09-20 17:51:34 +00:00
|
|
|
extern void check_tempv(int, double *);
|
2005-03-09 19:45:59 +00:00
|
|
|
extern int print_int_vec(char *what, int n, int *vec);
|
2004-07-13 11:42:13 +00:00
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
extern int sp_symetree(int *acolst, int *acolend, int *arow, int n, int *parent);
|
2010-10-18 11:21:22 +00:00
|
|
|
extern void sprint_lu_col(char *msg, int jcol, int pivrow, int *xprune, GlobalLU_t *Glu); // added to build with debug for blender - campbell
|
2004-07-13 11:42:13 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __SUPERLU_sSP_DEFS */
|
|
|
|
|