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