TBCI Numerical high perf. C++ Library  2.8.0
supermatrix.h
Go to the documentation of this file.
1 
5 /* $Id: supermatrix.h,v 1.2.2.3 2010/08/26 07:58:23 garloff Exp $ */
6 
7 #ifndef __SUPERLU_SUPERMATRIX /* allow multiple inclusions */
8 #define __SUPERLU_SUPERMATRIX
9 
10 /********************************************
11  * The matrix types are defined as follows. *
12  ********************************************/
13 typedef enum {
14  SLU_NC, /* column-wise, no supernode */
15  SLU_NR, /* row-wize, no supernode */
16  SLU_SC, /* column-wise, supernode */
17  SLU_SR, /* row-wise, 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_DN /* Fortran style column-wise storage for dense matrix */
22 } Stype_t;
23 
24 typedef enum {
25  SLU_S, /* single */
26  SLU_D, /* double */
27  SLU_C, /* single complex */
28  SLU_Z /* double complex */
29 } Dtype_t;
30 
31 typedef enum {
32  SLU_GE, /* general */
33  SLU_TRLU, /* lower triangular, unit diagonal */
34  SLU_TRUU, /* upper triangular, unit diagonal */
35  SLU_TRL, /* lower triangular */
36  SLU_TRU, /* upper triangular */
37  SLU_SYL, /* symmetric, store lower half */
38  SLU_SYU, /* symmetric, store upper half */
39  SLU_HEL, /* Hermitian, store lower half */
40  SLU_HEU /* Hermitian, store upper half */
41 } Mtype_t;
42 
43 typedef struct {
44  Stype_t Stype; /* Storage type: interprets the storage structure
45  pointed to by *Store. */
46  Dtype_t Dtype; /* Data type. */
47  Mtype_t Mtype; /* Matrix type: describes the mathematical property of
48  the matrix. */
49  int nrow; /* number of rows */
50  int ncol; /* number of columns */
51  void *Store; /* pointer to the actual storage of the matrix */
52 } SuperMatrix;
53 
54 /***********************************************
55  * The storage schemes are defined as follows. *
56  ***********************************************/
57 
58 /* Stype == NC (Also known as Harwell-Boeing sparse matrix format (CCS)) */
59 typedef struct {
60  int nnz; /* number of nonzeros in the matrix */
61  void *nzval; /* pointer to array of nonzero values, packed by column */
62  int *rowind; /* pointer to array of row indices of the nonzeros */
63  int *colptr; /* pointer to array of beginning of columns in nzval[]
64  and rowind[] */
65  /* Note:
66  Zero-based indexing is used;
67  colptr[] has ncol+1 entries, the last one pointing
68  beyond the last column, so that colptr[ncol] = nnz. */
69 } NCformat;
70 
71 /* Stype == NR (Also known as row compressed storage (RCS). */
72 typedef struct {
73  int nnz; /* number of nonzeros in the matrix */
74  void *nzval; /* pointer to array of nonzero values, packed by row */
75  int *colind; /* pointer to array of column indices of the nonzeros */
76  int *rowptr; /* pointer to array of beginning of rows in nzval[]
77  and colind[] */
78  /* Note:
79  Zero-based indexing is used;
80  rowptr[] has nrow+1 entries, the last one pointing
81  beyond the last column, so that rowptr[nrow] = nnz. */
82 } NRformat;
83 
84 /* Stype == SC */
85 typedef struct {
86  int nnz; /* number of nonzeros in the matrix */
87  int nsuper; /* number of supernodes, minus 1 */
88  void *nzval; /* pointer to array of nonzero values, packed by column */
89  int *nzval_colptr;/* pointer to array of beginning of columns in nzval[] */
90  int *rowind; /* pointer to array of compressed row indices of
91  rectangular supernodes */
92  int *rowind_colptr;/* pointer to array of beginning of columns in rowind[] */
93  int *col_to_sup; /* col_to_sup[j] is the supernode number to which column
94  j belongs; mapping from column to supernode number. */
95  int *sup_to_col; /* sup_to_col[s] points to the start of the s-th
96  supernode; mapping from supernode number to column.
97  e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 (ncol=12)
98  sup_to_col: 0 1 2 4 7 12 (nsuper=4) */
99  /* Note:
100  Zero-based indexing is used;
101  nzval_colptr[], rowind_colptr[], col_to_sup and
102  sup_to_col[] have ncol+1 entries, the last one
103  pointing beyond the last column. */
104 } SCformat;
105 
106 /* Stype == NCP */
107 typedef struct {
108  int nnz; /* number of nonzeros in the matrix */
109  void *nzval; /* pointer to array of nonzero values, packed by column */
110  int *rowind; /* pointer to array of row indices of the nonzeros */
111  /* Note: nzval[]/rowind[] always have the same length */
112  int *colbeg; /* colbeg[j] points to the beginning of column j in nzval[]
113  and rowind[] */
114  int *colend; /* colend[j] points to one past the last element of column
115  j in nzval[] and rowind[] */
116  /* Note:
117  Zero-based indexing is used;
118  The consecutive columns of the nonzeros may not be
119  contiguous in storage, because the matrix has been
120  postmultiplied by a column permutation matrix. */
121 } NCPformat;
122 
123 /* Stype == DN */
124 typedef struct {
125  int lda; /* leading dimension */
126  void *nzval; /* array of size lda*ncol to represent a dense matrix */
127 } DNformat;
128 
129 
130 
131 /*********************************************************
132  * Macros used for easy access of sparse matrix entries. *
133  *********************************************************/
134 #define L_SUB_START(col) ( Lstore->rowind_colptr[col] )
135 #define L_SUB(ptr) ( Lstore->rowind[ptr] )
136 #define L_NZ_START(col) ( Lstore->nzval_colptr[col] )
137 #define L_FST_SUPC(superno) ( Lstore->sup_to_col[superno] )
138 #define U_NZ_START(col) ( Ustore->colptr[col] )
139 #define U_SUB(ptr) ( Ustore->rowind[ptr] )
140 
141 #ifndef COLPERM_T_DECLARED
143 #define COLPERM_T_DECLARED
144 #endif
145 
146 #endif /* __SUPERLU_SUPERMATRIX */
void * nzval
Definition: supermatrix.h:126
void * Store
Definition: supermatrix.h:51
int * sup_to_col
Definition: supermatrix.h:95
int * nzval_colptr
Definition: supermatrix.h:89
int * colbeg
Definition: supermatrix.h:112
int * colind
Definition: supermatrix.h:75
int * rowind
Definition: supermatrix.h:110
int * rowind
Definition: supermatrix.h:90
Mtype_t Mtype
Definition: supermatrix.h:47
Stype_t
Definition: supermatrix.h:13
void * nzval
Definition: supermatrix.h:61
int * rowind_colptr
Definition: supermatrix.h:92
Stype_t Stype
Definition: supermatrix.h:44
colperm_t
get column permutation vector perm_c[], according to permc_spec: permc_spec = NATURAL(0): use the nat...
Definition: superlu.h:20
int * col_to_sup
Definition: supermatrix.h:93
int * rowind
Definition: supermatrix.h:62
Dtype_t Dtype
Definition: supermatrix.h:46
int * colptr
Definition: supermatrix.h:63
int * colend
Definition: supermatrix.h:114
Mtype_t
Definition: supermatrix.h:31
void * nzval
Definition: supermatrix.h:88
int nsuper
Definition: supermatrix.h:87
Dtype_t
Definition: supermatrix.h:24
int * rowptr
Definition: supermatrix.h:76
void * nzval
Definition: supermatrix.h:74
Definition: superlu.h:20
void * nzval
Definition: supermatrix.h:109