00001 00005 /* $Id: supermatrix.h,v 1.2.2.2 2006/03/03 16:12:43 garloff Exp $ */ 00006 00007 #ifndef __SUPERLU_SUPERMATRIX /* allow multiple inclusions */ 00008 #define __SUPERLU_SUPERMATRIX 00009 00010 /******************************************** 00011 * The matrix types are defined as follows. * 00012 ********************************************/ 00013 typedef enum { 00014 SLU_NC, /* column-wise, no supernode */ 00015 SLU_NR, /* row-wize, no supernode */ 00016 SLU_SC, /* column-wise, supernode */ 00017 SLU_SR, /* row-wise, supernode */ 00018 SLU_NCP, /* column-wise, column-permuted, no supernode 00019 (The consecutive columns of nonzeros, after permutation, 00020 may not be stored contiguously.) */ 00021 SLU_DN /* Fortran style column-wise storage for dense matrix */ 00022 } Stype_t; 00023 00024 typedef enum { 00025 SLU_S, /* single */ 00026 SLU_D, /* double */ 00027 SLU_C, /* single complex */ 00028 SLU_Z /* double complex */ 00029 } Dtype_t; 00030 00031 typedef enum { 00032 SLU_GE, /* general */ 00033 SLU_TRLU, /* lower triangular, unit diagonal */ 00034 SLU_TRUU, /* upper triangular, unit diagonal */ 00035 SLU_TRL, /* lower triangular */ 00036 SLU_TRU, /* upper triangular */ 00037 SLU_SYL, /* symmetric, store lower half */ 00038 SLU_SYU, /* symmetric, store upper half */ 00039 SLU_HEL, /* Hermitian, store lower half */ 00040 SLU_HEU /* Hermitian, store upper half */ 00041 } Mtype_t; 00042 00043 typedef struct { 00044 Stype_t Stype; /* Storage type: interprets the storage structure 00045 pointed to by *Store. */ 00046 Dtype_t Dtype; /* Data type. */ 00047 Mtype_t Mtype; /* Matrix type: describes the mathematical property of 00048 the matrix. */ 00049 int nrow; /* number of rows */ 00050 int ncol; /* number of columns */ 00051 void *Store; /* pointer to the actual storage of the matrix */ 00052 } SuperMatrix; 00053 00054 /*********************************************** 00055 * The storage schemes are defined as follows. * 00056 ***********************************************/ 00057 00058 /* Stype == NC (Also known as Harwell-Boeing sparse matrix format (CCS)) */ 00059 typedef struct { 00060 int nnz; /* number of nonzeros in the matrix */ 00061 void *nzval; /* pointer to array of nonzero values, packed by column */ 00062 int *rowind; /* pointer to array of row indices of the nonzeros */ 00063 int *colptr; /* pointer to array of beginning of columns in nzval[] 00064 and rowind[] */ 00065 /* Note: 00066 Zero-based indexing is used; 00067 colptr[] has ncol+1 entries, the last one pointing 00068 beyond the last column, so that colptr[ncol] = nnz. */ 00069 } NCformat; 00070 00071 /* Stype == NR (Also known as row compressed storage (RCS). */ 00072 typedef struct { 00073 int nnz; /* number of nonzeros in the matrix */ 00074 void *nzval; /* pointer to array of nonzero values, packed by row */ 00075 int *colind; /* pointer to array of column indices of the nonzeros */ 00076 int *rowptr; /* pointer to array of beginning of rows in nzval[] 00077 and colind[] */ 00078 /* Note: 00079 Zero-based indexing is used; 00080 rowptr[] has nrow+1 entries, the last one pointing 00081 beyond the last column, so that rowptr[nrow] = nnz. */ 00082 } NRformat; 00083 00084 /* Stype == SC */ 00085 typedef struct { 00086 int nnz; /* number of nonzeros in the matrix */ 00087 int nsuper; /* number of supernodes, minus 1 */ 00088 void *nzval; /* pointer to array of nonzero values, packed by column */ 00089 int *nzval_colptr;/* pointer to array of beginning of columns in nzval[] */ 00090 int *rowind; /* pointer to array of compressed row indices of 00091 rectangular supernodes */ 00092 int *rowind_colptr;/* pointer to array of beginning of columns in rowind[] */ 00093 int *col_to_sup; /* col_to_sup[j] is the supernode number to which column 00094 j belongs; mapping from column to supernode number. */ 00095 int *sup_to_col; /* sup_to_col[s] points to the start of the s-th 00096 supernode; mapping from supernode number to column. 00097 e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 (ncol=12) 00098 sup_to_col: 0 1 2 4 7 12 (nsuper=4) */ 00099 /* Note: 00100 Zero-based indexing is used; 00101 nzval_colptr[], rowind_colptr[], col_to_sup and 00102 sup_to_col[] have ncol+1 entries, the last one 00103 pointing beyond the last column. */ 00104 } SCformat; 00105 00106 /* Stype == NCP */ 00107 typedef struct { 00108 int nnz; /* number of nonzeros in the matrix */ 00109 void *nzval; /* pointer to array of nonzero values, packed by column */ 00110 int *rowind; /* pointer to array of row indices of the nonzeros */ 00111 /* Note: nzval[]/rowind[] always have the same length */ 00112 int *colbeg; /* colbeg[j] points to the beginning of column j in nzval[] 00113 and rowind[] */ 00114 int *colend; /* colend[j] points to one past the last element of column 00115 j in nzval[] and rowind[] */ 00116 /* Note: 00117 Zero-based indexing is used; 00118 The consecutive columns of the nonzeros may not be 00119 contiguous in storage, because the matrix has been 00120 postmultiplied by a column permutation matrix. */ 00121 } NCPformat; 00122 00123 /* Stype == DN */ 00124 typedef struct { 00125 int lda; /* leading dimension */ 00126 void *nzval; /* array of size lda*ncol to represent a dense matrix */ 00127 } DNformat; 00128 00129 00130 00131 /********************************************************* 00132 * Macros used for easy access of sparse matrix entries. * 00133 *********************************************************/ 00134 #define L_SUB_START(col) ( Lstore->rowind_colptr[col] ) 00135 #define L_SUB(ptr) ( Lstore->rowind[ptr] ) 00136 #define L_NZ_START(col) ( Lstore->nzval_colptr[col] ) 00137 #define L_FST_SUPC(superno) ( Lstore->sup_to_col[superno] ) 00138 #define U_NZ_START(col) ( Ustore->colptr[col] ) 00139 #define U_SUB(ptr) ( Ustore->rowind[ptr] ) 00140 00141 #ifndef COLPERM_T_DECLARED 00142 typedef enum {NATURAL, MMD_ATA, MMD_AT_PLUS_A, COLAMD, MY_PERMC} colperm_t; 00143 #define COLPERM_T_DECLARED 00144 #endif 00145 00146 #endif /* __SUPERLU_SUPERMATRIX */
1.5.6