Blender V2.61 - r43446

supermatrix.h

Go to the documentation of this file.
00001 
00004 #ifndef __SUPERLU_SUPERMATRIX /* allow multiple inclusions */
00005 #define __SUPERLU_SUPERMATRIX
00006 
00007 /********************************************
00008  * The matrix types are defined as follows. *
00009  ********************************************/
00010 typedef enum {
00011     SLU_NC,    /* column-wise, no supernode */
00012     SLU_NR,    /* row-wize, no supernode */
00013     SLU_SC,    /* column-wise, supernode */
00014     SLU_SR,    /* row-wise, supernode */
00015     SLU_NCP,   /* column-wise, column-permuted, no supernode 
00016                   (The consecutive columns of nonzeros, after permutation,
00017            may not be stored  contiguously.) */
00018     SLU_DN     /* Fortran style column-wise storage for dense matrix */
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 == 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 == NR (Also known as row compressed storage (RCS). */
00069 typedef struct {
00070     int_t nnz;     /* number of nonzeros in the matrix */
00071     void  *nzval;  /* pointer to array of nonzero values, packed by row */
00072     int_t *colind; /* pointer to array of column 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               nzval[] and colind[] are of the same length, nnz;
00078               rowptr[] has nrow+1 entries, the last one pointing
00079               beyond the last column, so that rowptr[nrow] = nnz. */
00080 } NRformat;
00081 
00082 /* Stype == SC */
00083 typedef struct {
00084   int_t  nnz;        /* number of nonzeros in the matrix */
00085   int_t  nsuper;     /* number of supernodes, minus 1 */
00086   void *nzval;       /* pointer to array of nonzero values, packed by column */
00087   int_t *nzval_colptr;/* pointer to array of beginning of columns in nzval[] */
00088   int_t *rowind;     /* pointer to array of compressed row indices of 
00089             rectangular supernodes */
00090   int_t *rowind_colptr;/* pointer to array of beginning of columns in rowind[] */
00091   int_t *col_to_sup; /* col_to_sup[j] is the supernode number to which column 
00092             j belongs; mapping from column to supernode number. */
00093   int_t *sup_to_col; /* sup_to_col[s] points to the start of the s-th 
00094             supernode; mapping from supernode number to column.
00095                 e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 4 (ncol=12)
00096                       sup_to_col: 0 1 2 4 7 12           (nsuper=4) */
00097                      /* Note:
00098                 Zero-based indexing is used;
00099                 nzval_colptr[], rowind_colptr[], col_to_sup and
00100                 sup_to_col[] have ncol+1 entries, the last one
00101                 pointing beyond the last column.
00102                 For col_to_sup[], only the first ncol entries are
00103                 defined. For sup_to_col[], only the first nsuper+2
00104                 entries are defined. */
00105 } SCformat;
00106 
00107 /* Stype == NCP */
00108 typedef struct {
00109     int_t nnz;    /* number of nonzeros in the matrix */
00110     void *nzval;  /* pointer to array of nonzero values, packed by column */
00111     int_t *rowind;/* pointer to array of row indices of the nonzeros */
00112           /* Note: nzval[]/rowind[] always have the same length */
00113     int_t *colbeg;/* colbeg[j] points to the beginning of column j in nzval[] 
00114                      and rowind[]  */
00115     int_t *colend;/* colend[j] points to one past the last element of column
00116              j in nzval[] and rowind[]  */
00117           /* Note:
00118              Zero-based indexing is used;
00119              The consecutive columns of the nonzeros may not be 
00120              contiguous in storage, because the matrix has been 
00121              postmultiplied by a column permutation matrix. */
00122 } NCPformat;
00123 
00124 /* Stype == DN */
00125 typedef struct {
00126     int_t lda;    /* leading dimension */
00127     void *nzval;  /* array of size lda*ncol to represent a dense matrix */
00128 } DNformat;
00129 
00130 
00131 
00132 /*********************************************************
00133  * Macros used for easy access of sparse matrix entries. *
00134  *********************************************************/
00135 #define L_SUB_START(col)     ( Lstore->rowind_colptr[col] )
00136 #define L_SUB(ptr)           ( Lstore->rowind[ptr] )
00137 #define L_NZ_START(col)      ( Lstore->nzval_colptr[col] )
00138 #define L_FST_SUPC(superno)  ( Lstore->sup_to_col[superno] )
00139 #define U_NZ_START(col)      ( Ustore->colptr[col] )
00140 #define U_SUB(ptr)           ( Ustore->rowind[ptr] )
00141 
00142 
00143 #endif  /* __SUPERLU_SUPERMATRIX */