kusano 7d535a
/*! @file supermatrix.h
kusano 7d535a
 * \brief Defines matrix types
kusano 7d535a
 */
kusano 7d535a
#ifndef __SUPERLU_SUPERMATRIX /* allow multiple inclusions */
kusano 7d535a
#define __SUPERLU_SUPERMATRIX
kusano 7d535a
kusano 7d535a
kusano 7d535a
/********************************************
kusano 7d535a
 * The matrix types are defined as follows. *
kusano 7d535a
 ********************************************/
kusano 7d535a
typedef enum {
kusano 7d535a
    SLU_NC,    /* column-wise, no supernode */
kusano 7d535a
    SLU_NCP,   /* column-wise, column-permuted, no supernode 
kusano 7d535a
                  (The consecutive columns of nonzeros, after permutation,
kusano 7d535a
		   may not be stored  contiguously.) */
kusano 7d535a
    SLU_NR,    /* row-wize, no supernode */
kusano 7d535a
    SLU_SC,    /* column-wise, supernode */
kusano 7d535a
    SLU_SCP,   /* supernode, column-wise, permuted */    
kusano 7d535a
    SLU_SR,    /* row-wise, supernode */
kusano 7d535a
    SLU_DN,     /* Fortran style column-wise storage for dense matrix */
kusano 7d535a
    SLU_NR_loc  /* distributed compressed row format  */ 
kusano 7d535a
} Stype_t;
kusano 7d535a
kusano 7d535a
typedef enum {
kusano 7d535a
    SLU_S,     /* single */
kusano 7d535a
    SLU_D,     /* double */
kusano 7d535a
    SLU_C,     /* single complex */
kusano 7d535a
    SLU_Z      /* double complex */
kusano 7d535a
} Dtype_t;
kusano 7d535a
kusano 7d535a
typedef enum {
kusano 7d535a
    SLU_GE,    /* general */
kusano 7d535a
    SLU_TRLU,  /* lower triangular, unit diagonal */
kusano 7d535a
    SLU_TRUU,  /* upper triangular, unit diagonal */
kusano 7d535a
    SLU_TRL,   /* lower triangular */
kusano 7d535a
    SLU_TRU,   /* upper triangular */
kusano 7d535a
    SLU_SYL,   /* symmetric, store lower half */
kusano 7d535a
    SLU_SYU,   /* symmetric, store upper half */
kusano 7d535a
    SLU_HEL,   /* Hermitian, store lower half */
kusano 7d535a
    SLU_HEU    /* Hermitian, store upper half */
kusano 7d535a
} Mtype_t;
kusano 7d535a
kusano 7d535a
typedef struct {
kusano 7d535a
	Stype_t Stype; /* Storage type: interprets the storage structure 
kusano 7d535a
		   	  pointed to by *Store. */
kusano 7d535a
	Dtype_t Dtype; /* Data type. */
kusano 7d535a
	Mtype_t Mtype; /* Matrix type: describes the mathematical property of 
kusano 7d535a
			  the matrix. */
kusano 7d535a
	int_t  nrow;   /* number of rows */
kusano 7d535a
	int_t  ncol;   /* number of columns */
kusano 7d535a
	void *Store;   /* pointer to the actual storage of the matrix */
kusano 7d535a
} SuperMatrix;
kusano 7d535a
kusano 7d535a
/***********************************************
kusano 7d535a
 * The storage schemes are defined as follows. *
kusano 7d535a
 ***********************************************/
