|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*! @file slu_cdefs.h
|
|
kusano |
7d535a |
* \brief Header file for real operations
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* -- SuperLU routine (version 4.1) --
|
|
kusano |
7d535a |
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
|
|
kusano |
7d535a |
* and Lawrence Berkeley National Lab.
|
|
kusano |
7d535a |
* November, 2010
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* Global data structures used in LU factorization -
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* nsuper: #supernodes = nsuper + 1, numbered [0, nsuper].
|
|
kusano |
7d535a |
* (xsup,supno): supno[i] is the supernode no to which i belongs;
|
|
kusano |
7d535a |
* xsup(s) points to the beginning of the s-th supernode.
|
|
kusano |
7d535a |
* e.g. supno 0 1 2 2 3 3 3 4 4 4 4 4 (n=12)
|
|
kusano |
7d535a |
* xsup 0 1 2 4 7 12
|
|
kusano |
7d535a |
* Note: dfs will be performed on supernode rep. relative to the new
|
|
kusano |
7d535a |
* row pivoting ordering
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* (xlsub,lsub): lsub[*] contains the compressed subscript of
|
|
kusano |
7d535a |
* rectangular supernodes; xlsub[j] points to the starting
|
|
kusano |
7d535a |
* location of the j-th column in lsub[*]. Note that xlsub
|
|
kusano |
7d535a |
* is indexed by column.
|
|
kusano |
7d535a |
* Storage: original row subscripts
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* During the course of sparse LU factorization, we also use
|
|
kusano |
7d535a |
* (xlsub,lsub) for the purpose of symmetric pruning. For each
|
|
kusano |
7d535a |
* supernode {s,s+1,...,t=s+r} with first column s and last
|
|
kusano |
7d535a |
* column t, the subscript set
|
|
kusano |
7d535a |
* lsub[j], j=xlsub[s], .., xlsub[s+1]-1
|
|
kusano |
7d535a |
* is the structure of column s (i.e. structure of this supernode).
|
|
kusano |
7d535a |
* It is used for the storage of numerical values.
|
|
kusano |
7d535a |
* Furthermore,
|
|
kusano |
7d535a |
* lsub[j], j=xlsub[t], .., xlsub[t+1]-1
|
|
kusano |
7d535a |
* is the structure of the last column t of this supernode.
|
|
kusano |
7d535a |
* It is for the purpose of symmetric pruning. Therefore, the
|
|
kusano |
7d535a |
* structural subscripts can be rearranged without making physical
|
|
kusano |
7d535a |
* interchanges among the numerical values.
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* However, if the supernode has only one column, then we
|
|
kusano |
7d535a |
* only keep one set of subscripts. For any subscript interchange
|
|
kusano |
7d535a |
* performed, similar interchange must be done on the numerical
|
|
kusano |
7d535a |
* values.
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* The last column structures (for pruning) will be removed
|
|
kusano |
7d535a |
* after the numercial LU factorization phase.
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* (xlusup,lusup): lusup[*] contains the numerical values of the
|
|
kusano |
7d535a |
* rectangular supernodes; xlusup[j] points to the starting
|
|
kusano |
7d535a |
* location of the j-th column in storage vector lusup[*]
|
|
kusano |
7d535a |
* Note: xlusup is indexed by column.
|
|
kusano |
7d535a |
* Each rectangular supernode is stored by column-major
|
|
kusano |
7d535a |
* scheme, consistent with Fortran 2-dim array storage.
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
* (xusub,ucol,usub): ucol[*] stores the numerical values of
|
|
kusano |
7d535a |
* U-columns outside the rectangular supernodes. The row
|
|
kusano |
7d535a |
* subscript of nonzero ucol[k] is stored in usub[k].
|
|
kusano |
7d535a |
* xusub[i] points to the starting location of column i in ucol.
|
|
kusano |
7d535a |
* Storage: new row subscripts; that is subscripts of PA.
|
|
kusano |
7d535a |
*
|
|
kusano |
7d535a |
*/
|
|
kusano |
7d535a |
#ifndef __SUPERLU_cSP_DEFS /* allow multiple inclusions */
|
|
kusano |
7d535a |
#define __SUPERLU_cSP_DEFS
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*
|
|
kusano |
7d535a |
* File name: csp_defs.h
|
|
kusano |
7d535a |
* Purpose: Sparse matrix types and function prototypes
|
|
kusano |
7d535a |
* History:
|
|
kusano |
7d535a |
*/
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#ifdef _CRAY
|
|
kusano |
7d535a |
#include <fortran.h></fortran.h>
|
|
kusano |
7d535a |
#include <string.h></string.h>
|
|
kusano |
7d535a |
#endif
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Define my integer type int_t */
|
|
kusano |
7d535a |
typedef int int_t; /* default */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#include <math.h></math.h>
|
|
kusano |
7d535a |
#include <limits.h></limits.h>
|
|
kusano |
7d535a |
#include "slu_Cnames.h"
|
|
kusano |
7d535a |
#include "supermatrix.h"
|
|
kusano |
7d535a |
#include "slu_util.h"
|
|
kusano |
7d535a |
#include "slu_scomplex.h"
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
typedef struct {
|
|
kusano |
7d535a |
int *xsup; /* supernode and column mapping */
|
|
kusano |
7d535a |
int *supno;
|
|
kusano |
7d535a |
int *lsub; /* compressed L subscripts */
|
|
kusano |
7d535a |
int *xlsub;
|
|
kusano |
7d535a |
complex *lusup; /* L supernodes */
|
|
kusano |
7d535a |
int *xlusup;
|
|
kusano |
7d535a |
complex *ucol; /* U columns */
|
|
kusano |
7d535a |
int *usub;
|
|
kusano |
7d535a |
int *xusub;
|
|
kusano |
7d535a |
int nzlmax; /* current max size of lsub */
|
|
kusano |
7d535a |
int nzumax; /* " " " ucol */
|
|
kusano |
7d535a |
int nzlumax; /* " " " lusup */
|
|
kusano |
7d535a |
int n; /* number of columns in the matrix */
|
|
kusano |
7d535a |
LU_space_t MemModel; /* 0 - system malloc'd; 1 - user provided */
|
|
kusano |
7d535a |
int num_expansions;
|
|
kusano |
7d535a |
ExpHeader *expanders; /* Array of pointers to 4 types of memory */
|
|
kusano |
7d535a |
LU_stack_t stack; /* use user supplied memory */
|
|
kusano |
7d535a |
} GlobalLU_t;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* -------- Prototypes -------- */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#ifdef __cplusplus
|
|
kusano |
7d535a |
extern "C" {
|
|
kusano |
7d535a |
#endif
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*! \brief Driver routines */
|
|
kusano |
7d535a |
extern void
|
|
kusano |
7d535a |
cgssv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
|
|
kusano |
7d535a |
SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
|
|
kusano |
7d535a |
extern void
|
|
kusano |
7d535a |
cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
|
|
kusano |
7d535a |
char *, float *, float *, SuperMatrix *, SuperMatrix *,
|
|
kusano |
7d535a |
void *, int, SuperMatrix *, SuperMatrix *,
|
|
kusano |
7d535a |
float *, float *, float *, float *,
|
|
kusano |
7d535a |
mem_usage_t *, SuperLUStat_t *, int *);
|
|
kusano |
7d535a |
/* ILU */
|
|
kusano |
7d535a |
extern void
|
|
kusano |
7d535a |
cgsisv(superlu_options_t *, SuperMatrix *, int *, int *, SuperMatrix *,
|
|
kusano |
7d535a |
SuperMatrix *, SuperMatrix *, SuperLUStat_t *, int *);
|
|
kusano |
7d535a |
extern void
|
|
kusano |
7d535a |
cgsisx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
|
|
kusano |
7d535a |
char *, float *, float *, SuperMatrix *, SuperMatrix *,
|
|
kusano |
7d535a |
void *, int, SuperMatrix *, SuperMatrix *, float *, float *,
|
|
kusano |
7d535a |
mem_usage_t *, SuperLUStat_t *, int *);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*! \brief Supernodal LU factor related */
|
|
kusano |
7d535a |
extern void
|
|
kusano |
7d535a |
cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, complex *,
|
|
kusano |
7d535a |
int *, int *, Stype_t, Dtype_t, Mtype_t);
|
|
kusano |
7d535a |
extern void
|
|
kusano |
7d535a |
cCreate_CompRow_Matrix(SuperMatrix *, int, int, int, complex *,
|
|
kusano |
7d535a |
int *, int *, Stype_t, Dtype_t, Mtype_t);
|
|
kusano |
7d535a |
extern void
|
|
kusano |
7d535a |
cCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
|
|
kusano |
7d535a |
extern void
|
|
kusano |
7d535a |
cCreate_Dense_Matrix(SuperMatrix *, int, int, complex *, int,
|
|
kusano |
7d535a |
Stype_t, Dtype_t, Mtype_t);
|
|
kusano |
7d535a |
extern void
|
|
kusano |
7d535a |
cCreate_SuperNode_Matrix(SuperMatrix *, int, int, int, complex *,
|
|
kusano |
7d535a |
int *, int *, int *, int *, int *,
|
|
kusano |
7d535a |
Stype_t, Dtype_t, Mtype_t);
|
|
kusano |
7d535a |
extern void
|
|
kusano |
7d535a |
cCopy_Dense_Matrix(int, int, complex *, int, complex *, int);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
extern void countnz (const int, int *, int *, int *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern void ilu_countnz (const int, int *, int *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern void fixupL (const int, const int *, GlobalLU_t *);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
extern void callocateA (int, int, complex **, int **, int **);
|
|
kusano |
7d535a |
extern void cgstrf (superlu_options_t*, SuperMatrix*,
|
|
kusano |
7d535a |
int, int, int*, void *, int, int *, int *,
|
|
kusano |
7d535a |
SuperMatrix *, SuperMatrix *, SuperLUStat_t*, int *);
|
|
kusano |
7d535a |
extern int csnode_dfs (const int, const int, const int *, const int *,
|
|
kusano |
7d535a |
const int *, int *, int *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern int csnode_bmod (const int, const int, const int, complex *,
|
|
kusano |
7d535a |
complex *, GlobalLU_t *, SuperLUStat_t*);
|
|
kusano |
7d535a |
extern void cpanel_dfs (const int, const int, const int, SuperMatrix *,
|
|
kusano |
7d535a |
int *, int *, complex *, int *, int *, int *,
|
|
kusano |
7d535a |
int *, int *, int *, int *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern void cpanel_bmod (const int, const int, const int, const int,
|
|
kusano |
7d535a |
complex *, complex *, int *, int *,
|
|
kusano |
7d535a |
GlobalLU_t *, SuperLUStat_t*);
|
|
kusano |
7d535a |
extern int ccolumn_dfs (const int, const int, int *, int *, int *, int *,
|
|
kusano |
7d535a |
int *, int *, int *, int *, int *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern int ccolumn_bmod (const int, const int, complex *,
|
|
kusano |
7d535a |
complex *, int *, int *, int,
|
|
kusano |
7d535a |
GlobalLU_t *, SuperLUStat_t*);
|
|
kusano |
7d535a |
extern int ccopy_to_ucol (int, int, int *, int *, int *,
|
|
kusano |
7d535a |
complex *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern int cpivotL (const int, const double, int *, int *,
|
|
kusano |
7d535a |
int *, int *, int *, GlobalLU_t *, SuperLUStat_t*);
|
|
kusano |
7d535a |
extern void cpruneL (const int, const int *, const int, const int,
|
|
kusano |
7d535a |
const int *, const int *, int *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern void creadmt (int *, int *, int *, complex **, int **, int **);
|
|
kusano |
7d535a |
extern void cGenXtrue (int, int, complex *, int);
|
|
kusano |
7d535a |
extern void cFillRHS (trans_t, int, complex *, int, SuperMatrix *,
|
|
kusano |
7d535a |
SuperMatrix *);
|
|
kusano |
7d535a |
extern void cgstrs (trans_t, SuperMatrix *, SuperMatrix *, int *, int *,
|
|
kusano |
7d535a |
SuperMatrix *, SuperLUStat_t*, int *);
|
|
kusano |
7d535a |
/* ILU */
|
|
kusano |
7d535a |
extern void cgsitrf (superlu_options_t*, SuperMatrix*, int, int, int*,
|
|
kusano |
7d535a |
void *, int, int *, int *, SuperMatrix *, SuperMatrix *,
|
|
kusano |
7d535a |
SuperLUStat_t*, int *);
|
|
kusano |
7d535a |
extern int cldperm(int, int, int, int [], int [], complex [],
|
|
kusano |
7d535a |
int [], float [], float []);
|
|
kusano |
7d535a |
extern int ilu_csnode_dfs (const int, const int, const int *, const int *,
|
|
kusano |
7d535a |
const int *, int *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern void ilu_cpanel_dfs (const int, const int, const int, SuperMatrix *,
|
|
kusano |
7d535a |
int *, int *, complex *, float *, int *, int *,
|
|
kusano |
7d535a |
int *, int *, int *, int *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern int ilu_ccolumn_dfs (const int, const int, int *, int *, int *,
|
|
kusano |
7d535a |
int *, int *, int *, int *, int *,
|
|
kusano |
7d535a |
GlobalLU_t *);
|
|
kusano |
7d535a |
extern int ilu_ccopy_to_ucol (int, int, int *, int *, int *,
|
|
kusano |
7d535a |
complex *, int, milu_t, double, int,
|
|
kusano |
7d535a |
complex *, int *, GlobalLU_t *, float *);
|
|
kusano |
7d535a |
extern int ilu_cpivotL (const int, const double, int *, int *, int, int *,
|
|
kusano |
7d535a |
int *, int *, int *, double, milu_t,
|
|
kusano |
7d535a |
complex, GlobalLU_t *, SuperLUStat_t*);
|
|
kusano |
7d535a |
extern int ilu_cdrop_row (superlu_options_t *, int, int, double,
|
|
kusano |
7d535a |
int, int *, double *, GlobalLU_t *,
|
|
kusano |
7d535a |
float *, float *, int);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*! \brief Driver related */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
extern void cgsequ (SuperMatrix *, float *, float *, float *,
|
|
kusano |
7d535a |
float *, float *, int *);
|
|
kusano |
7d535a |
extern void claqgs (SuperMatrix *, float *, float *, float,
|
|
kusano |
7d535a |
float, float, char *);
|
|
kusano |
7d535a |
extern void cgscon (char *, SuperMatrix *, SuperMatrix *,
|
|
kusano |
7d535a |
float, float *, SuperLUStat_t*, int *);
|
|
kusano |
7d535a |
extern float cPivotGrowth(int, SuperMatrix *, int *,
|
|
kusano |
7d535a |
SuperMatrix *, SuperMatrix *);
|
|
kusano |
7d535a |
extern void cgsrfs (trans_t, SuperMatrix *, SuperMatrix *,
|
|
kusano |
7d535a |
SuperMatrix *, int *, int *, char *, float *,
|
|
kusano |
7d535a |
float *, SuperMatrix *, SuperMatrix *,
|
|
kusano |
7d535a |
float *, float *, SuperLUStat_t*, int *);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
extern int sp_ctrsv (char *, char *, char *, SuperMatrix *,
|
|
kusano |
7d535a |
SuperMatrix *, complex *, SuperLUStat_t*, int *);
|
|
kusano |
7d535a |
extern int sp_cgemv (char *, complex, SuperMatrix *, complex *,
|
|
kusano |
7d535a |
int, complex, complex *, int);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
extern int sp_cgemm (char *, char *, int, int, int, complex,
|
|
kusano |
7d535a |
SuperMatrix *, complex *, int, complex,
|
|
kusano |
7d535a |
complex *, int);
|
|
kusano |
7d535a |
extern float slamch_(char *);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*! \brief Memory-related */
|
|
kusano |
7d535a |
extern int cLUMemInit (fact_t, void *, int, int, int, int, int,
|
|
kusano |
7d535a |
float, SuperMatrix *, SuperMatrix *,
|
|
kusano |
7d535a |
GlobalLU_t *, int **, complex **);
|
|
kusano |
7d535a |
extern void cSetRWork (int, int, complex *, complex **, complex **);
|
|
kusano |
7d535a |
extern void cLUWorkFree (int *, complex *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern int cLUMemXpand (int, int, MemType, int *, GlobalLU_t *);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
extern complex *complexMalloc(int);
|
|
kusano |
7d535a |
extern complex *complexCalloc(int);
|
|
kusano |
7d535a |
extern float *floatMalloc(int);
|
|
kusano |
7d535a |
extern float *floatCalloc(int);
|
|
kusano |
7d535a |
extern int cmemory_usage(const int, const int, const int, const int);
|
|
kusano |
7d535a |
extern int cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
|
|
kusano |
7d535a |
extern int ilu_cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*! \brief Auxiliary routines */
|
|
kusano |
7d535a |
extern void creadhb(int *, int *, int *, complex **, int **, int **);
|
|
kusano |
7d535a |
extern void creadrb(int *, int *, int *, complex **, int **, int **);
|
|
kusano |
7d535a |
extern void creadtriple(int *, int *, int *, complex **, int **, int **);
|
|
kusano |
7d535a |
extern void cCompRow_to_CompCol(int, int, int, complex*, int*, int*,
|
|
kusano |
7d535a |
complex **, int **, int **);
|
|
kusano |
7d535a |
extern void cfill (complex *, int, complex);
|
|
kusano |
7d535a |
extern void cinf_norm_error (int, SuperMatrix *, complex *);
|
|
kusano |
7d535a |
extern void PrintPerf (SuperMatrix *, SuperMatrix *, mem_usage_t *,
|
|
kusano |
7d535a |
complex, complex, complex *, complex *, char *);
|
|
kusano |
7d535a |
extern float sqselect(int, float *, int);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/*! \brief Routines for debugging */
|
|
kusano |
7d535a |
extern void cPrint_CompCol_Matrix(char *, SuperMatrix *);
|
|
kusano |
7d535a |
extern void cPrint_SuperNode_Matrix(char *, SuperMatrix *);
|
|
kusano |
7d535a |
extern void cPrint_Dense_Matrix(char *, SuperMatrix *);
|
|
kusano |
7d535a |
extern void cprint_lu_col(char *, int, int, int *, GlobalLU_t *);
|
|
kusano |
7d535a |
extern int print_double_vec(char *, int, double *);
|
|
kusano |
7d535a |
extern void check_tempv(int, complex *);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#ifdef __cplusplus
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
#endif
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#endif /* __SUPERLU_cSP_DEFS */
|
|
kusano |
7d535a |
|