1 /* 2 ARPACK++ v1.2 2/20/2000 3 c++ interface to ARPACK code. 4 5 MODULE ARLSupM.h. 6 Unaltered copy of supermatrix.h (from SuperLU package). 7 */ 8 9 #ifndef __SUPERLU_SUPERMATRIX /* allow multiple inclusions */ 10 #define __SUPERLU_SUPERMATRIX 11 12 13 /******************************************** 14 * The matrix types are defined as follows. * 15 ********************************************/ 16 typedef enum { 17 SLU_NC, /* column-wise, no supernode */ 18 SLU_NCP, /* column-wise, column-permuted, no supernode 19 (The consecutive columns of nonzeros, after permutation, 20 may not be stored contiguously.) */ 21 SLU_NR, /* row-wize, no supernode */ 22 SLU_SC, /* column-wise, supernode */ 23 SLU_SCP, /* supernode, column-wise, permuted */ 24 SLU_SR, /* row-wise, supernode */ 25 SLU_DN, /* Fortran style column-wise storage for dense matrix */ 26 SLU_NR_loc /* distributed compressed row format */ 27 } Stype_t; 28 29 typedef enum { 30 SLU_S, /* single */ 31 SLU_D, /* double */ 32 SLU_C, /* single complex */ 33 SLU_Z /* double complex */ 34 } Dtype_t; 35 36 typedef enum { 37 SLU_GE, /* general */ 38 SLU_TRLU, /* lower triangular, unit diagonal */ 39 SLU_TRUU, /* upper triangular, unit diagonal */ 40 SLU_TRL, /* lower triangular */ 41 SLU_TRU, /* upper triangular */ 42 SLU_SYL, /* symmetric, store lower half */ 43 SLU_SYU, /* symmetric, store upper half */ 44 SLU_HEL, /* Hermitian, store lower half */ 45 SLU_HEU /* Hermitian, store upper half */ 46 } Mtype_t; 47 48 typedef struct { 49 Stype_t Stype; /* Storage type: interprets the storage structure 50 pointed to by *Store. */ 51 Dtype_t Dtype; /* Data type. */ 52 Mtype_t Mtype; /* Matrix type: describes the mathematical property of 53 the matrix. */ 54 int nrow; /* number of rows */ 55 int ncol; /* number of columns */ 56 void *Store; /* pointer to the actual storage of the matrix */ 57 } SuperMatrix; 58 59 /*********************************************** 60 * The storage schemes are defined as follows. * 61 ***********************************************/ 62 63 /* Stype == SLU_NC (Also known as Harwell-Boeing sparse matrix format) */ 64 typedef struct { 65 int nnz; /* number of nonzeros in the matrix */ 66 void *nzval; /* pointer to array of nonzero values, packed by column */ 67 int *rowind; /* pointer to array of row indices of the nonzeros */ 68 int *colptr; /* pointer to array of beginning of columns in nzval[] 69 and rowind[] */ 70 /* Note: 71 Zero-based indexing is used; 72 colptr[] has ncol+1 entries, the last one pointing 73 beyond the last column, so that colptr[ncol] = nnz. */ 74 } NCformat; 75 76 /* Stype == SLU_NR */ 77 typedef struct { 78 int nnz; /* number of nonzeros in the matrix */ 79 void *nzval; /* pointer to array of nonzero values, packed by raw */ 80 int *colind; /* pointer to array of columns indices of the nonzeros */ 81 int *rowptr; /* pointer to array of beginning of rows in nzval[] 82 and colind[] */ 83 /* Note: 84 Zero-based indexing is used; 85 rowptr[] has nrow+1 entries, the last one pointing 86 beyond the last row, so that rowptr[nrow] = nnz. */ 87 } NRformat; 88 89 /* Stype == SLU_SC */ 90 typedef struct { 91 int nnz; /* number of nonzeros in the matrix */ 92 int nsuper; /* number of supernodes, minus 1 */ 93 void *nzval; /* pointer to array of nonzero values, packed by column */ 94 int *nzval_colptr;/* pointer to array of beginning of columns in nzval[] */ 95 int *rowind; /* pointer to array of compressed row indices of 96 rectangular supernodes */ 97 int *rowind_colptr;/* pointer to array of beginning of columns in rowind[] */ 98 int *col_to_sup; /* col_to_sup[j] is the supernode number to which column 99 j belongs; mapping from column to supernode number. */ 100 int *sup_to_col; /* sup_to_col[s] points to the start of the s-th 101 supernode; mapping from supernode number to column. 102 e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 4 (ncol=12) 103 sup_to_col: 0 1 2 4 7 12 (nsuper=4) */ 104 /* Note: 105 Zero-based indexing is used; 106 nzval_colptr[], rowind_colptr[], col_to_sup and 107 sup_to_col[] have ncol+1 entries, the last one 108 pointing beyond the last column. 109 For col_to_sup[], only the first ncol entries are 110 defined. For sup_to_col[], only the first nsuper+2 111 entries are defined. */ 112 } SCformat; 113 114 /* Stype == SLU_SCP */ 115 typedef struct { 116 int nnz; /* number of nonzeros in the matrix */ 117 int nsuper; /* number of supernodes */ 118 void *nzval; /* pointer to array of nonzero values, packed by column */ 119 int *nzval_colbeg;/* nzval_colbeg[j] points to beginning of column j 120 in nzval[] */ 121 int *nzval_colend;/* nzval_colend[j] points to one past the last element 122 of column j in nzval[] */ 123 int *rowind; /* pointer to array of compressed row indices of 124 rectangular supernodes */ 125 int *rowind_colbeg;/* rowind_colbeg[j] points to beginning of column j 126 in rowind[] */ 127 int *rowind_colend;/* rowind_colend[j] points to one past the last element 128 of column j in rowind[] */ 129 int *col_to_sup; /* col_to_sup[j] is the supernode number to which column 130 j belongs; mapping from column to supernode. */ 131 int *sup_to_colbeg; /* sup_to_colbeg[s] points to the start of the s-th 132 supernode; mapping from supernode to column.*/ 133 int *sup_to_colend; /* sup_to_colend[s] points to one past the end of the 134 s-th supernode; mapping from supernode number to 135 column. 136 e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 4 (ncol=12) 137 sup_to_colbeg: 0 1 2 4 7 (nsuper=4) 138 sup_to_colend: 1 2 4 7 12 */ 139 /* Note: 140 Zero-based indexing is used; 141 nzval_colptr[], rowind_colptr[], col_to_sup and 142 sup_to_col[] have ncol+1 entries, the last one 143 pointing beyond the last column. */ 144 } SCPformat; 145 146 /* Stype == SLU_NCP */ 147 typedef struct { 148 int nnz; /* number of nonzeros in the matrix */ 149 void *nzval; /* pointer to array of nonzero values, packed by column */ 150 int *rowind;/* pointer to array of row indices of the nonzeros */ 151 /* Note: nzval[]/rowind[] always have the same length */ 152 int *colbeg;/* colbeg[j] points to the beginning of column j in nzval[] 153 and rowind[] */ 154 int *colend;/* colend[j] points to one past the last element of column 155 j in nzval[] and rowind[] */ 156 /* Note: 157 Zero-based indexing is used; 158 The consecutive columns of the nonzeros may not be 159 contiguous in storage, because the matrix has been 160 postmultiplied by a column permutation matrix. */ 161 } NCPformat; 162 163 /* Stype == SLU_DN */ 164 typedef struct { 165 int lda; /* leading dimension */ 166 void *nzval; /* array of size lda*ncol to represent a dense matrix */ 167 } DNformat; 168 169 /* Stype == SLU_NR_loc (Distributed Compressed Row Format) */ 170 typedef struct { 171 int nnz_loc; /* number of nonzeros in the local submatrix */ 172 int m_loc; /* number of rows local to this processor */ 173 int fst_row; /* global index of the first row */ 174 void *nzval; /* pointer to array of nonzero values, packed by row */ 175 int *rowptr; /* pointer to array of beginning of rows in nzval[] 176 and colind[] */ 177 int *colind; /* pointer to array of column indices of the nonzeros */ 178 /* Note: 179 Zero-based indexing is used; 180 rowptr[] has n_loc + 1 entries, the last one pointing 181 beyond the last row, so that rowptr[n_loc] = nnz_loc.*/ 182 } NRformat_loc; 183 184 185 #endif /* __SUPERLU_SUPERMATRIX */ 186