kusano 7d535a
kusano 7d535a
/* Stype == SLU_NC (Also known as Harwell-Boeing sparse matrix format) */
kusano 7d535a
typedef struct {
kusano 7d535a
    int_t  nnz;	    /* number of nonzeros in the matrix */
kusano 7d535a
    void *nzval;    /* pointer to array of nonzero values, packed by column */
kusano 7d535a
    int_t  *rowind; /* pointer to array of row indices of the nonzeros */
kusano 7d535a
    int_t  *colptr; /* pointer to array of beginning of columns in nzval[] 
kusano 7d535a
		       and rowind[]  */
kusano 7d535a
                    /* Note:
kusano 7d535a
		       Zero-based indexing is used;
kusano 7d535a
		       colptr[] has ncol+1 entries, the last one pointing
kusano 7d535a
		       beyond the last column, so that colptr[ncol] = nnz. */
kusano 7d535a
} NCformat;
kusano 7d535a
kusano 7d535a
/* Stype == SLU_NR */
kusano 7d535a
typedef struct {
kusano 7d535a
    int_t  nnz;	    /* number of nonzeros in the matrix */
kusano 7d535a
    void *nzval;    /* pointer to array of nonzero values, packed by raw */
kusano 7d535a
    int_t  *colind; /* pointer to array of columns indices of the nonzeros */
kusano 7d535a
    int_t  *rowptr; /* pointer to array of beginning of rows in nzval[] 
kusano 7d535a
		       and colind[]  */
kusano 7d535a
                    /* Note:
kusano 7d535a
		       Zero-based indexing is used;
kusano 7d535a
		       rowptr[] has nrow+1 entries, the last one pointing
kusano 7d535a
		       beyond the last row, so that rowptr[nrow] = nnz. */
kusano 7d535a
} NRformat;
kusano 7d535a
kusano 7d535a
/* Stype == SLU_SC */
kusano 7d535a
typedef struct {
kusano 7d535a
  int_t  nnz;	     /* number of nonzeros in the matrix */
kusano 7d535a
  int_t  nsuper;     /* number of supernodes, minus 1 */
kusano 7d535a
  void *nzval;       /* pointer to array of nonzero values, packed by column */
kusano 7d535a
  int_t *nzval_colptr;/* pointer to array of beginning of columns in nzval[] */
kusano 7d535a
  int_t *rowind;     /* pointer to array of compressed row indices of 
kusano 7d535a
			rectangular supernodes */
kusano 7d535a
  int_t *rowind_colptr;/* pointer to array of beginning of columns in rowind[] */
kusano 7d535a
  int_t *col_to_sup;   /* col_to_sup[j] is the supernode number to which column 
kusano 7d535a
			j belongs; mapping from column to supernode number. */
kusano 7d535a
  int_t *sup_to_col;   /* sup_to_col[s] points to the start of the s-th 
kusano 7d535a
			supernode; mapping from supernode number to column.
kusano 7d535a
		        e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 4 (ncol=12)
kusano 7d535a
		              sup_to_col: 0 1 2 4 7 12           (nsuper=4) */
kusano 7d535a
                     /* Note:
kusano 7d535a
		        Zero-based indexing is used;
kusano 7d535a
		        nzval_colptr[], rowind_colptr[], col_to_sup and
kusano 7d535a
		        sup_to_col[] have ncol+1 entries, the last one
kusano 7d535a
		        pointing beyond the last column.
kusano 7d535a
		        For col_to_sup[], only the first ncol entries are
kusano 7d535a
		        defined. For sup_to_col[], only the first nsuper+2
kusano 7d535a
		        entries are defined. */
kusano 7d535a
} SCformat;
kusano 7d535a
kusano 7d535a
/* Stype == SLU_SCP */
kusano 7d535a
typedef struct {
kusano 7d535a
  int_t  nnz;	     /* number of nonzeros in the matrix */
kusano 7d535a
  int_t  nsuper;     /* number of supernodes */
kusano 7d535a
  void *nzval;       /* pointer to array of nonzero values, packed by column */
kusano 7d535a
  int_t  *nzval_colbeg;/* nzval_colbeg[j] points to beginning of column j
kusano 7d535a
			  in nzval[] */
kusano 7d535a
  int_t  *nzval_colend;/* nzval_colend[j] points to one past the last element
kusano 7d535a
			  of column j in nzval[] */
kusano 7d535a
  int_t  *rowind;      /* pointer to array of compressed row indices of 
kusano 7d535a
			  rectangular supernodes */
kusano 7d535a
  int_t *rowind_colbeg;/* rowind_colbeg[j] points to beginning of column j
kusano 7d535a
			  in rowind[] */
kusano 7d535a
  int_t *rowind_colend;/* rowind_colend[j] points to one past the last element
kusano 7d535a
			  of column j in rowind[] */
kusano 7d535a
  int_t *col_to_sup;   /* col_to_sup[j] is the supernode number to which column
kusano 7d535a
			  j belongs; mapping from column to supernode. */
kusano 7d535a
  int_t *sup_to_colbeg; /* sup_to_colbeg[s] points to the start of the s-th 
kusano 7d535a
			   supernode; mapping from supernode to column.*/
kusano 7d535a
  int_t *sup_to_colend; /* sup_to_colend[s] points to one past the end of the
kusano 7d535a
			   s-th supernode; mapping from supernode number to
kusano 7d535a
			   column.
kusano 7d535a
		        e.g.: col_to_sup: 0 1 2 2 3 3 3 4 4 4 4 4 4 (ncol=12)
kusano 7d535a
		              sup_to_colbeg: 0 1 2 4 7              (nsuper=4)
kusano 7d535a
			      sup_to_colend: 1 2 4 7 12                    */
kusano 7d535a
                     /* Note:
kusano 7d535a
		        Zero-based indexing is used;
kusano 7d535a
		        nzval_colptr[], rowind_colptr[], col_to_sup and
kusano 7d535a
		        sup_to_col[] have ncol+1 entries, the last one
kusano 7d535a
		        pointing beyond the last column.         */
kusano 7d535a
} SCPformat;
kusano 7d535a
kusano 7d535a
/* Stype == SLU_NCP */
kusano 7d535a
typedef struct {
kusano 7d535a
    int_t nnz;	  /* number of nonzeros in the matrix */
kusano 7d535a
    void *nzval;  /* pointer to array of nonzero values, packed by column */
kusano 7d535a
    int_t *rowind;/* pointer to array of row indices of the nonzeros */
kusano 7d535a
		  /* Note: nzval[]/rowind[] always have the same length */
kusano 7d535a
    int_t *colbeg;/* colbeg[j] points to the beginning of column j in nzval[] 
kusano 7d535a
                     and rowind[]  */
kusano 7d535a
    int_t *colend;/* colend[j] points to one past the last element of column
kusano 7d535a
		     j in nzval[] and rowind[]  */
kusano 7d535a
		  /* Note:
kusano 7d535a
		     Zero-based indexing is used;
kusano 7d535a
		     The consecutive columns of the nonzeros may not be 
kusano 7d535a
		     contiguous in storage, because the matrix has been 
kusano 7d535a
		     postmultiplied by a column permutation matrix. */
kusano 7d535a
} NCPformat;
kusano 7d535a
kusano 7d535a
/* Stype == SLU_DN */
kusano 7d535a
typedef struct {
kusano 7d535a
    int_t lda;    /* leading dimension */
kusano 7d535a
    void *nzval;  /* array of size lda*ncol to represent a dense matrix */
kusano 7d535a
} DNformat;
kusano 7d535a
kusano 7d535a
/* Stype == SLU_NR_loc (Distributed Compressed Row Format) */
kusano 7d535a
typedef struct {
kusano 7d535a
    int_t nnz_loc;   /* number of nonzeros in the local submatrix */
kusano 7d535a
    int_t m_loc;     /* number of rows local to this processor */
kusano 7d535a
    int_t fst_row;   /* global index of the first row */
kusano 7d535a
    void  *nzval;    /* pointer to array of nonzero values, packed by row */
kusano 7d535a
    int_t *rowptr;   /* pointer to array of beginning of rows in nzval[] 
kusano 7d535a
			and colind[]  */
kusano 7d535a
    int_t *colind;   /* pointer to array of column indices of the nonzeros */
kusano 7d535a
                     /* Note:
kusano 7d535a
			Zero-based indexing is used;
kusano 7d535a
			rowptr[] has n_loc + 1 entries, the last one pointing
kusano 7d535a
			beyond the last row, so that rowptr[n_loc] = nnz_loc.*/
kusano 7d535a
} NRformat_loc;
kusano 7d535a
kusano 7d535a
kusano 7d535a
#endif  /* __SUPERLU_SUPERMATRIX */