00001 #ifndef __SUPERLU_SUPERMATRIX /* allow multiple inclusions */ 00002 #define __SUPERLU_SUPERMATRIX 00003 00004 00005 /******************************************** 00006 * The matrix types are defined as follows. * 00007 ********************************************/ 00008 typedef enum { 00009 SLU_NC, /* column-wise, no supernode */ 00010 SLU_NCP, /* column-wise, column-permuted, no supernode 00011 (The consecutive columns of nonzeros, after permutation, 00012 may not be stored contiguously.) */ 00013 SLU_NR, /* row-wize, no supernode */ 00014 SLU_SC, /* column-wise, supernode */ 00015 SLU_SCP, /* supernode, column-wise, permuted */ 00016 SLU_SR, /* row-wise, supernode */ 00017 SLU_DN, /* Fortran style column-wise storage for dense matrix */ 00018 SLU_NR_loc /* distributed compressed row format */ 00019 } Stype_t; 00020 00021 typedef enum { 00022 SLU_S, /* single */ 00023 SLU_D, /* double */ 00024 SLU_C, /* single complex */ 00025 SLU_Z /* double complex */ 00026 } Dtype_t; 00027 00028 typedef enum { 00029 SLU_GE, /* general */ 00030 SLU_TRLU, /* lower triangular, unit diagonal */ 00031 SLU_TRUU, /* upper triangular, unit diagonal */ 00032 SLU_TRL, /* lower triangular */ 00033 SLU_TRU, /* upper triangular */ 00034 SLU_SYL, /* symmetric, store lower half */ 00035 SLU_SYU, /* symmetric, store upper half */ 00036 SLU_HEL, /* Hermitian, store lower half */ 00037 SLU_HEU /* Hermitian, store upper half */ 00038 } Mtype_t; 00039 00040 typedef struct { 00041 Stype_t Stype; /* Storage type: interprets the storage structure 00042 pointed to by *Store. */ 00043 Dtype_t Dtype; /* Data type. */ 00044 Mtype_t Mtype; /* Matrix type: describes the mathematical property of 00045 the matrix. */ 00046 int_t nrow; /* number of rows */ 00047 int_t ncol; /* number of columns */ 00048 void *Store; /* pointer to the actual storage of the matrix */ 00049 } SuperMatrix; 00050 00051 /*********************************************** 00052 * The storage schemes are defined as follows. * 00053 ***********************************************/ 00054 00055 /* Stype == SLU_NC (Also known as Harwell-Boeing sparse matrix format) */ 00056 typedef struct { 00057 int_t nnz; /* number of nonzeros in the matrix */ 00058 void *nzval; /* pointer to array of nonzero values, packed by column */ 00059 int_t *rowind; /* pointer to array of row indices of the nonzeros */ 00060 int_t *colptr; /* pointer to array of beginning of columns in nzval[] 00061 and rowind[] */ 00062 /* Note: 00063 Zero-based indexing is used; 00064 colptr[] has ncol+1 entries, the last one pointing 00065 beyond the last column, so that colptr[ncol] = nnz. */ 00066 } NCformat; 00067 00068 /* Stype == SLU_NR */ 00069 typedef struct { 00070 int_t nnz; /* number of nonzeros in the matrix */ 00071 void *nzval; /* pointer to array of nonzero values, packed by raw */ 00072 int_t *colind; /* pointer to array of columns indices of the nonzeros */ 00073 int_t *rowptr; /* pointer to array of beginning of rows in nzval[] 00074 and colind[] */ 00075 /* Note: 00076 Zero-based indexing is used; 00077 rowptr[] has nrow+1 entries, the last one pointing 00078 beyond the last row, so that rowptr[nrow] = nnz. */ 00079 } NRformat; 00080 00081 /* Stype == SLU_SC */ 00082 typedef struct { 00083 int_t nnz; /* number of nonzeros in the matrix */ 00084 int_t nsuper; /* number of supernodes, minus 1 */ 00085 void *nzval; /* pointer to array of nonzero values, packed by column */ 00086 int_t *nzval_colptr;/* pointer to array of beginning of columns in nzval[] */ 00087 int_t *rowind; /* pointer to array of compressed row indices of 00088 rectangular supernodes */ 00089 int_t *rowind_colptr;/* pointer to array of beginning of columns in rowind[] */ 00090 int_t *col_to_sup; /* col_to_sup[j] is the supernode number to which column 00091 j belongs; mapping from column to supernode number. */ 00092 int_t *sup_to_col; /* sup_to_col[s] points to the start of the s-th 00093 supernode; mapping from supernode number to column. 00094 e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 4 (ncol=12) 00095 sup_to_col: 0 1 2 4 7 12 (nsuper=4) */ 00096 /* Note: 00097 Zero-based indexing is used; 00098 nzval_colptr[], rowind_colptr[], col_to_sup and 00099 sup_to_col[] have ncol+1 entries, the last one 00100 pointing beyond the last column. 00101 For col_to_sup[], only the first ncol entries are 00102 defined. For sup_to_col[], only the first nsuper+2 00103 entries are defined. */ 00104 } SCformat; 00105 00106 /* Stype == SLU_SCP */ 00107 typedef struct { 00108 int_t nnz; /* number of nonzeros in the matrix */ 00109 int_t nsuper; /* number of supernodes */ 00110 void *nzval; /* pointer to array of nonzero values, packed by column */ 00111 int_t *nzval_colbeg;/* nzval_colbeg[j] points to beginning of column j 00112 in nzval[] */ 00113 int_t *nzval_colend;/* nzval_colend[j] points to one past the last element 00114 of column j in nzval[] */ 00115 int_t *rowind; /* pointer to array of compressed row indices of 00116 rectangular supernodes */ 00117 int_t *rowind_colbeg;/* rowind_colbeg[j] points to beginning of column j 00118 in rowind[] */ 00119 int_t *rowind_colend;/* rowind_colend[j] points to one past the last element 00120 of column j in rowind[] */ 00121 int_t *col_to_sup; /* col_to_sup[j] is the supernode number to which column 00122 j belongs; mapping from column to supernode. */ 00123 int_t *sup_to_colbeg; /* sup_to_colbeg[s] points to the start of the s-th 00124 supernode; mapping from supernode to column.*/ 00125 int_t *sup_to_colend; /* sup_to_colend[s] points to one past the end of the 00126 s-th supernode; mapping from supernode number to 00127 column. 00128 e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 4 (ncol=12) 00129 sup_to_colbeg: 0 1 2 4 7 (nsuper=4) 00130 sup_to_colend: 1 2 4 7 12 */ 00131 /* Note: 00132 Zero-based indexing is used; 00133 nzval_colptr[], rowind_colptr[], col_to_sup and 00134 sup_to_col[] have ncol+1 entries, the last one 00135 pointing beyond the last column. */ 00136 } SCPformat; 00137 00138 /* Stype == SLU_NCP */ 00139 typedef struct { 00140 int_t nnz; /* number of nonzeros in the matrix */ 00141 void *nzval; /* pointer to array of nonzero values, packed by column */ 00142 int_t *rowind;/* pointer to array of row indices of the nonzeros */ 00143 /* Note: nzval[]/rowind[] always have the same length */ 00144 int_t *colbeg;/* colbeg[j] points to the beginning of column j in nzval[] 00145 and rowind[] */ 00146 int_t *colend;/* colend[j] points to one past the last element of column 00147 j in nzval[] and rowind[] */ 00148 /* Note: 00149 Zero-based indexing is used; 00150 The consecutive columns of the nonzeros may not be 00151 contiguous in storage, because the matrix has been 00152 postmultiplied by a column permutation matrix. */ 00153 } NCPformat; 00154 00155 /* Stype == SLU_DN */ 00156 typedef struct { 00157 int_t lda; /* leading dimension */ 00158 void *nzval; /* array of size lda*ncol to represent a dense matrix */ 00159 } DNformat; 00160 00161 /* Stype == SLU_NR_loc (Distributed Compressed Row Format) */ 00162 typedef struct { 00163 int_t nnz_loc; /* number of nonzeros in the local submatrix */ 00164 int_t m_loc; /* number of rows local to this processor */ 00165 int_t fst_row; /* global index of the first row */ 00166 void *nzval; /* pointer to array of nonzero values, packed by row */ 00167 int_t *rowptr; /* pointer to array of beginning of rows in nzval[] 00168 and colind[] */ 00169 int_t *colind; /* pointer to array of column indices of the nonzeros */ 00170 /* Note: 00171 Zero-based indexing is used; 00172 rowptr[] has n_loc + 1 entries, the last one pointing 00173 beyond the last row, so that rowptr[n_loc] = nnz_loc.*/ 00174 } NRformat_loc; 00175 00176 00177 #endif /* __SUPERLU_SUPERMATRIX */