00001 00004 #ifndef __SUPERLU_SUPERMATRIX /* allow multiple inclusions */ 00005 #define __SUPERLU_SUPERMATRIX 00006 00007 00008 /******************************************** 00009 * The matrix types are defined as follows. * 00010 ********************************************/ 00011 typedef enum { 00012 SLU_NC, /* column-wise, no supernode */ 00013 SLU_NCP, /* column-wise, column-permuted, no supernode 00014 (The consecutive columns of nonzeros, after permutation, 00015 may not be stored contiguously.) */ 00016 SLU_NR, /* row-wize, no supernode */ 00017 SLU_SC, /* column-wise, supernode */ 00018 SLU_SCP, /* supernode, column-wise, permuted */ 00019 SLU_SR, /* row-wise, supernode */ 00020 SLU_DN, /* Fortran style column-wise storage for dense matrix */ 00021 SLU_NR_loc /* distributed compressed row format */ 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_t nrow; /* number of rows */ 00050 int_t 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 == SLU_NC (Also known as Harwell-Boeing sparse matrix format) */ 00059 typedef struct { 00060 int_t nnz; /* number of nonzeros in the matrix */ 00061 void *nzval; /* pointer to array of nonzero values, packed by column */ 00062 int_t *rowind; /* pointer to array of row indices of the nonzeros */ 00063 int_t *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 == SLU_NR */ 00072 typedef struct { 00073 int_t nnz; /* number of nonzeros in the matrix */ 00074 void *nzval; /* pointer to array of nonzero values, packed by raw */ 00075 int_t *colind; /* pointer to array of columns indices of the nonzeros */ 00076 int_t *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 row, so that rowptr[nrow] = nnz. */ 00082 } NRformat; 00083 00084 /* Stype == SLU_SC */ 00085 typedef struct { 00086 int_t nnz; /* number of nonzeros in the matrix */ 00087 int_t nsuper; /* number of supernodes, minus 1 */ 00088 void *nzval; /* pointer to array of nonzero values, packed by column */ 00089 int_t *nzval_colptr;/* pointer to array of beginning of columns in nzval[] */ 00090 int_t *rowind; /* pointer to array of compressed row indices of 00091 rectangular supernodes */ 00092 int_t *rowind_colptr;/* pointer to array of beginning of columns in rowind[] */ 00093 int_t *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_t *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 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 For col_to_sup[], only the first ncol entries are 00105 defined. For sup_to_col[], only the first nsuper+2 00106 entries are defined. */ 00107 } SCformat; 00108 00109 /* Stype == SLU_SCP */ 00110 typedef struct { 00111 int_t nnz; /* number of nonzeros in the matrix */ 00112 int_t nsuper; /* number of supernodes */ 00113 void *nzval; /* pointer to array of nonzero values, packed by column */ 00114 int_t *nzval_colbeg;/* nzval_colbeg[j] points to beginning of column j 00115 in nzval[] */ 00116 int_t *nzval_colend;/* nzval_colend[j] points to one past the last element 00117 of column j in nzval[] */ 00118 int_t *rowind; /* pointer to array of compressed row indices of 00119 rectangular supernodes */ 00120 int_t *rowind_colbeg;/* rowind_colbeg[j] points to beginning of column j 00121 in rowind[] */ 00122 int_t *rowind_colend;/* rowind_colend[j] points to one past the last element 00123 of column j in rowind[] */ 00124 int_t *col_to_sup; /* col_to_sup[j] is the supernode number to which column 00125 j belongs; mapping from column to supernode. */ 00126 int_t *sup_to_colbeg; /* sup_to_colbeg[s] points to the start of the s-th 00127 supernode; mapping from supernode to column.*/ 00128 int_t *sup_to_colend; /* sup_to_colend[s] points to one past the end of the 00129 s-th supernode; mapping from supernode number to 00130 column. 00131 e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 4 (ncol=12) 00132 sup_to_colbeg: 0 1 2 4 7 (nsuper=4) 00133 sup_to_colend: 1 2 4 7 12 */ 00134 /* Note: 00135 Zero-based indexing is used; 00136 nzval_colptr[], rowind_colptr[], col_to_sup and 00137 sup_to_col[] have ncol+1 entries, the last one 00138 pointing beyond the last column. */ 00139 } SCPformat; 00140 00141 /* Stype == SLU_NCP */ 00142 typedef struct { 00143 int_t nnz; /* number of nonzeros in the matrix */ 00144 void *nzval; /* pointer to array of nonzero values, packed by column */ 00145 int_t *rowind;/* pointer to array of row indices of the nonzeros */ 00146 /* Note: nzval[]/rowind[] always have the same length */ 00147 int_t *colbeg;/* colbeg[j] points to the beginning of column j in nzval[] 00148 and rowind[] */ 00149 int_t *colend;/* colend[j] points to one past the last element of column 00150 j in nzval[] and rowind[] */ 00151 /* Note: 00152 Zero-based indexing is used; 00153 The consecutive columns of the nonzeros may not be 00154 contiguous in storage, because the matrix has been 00155 postmultiplied by a column permutation matrix. */ 00156 } NCPformat; 00157 00158 /* Stype == SLU_DN */ 00159 typedef struct { 00160 int_t lda; /* leading dimension */ 00161 void *nzval; /* array of size lda*ncol to represent a dense matrix */ 00162 } DNformat; 00163 00164 /* Stype == SLU_NR_loc (Distributed Compressed Row Format) */ 00165 typedef struct { 00166 int_t nnz_loc; /* number of nonzeros in the local submatrix */ 00167 int_t m_loc; /* number of rows local to this processor */ 00168 int_t fst_row; /* global index of the first row */ 00169 void *nzval; /* pointer to array of nonzero values, packed by row */ 00170 int_t *rowptr; /* pointer to array of beginning of rows in nzval[] 00171 and colind[] */ 00172 int_t *colind; /* pointer to array of column indices of the nonzeros */ 00173 /* Note: 00174 Zero-based indexing is used; 00175 rowptr[] has n_loc + 1 entries, the last one pointing 00176 beyond the last row, so that rowptr[n_loc] = nnz_loc.*/ 00177 } NRformat_loc; 00178 00179 00180 #endif /* __SUPERLU_SUPERMATRIX */